linux网络设置问题 ping: unknown host www.baidu.com


在尝试简历建立 连接时:

[cf@yun01 Desktop]$ ssh yun@yun01
ssh: connect to host yun01 port 22: Network is unreachable

失败了 ,校验一下网络

[root@yun01 Desktop]# ping www.baidu.com
ping: unknown host www.baidu.com

建立网络连接有问题

 ifconfig查看

eth1      Link encap:Ethernet  HWaddr 00:0C:29:17:4E:E0  
          inet6 addr: fe80::20c:29ff:fe17:4ee0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:240 (240.0 b)  TX bytes:258 (258.0 b)


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:812 errors:0 dropped:0 overruns:0 frame:0
          TX packets:812 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:61588 (60.1 KiB)  TX bytes:61588 (60.1 KiB)


缺少 net addr 。检查发现网络未连接,打开网络连接之后 再次查看

[root@yun01 Desktop]# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:0C:29:17:4E:E0  
          inet addr:192.168.1.115  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe17:4ee0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:240 (240.0 b)  TX bytes:378 (378.0 b)


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:824 errors:0 dropped:0 overruns:0 frame:0
          TX packets:824 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:62452 (60.9 KiB)  TX bytes:62452 (60.9 KiB)

正常分配 IP ,但尝试ping百度

[root@yun01 Desktop]# ping www.baidu.com
ping: unknown host www.baidu.com


ping 8.8.8.8 时 就能建立正常的

 [root@yun01 Desktop]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=3 ttl=35 time=111 ms

检查发现 DNS有问题,尚未配置,参照网上的DNS配置:

 sudo vi /etc/resolv.conf

 nameserver 8.8.8.8

再次 ping

[root@yun01 Desktop]# ping www.baidu.com
PING www.a.shifen.com (119.75.217.109) 56(84) bytes of data.
64 bytes from 119.75.217.109: icmp_seq=1 ttl=53 time=33.6 ms
64 bytes from 119.75.217.109: icmp_seq=2 ttl=53 time=36.4 ms

在linux终端中正常连接了。 







你可能感兴趣的:(linux网络设置问题 ping: unknown host www.baidu.com)