Linux KVM/QEMU Guest 桥接网络问题

Linux KVM/QEMU Guest 桥接网络问题

我有一个 KVM 客户机,该客户机带有一个适配器,该适配器连接到桥接接口,该接口有一个物理网卡。物理网卡的网络在 192.168.1.0/24 范围内具有 DHCP。

我的客户没有获得 DHCP 地址,并且静态分配 IP 导致没有第 2 层连接。

我的客户端确实获得了 192.168.2.0/24 网络,但我认为这是因为 KVM。除了使用网桥在物理适配器和客户端之间传递第 2 层之外,我不希望主机参与网络。

我的设置:

[root@host ~]# brctl show
br.4094     8000.406231001c29   yes     enp0s20u8
                                        enp1s0.4094
                                        vnet0

[root@host ~]# ip link list
~
4: enp0s20u8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br.4094 state UP mode DEFAULT group default qlen 1000
    link/ether a2:72:9f:e6:43:96 brd ff:ff:ff:ff:ff:ff
~
6: br.4094: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 40:62:31:00:1c:29 brd ff:ff:ff:ff:ff:ff
~
40: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br.4094 state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether fe:54:00:3f:95:26 brd ff:ff:ff:ff:ff:ff

[root@host ~]# ip addr list
~
4: enp0s20u8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br.4094 state UP group default qlen 1000
    link/ether a2:72:9f:e6:43:96 brd ff:ff:ff:ff:ff:ff
~
6: br.4094: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 40:62:31:00:1c:29 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.155/24 brd 192.168.1.255 scope global dynamic br.4094
       valid_lft 55343sec preferred_lft 55343sec
    inet6 2600:380:772e:af16:4262:31ff:fe00:1c29/64 scope global mngtmpaddr dynamic 
       valid_lft 85896sec preferred_lft 13896sec
    inet6 fe80::4262:31ff:fe00:1c29/64 scope link 
       valid_lft forever preferred_lft forever
~
13: enp1s0.4094@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br.4094 state UP group default qlen 1000
    link/ether 40:62:31:00:1c:29 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::4262:31ff:fe00:1c29/64 scope link 
    valid_lft forever preferred_lft forever
~
40: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br.4094 state UNKNOWN group default qlen 1000
link/ether fe:54:00:3f:95:26 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe3f:9526/64 scope link 
   valid_lft forever preferred_lft forever

我的虚拟机配置片段:

<interface type='bridge'>
  <mac address='52:54:00:3f:95:26'/>
  <source bridge='br.4094'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

相关内容