Networking KVM:公共网桥在主机上接收IP,但虚拟机不接收

Networking KVM:公共网桥在主机上接收IP,但虚拟机不接收,networking,iptables,kvm,Networking,Iptables,Kvm,我已在主机上使用单个eth接口创建了br0,它接收IP,我可以通过ssh从网络中的其他主机访问它: br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.50 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::9ecf:6d35:bc82:c5e1 prefixlen 64 scopeid

我已在主机上使用单个eth接口创建了br0,它接收IP,我可以通过ssh从网络中的其他主机访问它:

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.50  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::9ecf:6d35:bc82:c5e1  prefixlen 64  scopeid 0x20<link>
        ether 00:1c:c4:47:ce:72  txqueuelen 1000  (Ethernet)
        RX packets 93667  bytes 23521427 (22.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 31242  bytes 2603126 (2.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

br0     8000.001cc447ce72   yes     enp5s0f1
                            vnet0
                            vnet1
br0:flags=4163 mtu 1500
inet 192.168.1.50网络掩码255.255.255.0广播192.168.1.255
inet6 fe80::9ecf:6d35:bc82:c5e1预桥64作用域ID 0x20
乙醚00:1c:c4:47:ce:72 txqueuelen 1000(以太网)
接收数据包93667字节23521427(22.4 MiB)
接收错误0丢弃0超出0帧0
发送数据包31242字节2603126(2.4 MiB)
发送错误0丢弃0溢出0载波0冲突0
br0 8000.001cc447ce72是enp5s0f1
vnet0
vnet1
在KVM中,我创建了桥接网络并将其分配给我的VM:

# virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 host-bridge          active     yes           yes

# cat host-bridge.xml 
<network>
  <name>host-bridge</name>
  <forward mode="bridge"/>
  <bridge name="br0"/>
</network>
#virsh网络列表--所有
名称状态自动启动持久化
----------------------------------------------------------
主机网桥激活是是
#cat host-bridge.xml
主桥
当我启动VM(centos8,无FW)时,它不接收任何IP,dhclient超时,等等


你知道我错过了什么吗?我已经查看了主机防火墙,对于家庭网络的br0接口,我有一个/24容差。

我有类似的设置,还有一些附加功能,例如绑定和以网桥结尾的VLAN

# No special setting about KVM networking
virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes

# VM connected directly to host bridge
cat /etc/libvirt/qemu/MY_VM
...
<interface type='bridge'>
  <mac address='52:xx:xx:xx:xx:40'/>
  <source bridge='br41'/>
  <model type='e1000'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
...

# And this might be your problem
sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
#没有关于KVM网络的特殊设置
virsh网络列表--全部
名称状态自动启动持久化
----------------------------------------------------------
默认活动是是是
#直接连接到主机网桥的虚拟机
cat/etc/libvirt/qemu/MY_-VM
...
...
#这可能是你的问题
sysctl net.ipv4.ip_转发
net.ipv4.ip_forward=1
我知道
ip_forward
设置为
TRUE
并不是最好的解决方案,但您可以用它来验证假设,然后再详细说明您的解决方案