I have a virtual bridge br0 created with nmcli, with a physical ethernet interface attached to it
the bridge device is the used with kvn virt-manager virtual machines.
They get a static IP address.
For instance, one VM gets the IP address 192.168.39.11
The host is 192.168.39.10
:
root@black:/etc/NetworkManager/system-connections# nmcli con show
NAME UUID TYPE DEVICE
br0 a4a276d8-cbdb-4119-83f9-4a7403e98adf bridge br0
netplan-eno2 80ab1970-e833-372e-8635-f330b7d9f1f0 ethernet eno2
netplan-eno1 10838d80-caeb-349e-ba73-08ed16d4d666 ethernet eno1
rumahtumi c9c05065-f2f8-48b5-a3bb-b794776a805a wifi wlp9s0
virbr0 d5dcf8cb-80f2-448c-b468-d9b1d4ab2e86 bridge virbr0
bridge-slave-eno2 cf0b153e-8a4f-48e1-9a0b-bdf83e80d6c8 ethernet --
It works well, but traffic between the host and the VM seems to go out to the network and back.
At least, if I do this:
ip route add 192.168.39.11/32 dev br0
and then
ping 192.168.39.11
the average ping time halves.
The same benefit is then seen from the VM back to the host.
but `ip route add ``` ... is not permanent
So I try this:
nmcli connection modify br0 +ipv4.routes 192.168.39.11/32
and then down and up the br0 connection (or reboot).
however, from this point on, the VM has no route to the network, it does not get a DHCP lease.
So the nmcli connection modify
is either wrong, or it works differently to adding the route with ip route add
Update: when I compare a backed-up .nmconnection file to the one modified by the nmcli connection modify...
there are two changes.
One is:
...
[ipv4]
method=auto
route1=192.168.39.11/32
and the other which I ignore is a
timestamp
line in the [connection]
section.
I have removed that and it seems to work now. Although I have to down the original connection for the second ethernet interface, and up the br0
EDIT:
I think my problem is more likely this: when adding a route, nmcli was removing the slave connection and therefore disabling the bridge.