Rocky 9 kvm networked bridge interface
Similar to what I did on CentOS 7 all those years ago, I needed to set up a bridge network interface in my current setup on Rocky 9. This design seems to be imperfect, but I guess it will have to do. The problem I have found is that it takes a few minute after boot before it is up, so my nfs server doesn't seem to start. But more on that later.
The main purpose of a bridged network device is so virtual machines will be on the main network, accessible to all systems.
After ensuring the basic network card exists, named enp0s25 on my system, use nmcli to make the new device.
sudo nmcli con add ifname br0 type bridge con-name br0 sudo nmcli con add type bridge-slave ifname enp0s25 master br0 sudo nmcli con modify br0 ipv4.addresses 192.168.1.58/24 ipv4.method manual # this server1 ip address sudo nmcli con modify br0 ipv4.gateway 192.168.1.254 # default gateway of main network sudo nmcli con modify br0 ipv4.dns 192.168.1.10,192.168.1.11 # default dns servers
Configure qemu to allow... whatever this allows. I didn't read it.
sudo tee -a /etc/qemu-kvm/bridge.conf <<EOF allow all EOF
And then take down enp0s25 and up br0.
sudo nmcli con down ep0s25 ; sudo nmcli con up br0 ;
Of course the usual warnings apply about doing this remotely. Yes, I did it remotely (the second time, when my config was actually valid).
It took within 2 minutes to actually bring the network up! So this affects nfs-server on reboot. Still, I will talk about that further down.
I wrote file bridge.xml. Its path is irrelevant because you will input it to virsh.
<network> <name>br0</name> <forward mode="bridge"/> <bridge name="br0"/> </network>
And then load this definition to virsh.
sudo virsh net-define ./bridge.xml sudo virsh net-start br0 sudo virsh net-autostart br0
And then restart libvirtd.
sudo systemctl restart libvirtd
Experiment for nfs-server
Because of the delays (only on my hardware?) for the bridge to come up, nfs-server fails to start. And since I serve /var/lib/libvirt/images to the other virtual machine hosts from this server, that is a huge problem! I currently have an experiment in place, and will need to determine over time if this has solved my problem.
I edited nfs-server:
sudo systemctl edit nfs-server.service [Unit] After=sys-devices-virtual-net-br0.device Requires=sys-devices-virtual-net-br0.device # :wq
Let us see over time if this will help the nfs server come up when the whole system/network is ready.
Auxiliary and raw notes
Reference 1's guide didn't seem to work so well for me. I had to delete all that effort, restore my network card definition entirely, and then try with Reference 2.
The commands that did not work for me:
sudo nmcli con show sudo nmcli con delete enp0s25 sudo nmcli con add type bridge autoconnect yes con-name br0 ifname virbr0 sudo nmcli con modify br0 ipv4.addresses 192.168.1.58/24 ipv4.method manual sudo nmcli con modify br0 ipv4.gateway 192.168.1.254 sudo nmcli con modify br0 ipv4.dns 192.168.1.10,192.168.1.11 sudo nmcli con add type bridge-slave autoconnect yes con-name enp0s25 master br0
I don't feel like learning what I did wrong with that. Reference 2 worked, and I have other problems than comprehending the network card stupidity of RHEL.
References
Weblinks
- Setting Up libvirt on Rocky Linux - Documentation
- Creating a Rocky Linux 9 KVM Networked Bridge Interface – Answertopia
Internal files
- server1a-log.md
Comments