ping: unknown host www.baidu.com

ubuntu14

exbot@ubuntu:~$ ping www.baidu.com
ping: unknown host www.baidu.com


解决方法:

这是因为DNS服务器没有配置好,如果网络没有问题,可以按下面的步骤进行检查:


1.检测网卡是否正常

exbot@ubuntu:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:21:4f:40  
          inet addr:192.168.2.191  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe21:4f40/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7389 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1710 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4332981 (4.3 MB)  TX bytes:209276 (209.2 KB)


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:3049 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3049 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3137850 (3.1 MB)  TX bytes:3137850 (3.1 MB)

2.能否上内网

exbot@ubuntu:~$ ping 192.168.2.152
PING 192.168.2.152 (192.168.2.152) 56(84) bytes of data.
64 bytes from 192.168.2.152: icmp_seq=1 ttl=128 time=2.39 ms
64 bytes from 192.168.2.152: icmp_seq=2 ttl=128 time=0.924 ms

3.ping dns 服务器

exbot@ubuntu:~$ 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=1 ttl=48 time=251 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=250 ms

4.查看一下配置文件/etc/resolv.conf

exbot@ubuntu:~$ cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory

5.发现没有这个文件

exbot@ubuntu:~$ sudo gedit /etc/resolv.conf


添加以下:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search localdomain






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值