我正在尝试设置 MIPS Linux 盒式网络。以下是其配置:
~ # ifconfig
eth0 Link encap:Ethernet HWaddr CC:5D:4E:FF:45:7F
inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::ce5d:4eff:feff:2178/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1333 errors:0 dropped:10 overruns:0 frame:0
TX packets:573 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:107853 (105.3 KiB) TX bytes:45385 (44.3 KiB)
Interrupt:5
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:9 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:936 (936.0 B) TX bytes:936 (936.0 B)
~ # route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
~ # cat /etc/resolv.conf
nameserver 8.8.8.8
~ # iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
我可以通过 IP 地址 ping 通互联网资源:
~ # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=44 time=60.757 ms
^C
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 60.757/60.757/60.757 ms
但 DNS 不起作用:
~ # ping google.com
ping: bad address 'google.com'
甚至本地 HTTP 资源也不可用:
~ # wget http://192.168.0.1/
Connecting to 192.168.0.1 (192.168.0.1:80)
wget: can't connect to remote host (192.168.0.1): Connection timed out
TCP 连接挂起在 SYN_RECV/SYN_SENT 状态:
~ # netstat -n
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.0.2:80 192.168.0.3:44939 SYN_RECV <-incoming TCP
tcp 0 1 192.168.0.2:40019 192.168.0.1:80 SYN_SENT <-outgoing TCP
udp 0 0 192.168.0.2:42177 8.8.8.8:53 ESTABLISHED
有什么问题?谢谢。