My problem is basically that, when trying to use a bridge on a vlan interface, I don't have network to my VM, and I'm not sure what I'm missing.
I have tried the setup detailed in the examples. As well as numerous other guides. This is my current netplan
.yaml (though I've tried various combinations of defining
nameservers for the vlan or the bridge with no luck):
network: version: 2 renderer: networkd ethernets: eno1: dhcp4: true eno2: dhcp4: true bridges: br0: dhcp4: true interfaces: [ vlan15 ] parameters: forward-delay: 0 stp: true vlans: vlan15: id: 15 link: eno1
I'd like to keep
eno2 untouched, so I always have a fallback (no monitor attached). In my DHCP server, I have set eno1 = 192.168.0.100, and eno2 = 192.168.0.101.
My LAN in the router is set to 188.8.131.52/22 (I was trying to through VMs in the 192.168.1.x range, but not essential).
I have set up the bridge, and activated it:
~$ brctl show bridge name bridge id STP enabled interfaces br0 8000.00215ec64304 yes vlan15 vnet0
(I'm almost certain that the
vnet0 wasn't associated until I booted the VM)
~$ virsh net-list --all Name State Autostart Persistent -------------------------------------------- br0 active yes yes default active yes yes
ip a shows both
vlan15 linked to the MAC of
eno1. In the .xml file for the VM (
/etc/libvirt/qemu/hassos.xml), it shows under "interface":
<interface type='bridge'> <mac address='52:54:00:26:69:40'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </interface>
I initially set this up with
br0 being linked directly to
eno1, so I did the
virt-install before I started to create vlan, in case that matters. But I have rebooted the VM whenever i do
sudo netplan apply.
The closest I could get (which is not really close, just something happened) was that when I defined a
addresses: 192.168.1.115 on the
br0, I could access something on the server using this address, and the corresponding port. Just not the VM (but a "clone" running in docker, directly on the server). In that case it seems like
br0 was then used for anything on the server?
I'm using Ubuntu Server LTS 20.04.
In case this matters, I have (according to other advise) disabled netfilter for bridges as described e.g. here.
EDIT: I set up the bridge for libvirt by creating an br0.xml file:
<network> <name>br0</name> <forward mode="bridge"/> <bridge name="br0"/> </network>
And added it with:
virsh net-define br0.xml virsh net-start br0 virst net-autostart br0
I've also tried more complex .xml files such as
<network> <name>br1</name> <forward mode='nat'> <nat> <port start='1024' end='65535'/> </nat> </forward> <bridge name='br1' stp='on' delay='0'/> <ip address='192.168.1.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.1.101' end='192.168.1.150'/> </dhcp> </ip> </network>
And with the 192.168.1.X addresses, I an get it to assign in IP from within libvirt, but I can't get access externally. If I instead use a 192.168.0.X address, I get erros when trying to start it:
error: Failed to start network br1 error: internal error: Network is already in use by interface eno2
This is regardless of setting an 192.168.0.X IP within or outside DHCP pool, and regardless of setting 192.168.1.X IP as a DHCP assignment or not.