标题:
ping: unknown host www.baidu.com
[打印本页]
作者:
look_w
时间:
2017-10-24 17:52
标题:
ping: unknown host www.baidu.com
本帖最后由 look_w 于 2017-10-24 17:53 编辑
ubuntu14
exbot@ubuntu:~$
ping
ping: unknown host
解决方法:
这是因为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
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0