马春杰杰 Exit Reader Mode

[mcj]ubuntu16.04无法访问网页:ping: unknown host www.baidu.com

这个问题真是来得莫名其妙,突然就不能上网了。打不开任何网页,尝试着ping了一下百度,提示

ubuntu@mcj:/root$ ping www.baidu.com
ping: unknown host www.baidu.com

找了很多答案,都不适用于我这个,我这里有两个虚拟网卡eth0和eth1,平时都是用eth1连接,会不会跟这个有关系?

还有一个可能性,那就是mac地址,是不是现在的mac地址冲突?于是着手修改这两个地方,首先禁用eth0,然后修改mac地址

sudo vi /etc/network/interfaces

先把eth0注释掉,然后加入网卡

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dhcp
hwaddress ether 00:01:04:1b:2C:1F
#auto eth0
#iface eth0 inet dhcp

重启一下容器,再次ping百度试试~~

ubuntu@mcj:/root$ ping www.baidu.com
PING www.a.shifen.com (119.75.217.26) 56(84) bytes of data.
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2035ms

这次就很完美啦~~

本文最后更新于2023年6月6日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!