一、前提
(1)确认系统中/lib是否有libnss_dns* 和libresolv*相关库。
(2)拨号后,如果resolv.conf不是产生在/etc下,则手动建立软链接
ln -s /etc/ppp/resolv.conf /etc/resolv.conf
二、过程
[root@A40i bin]# ln -s /etc/ppp/resolv.conf /etc/resolv.conf
[root@A40i bin]# ping www.baidu.com
ping: bad address 'www.baidu.com'
[root@A40i bin]# cat /etc/resolv.conf
nameserver 221.131.143.69
nameserver 223.108.211.83
[root@A40i lib]# ping 221.131.143.69
PING 221.131.143.69 (221.131.143.69): 56 data bytes
ping: sendto: Network is unreachable
[root@A40i lib]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp10
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
[root@A40i lib]# route add -host 221.131.143.69 dev ppp10
[root@A40i lib]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp10
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
221.131.143.69 0.0.0.0 255.255.255.255 UH 0 0 0 ppp10
[root@A40i lib]# ping 221.131.143.69
PING 221.131.143.69 (221.131.143.69): 56 data bytes
64 bytes from 221.131.143.69: seq=0 ttl=79 time=207.302 ms
64 bytes from 221.131.143.69: seq=1 ttl=78 time=100.996 ms
^C
--- 221.131.143.69 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 100.996/154.149/207.302 ms
[root@A40i lib]# ping baidu.com
PING baidu.com (39.156.66.10): 56 data bytes
ping: sendto: Network is unreachable
[root@A40i lib]# route add -host 39.156.66.10 dev ppp10
[root@A40i lib]# ping baidu.com
PING baidu.com (39.156.66.10): 56 data bytes
64 bytes from 39.156.66.10: seq=0 ttl=52 time=99.643 ms
64 bytes from 39.156.66.10: seq=1 ttl=52 time=104.313 ms
^C
--- baidu.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 99.643/101.978/104.313 ms
因篇幅问题不能全部显示,请点此查看更多更全内容