我们在 Debian 8 机器上运行 Apache,该机器位于路由器后面。我可以告诉 Apache 正在运行并提供页面,因为当我登录到盒子时,我可以使用“localhost”地址和本地 IP 来获取网页,如“ifconfig”命令所示
myuser@myserver:~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:37:ae:d2:3f:29
inet addr:192.168.0.114 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::d964:f94e:233d:6f55/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:103604 errors:0 dropped:20 overruns:0 frame:0
TX packets:54463 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33144049 (31.6 MiB) TX bytes:6391213 (6.0 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:9550967 errors:0 dropped:0 overruns:0 frame:0
TX packets:9550967 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:1519312520 (1.4 GiB) TX bytes:1519312520 (1.4 GiB)
在这里我可以通过转到机器本身的终端来“wget”页面
myuser@myserver:~ $ wget http://192.168.0.114
converted 'http://192.168.0.114' (ANSI_X3.4-1968) -> 'http://192.168.0.114' (UTF-8)
--2017-09-18 14:54:01-- http://192.168.0.114/
Connecting to 192.168.0.114:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html.2'
index.html.2 [ <=> ] 7.33K --.-KB/s in 0s
2017-09-18 14:54:06 (31.8 MB/s) - 'index.html.2' saved [7506]
但当我们访问时http://192.168.0.114在局域网内的网络浏览器上,我们没有得到任何响应。我正在尝试找出还有什么可能阻止连接。我假设如果我们尝试通过本地 IP 进行访问,我们会在这个阶段绕过路由器。