Ubuntu 22.04 LTS - QEMU-KVM 和 NetPlan - 具有多个 VLAN 的桥接接口

Ubuntu 22.04 LTS - QEMU-KVM 和 NetPlan - 具有多个 VLAN 的桥接接口

以前,当我想在我的 Raspberry PI 上设置 QEMU-KVM 时,我执行了以下命令,为我的虚拟机设置一个桥接接口和多个网络上的所有其他桥接。但是,升级到 Ubuntu 22.04 LTS 后,它只显示 br0 接口,没有错误。我尝试了多种配置,但没有成功。有什么帮助吗?我开始不知道了……谢谢!

sudo systemctl enable --now libvirtd 

sudo virsh list --all
sudo virsh net-list --all
ip a
sudo virsh net-destroy default
sudo virsh net-undefine default
ip a
sudo rm -R /etc/netplan/*
sudo vi /etc/netplan/00-netcfg.yaml

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth0:
      dhcp4: false
      dhcp6: false
      optional: true
  vlans:
    # XXX (VLAN ID: 10)
    br0.10:
      link: br0
      id: 10
    # XXX (VLAN ID: 20)
    br0.20:
      link: br0
      id: 20
    # XXX (VLAN ID: 30)
    br0.30:
      link: br0
      id: 30
    # XXX (VLAN ID: 40)
    br0.40:
      link: br0
      id: 40
    # XXX (VLAN ID: 50)
    br0.50:
      link: br0
      id: 50
    # XXX (VLAN ID: 60)
    br0.60:
      link: br0
      id: 60
  bridges:
    br0:
      interfaces:
        - eth0
      dhcp4: true
      dhcp6: true
    # XXX (VLAN ID: 10)
    br10:
      interfaces:
        - br0.10
      dhcp4: true
      dhcp6: true
    # XXX (VLAN ID: 20)
    br20:
      interfaces:
        - br0.20
      dhcp4: true
      dhcp6: true
    # XXX (VLAN ID: 30)
    br30:
      interfaces:
        - br0.30
      dhcp4: true
      dhcp6: true
    # XXX (VLAN ID: 40)
    br40:
      interfaces:
        - br0.40
      dhcp4: true
      dhcp6: true
    # XXX (VLAN ID: 50)
    br50:
      interfaces:
        - br0.50
      dhcp4: true
      dhcp6: true
    # XXX (VLAN ID: 60)
    br60:
      interfaces:
        - br0.60
      dhcp4: true
      dhcp6: true

sudo netplan generate
sudo netplan apply

sudo systemctl enable NetworkManager.service
sudo systemctl restart NetworkManager.service
ip a
sudo vi host-bridge.xml
<network>
    <name>host-bridge</name>
    <bridge name='br0'/>
    <forward mode="bridge"/>
</network>

sudo virsh net-define host-bridge.xml
sudo virsh net-start host-bridge
sudo virsh net-autostart host-bridge
sudo virsh net-list --all

相关内容