您尚未登录。

#16 2021-05-08 15:12:02

comix
会员
注册时间: 2020-08-15
帖子: 24

Re: qemu的虚拟网络接口处的ip一直无法获取并且虚拟机无法联网。

多谢,dnsmasq运行之后虚拟机的ip出来了

离线

#17 2021-06-25 23:18:18

JayceCao
会员
注册时间: 2021-06-25
帖子: 1

Re: qemu的虚拟网络接口处的ip一直无法获取并且虚拟机无法联网。

使用

sudo brctl setageing br0 0

命令将桥接网络接口 br0 的 ageing time 设置为 0 即可。但是这个设置在系统重启之后会失效。我正在研究是这项设置永久生效的方法。

我再详细说明一下我遇到的问题,希望以后你遇到相同问题的时候能帮到你。我没有配置 DHCP,而是通过手动配置静态 IP。配置好后发现 ping 不通网关,而且 ping 同一网段其他 IP 的时候丢包严重。同时宿主机的内核日志有以下大量日志数据:

[  +0.563882] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[  +0.245067] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[Jun25 23:06] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[  +0.778412] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[Jun25 23:08] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[  +0.894017] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[Jun25 23:10] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[  +0.048007] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[  +2.234839] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)
[  +0.590008] br0: received packet on eth0 with own address as source address (addr:8e:91:f8:c5:19:1b, vlan:0)

同时通过 DHCP 也获取不到 IP。
通过抓包发现,与 vm 内部网络接口对应的宿主机的 peer 网络接口不会将对端 host 发送的数据包转发给 vm,也就是说 vm 能发送数据包,目标 host 也有响应数据包,但是宿主机网络接口不会把响应数据包转发给 vm。
解决方法就是开始列出的那条命令。

最近编辑记录 JayceCao (2021-06-25 23:24:27)

离线

页脚