虚拟机ping 其他环境报错:From 172.20.0.1 icmp_seq=118 Destination Host Unreachable

我的是ubuntu环境,之前还可以,换了网络后ping 测试环境或者其他环境ping 不通,

因为我是用的桥接模式,

ping 的时候报错:

From 172.20.0.1 icmp_seq=197 Destination Host Unreachable

这里有问题,应该从我自己的网卡上路由出去,怎么会从172.20.0.1路由出去呢?

查看下我的路由:route

root@my-computer:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 eth0
10.1.1.0        0.0.0.0         255.255.255.0   U     0      0        0 cbr0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.34.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
172.20.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-3a7bc24366c5
172.21.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-253a8450fb36
 

发现多了两个虚拟网卡br,

删除多余的网卡:ifconfig 网卡名 down

把这两个网卡删除后:

route

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 eth0
10.1.1.0        0.0.0.0         255.255.255.0   U     0      0        0 cbr0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.34.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
 

就正常了;

近日发现linux的机器无法解析域名,首先想到了是DNS的问题。问了网络负责人之后DNS和虚拟网卡同属于一个网段了。解决方法删除这个虚拟网卡br-xxxxxxxxxxx。

ubuntu 删除虚拟网卡_u014221090的专栏-CSDN博客_ubuntu 删除虚拟网卡

猜你喜欢

转载自blog.csdn.net/u010953880/article/details/121752640