3

I am attempting to add a vm to a vlan which I've created via a bridge. I have a server with 4 NIC's. 2 (eno1 and eno2) are 1Gig management NIC's and the other 2 (enp1s0f0 and enp1s0f1) are 10Gig forwarding NIC's. Here is my network config via .yaml in netplan:

network:
    version: 2
    renderer: networkd
    ethernets:
        eno1: {}
        eno2: {}
        enp1s0f0: {}
        enp1s0f1: {}

    bonds:
        bond_10G:
            interfaces:
            - enp1s0f0
            - enp1s0f1
            parameters:
                mode: balance-rr
        bond_mgmt:
            addresses:
            - 192.168.21.228/24
            gateway4: 192.168.21.1
            interfaces:
            - eno1
            - eno2
            nameservers:
                addresses:
                - 192.168.91.5
                - 192.168.91.6
                search:
                - blah.net
            parameters:
                mode: active-backup
    vlans:
        vlan66:
            dhcp4: no
            dhcp6: no
            accept-ra: no
            id: 66
            link: bond_10G
        vlan69:
            dhcp4: no
            dhcp6: no
            accept-ra: no
            id: 69
            link: bond_10G
        vlan2232:
            dhcp4: no
            dhcp6: no
            accept-ra: no
            id: 2232
            link: bond_10G

    bridges:
        br66:
            dhcp4: no
            dhcp6: no
            interfaces: [ vlan66 ]
        br69:
            dhcp4: no
            dhcp6: no
            interfaces: [ vlan69 ]
        br2232:
            dhcp4: no
            dhcp6: no
            interfaces: [ vlan2232 ]

I can see them all when I do a brctl show:

$ brctl show
bridge name     bridge id               STP enabled     interfaces
br2232          8000.9e3e2f786260       no              vlan2232
br66            8000.16545d040c3a       no              vlan66
br69            8000.92c5912a358b       no              vlan69
virbr0          8000.525400e3bdfa       yes             virbr0-nic

When I log into this QEMU/KVM via virt-manager, I only get the virbr0 option and the other bridges are not listed as options to add them. Is there a way to do this via virsh or am I simply doing it wrong in virt-manager?

I also tried to add it via virt-install but it didn't drop into the correct vlan:

sudo virt-install \
--name deb9-vm \
--ram 2048 \
--vcpus 2 \
--disk path=/var/lib/libvirt/images/deb9-vm.qcow2,size=20 \
--os-type linux \
--os-variant debian9 \
--network bridge=br66 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.debian.org/debian/dists/stretch/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'

I guess my question is how do I get the other bridges to show up as options for a vm?

1

libvirt (and thereby virt-manager, virt-install, ...) do not probe/know the actual bridges on the system. You have already defined your vlans and bridges via netplan, which is great and the correct step #1.

By default there only is the default network which is a NAT based local bridge, you need to define a network. In that you control what bridges, forwarding modes and so on are used - and if libvirt is supposed to spawn e.g. dhcp on it (like it would do on the local default bridge).

There is the great resource of netplan examples which are extended still as yet undocumented cases are found. But your case is rather common and in there, it also has a minimal snippet of that libvirt network xml like:

<network>
  <name>vlan66</name>
  <bridge name='br66'/>
  <forward mode="bridge"/>
</network>

Using the above and adapting it to your needs you can then virsh net-define <xmlfilename> which will make libvirt know about the network. You then can see them in virsh net-list but in virt-manager and the other tools.

  • This is exactly what I needed. Thank you. – fencepencil Oct 23 '19 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.