KVM bridge networking

I am using KVM to run a Windows VM on my Pop!_OS desktop, which works fine with NAT networking. The NAT networking allows Internet access but its not accessible to other hosts on the LAN, including my Truecore NAS. I need bridge networking, so will refer the Jay’s excellent Ubuntu server book that I found has a section on bridge networking…

I think it would be an interesting video topic, adding a KVM VM to a server or desktop and the setup for bridge networking. In fact I will report back here with my findings - the problems I had and solutions I found to it.

If you are using netplan, there should be a setting to create a bridge and set an IP address on it. Then you just bridge the eth0 of the VM in virt-manager to the bridge.

Or you can use the ip commands or nmcli to create a bridge.

I’m pretty interested in what you post about this. I have set up VirtManager on one of my Pop!_OS instance and it wont allow me to use bridged networking. Yet on a second instance of Pop!_OS I can just use bridged networking without any messing around. It just works out of the box. I haven’t taken the time to figure out why, but if you post your findings here I would be more than happy to read it.

Weird. I’m using virt-manager myself, although I’m not using Pop!_OS. I’m also using vlans, so I need to use macvtap to tap into vlan interfaces, but when I didn’t have vlans set up, I was just bridging it to the bridge.

You need to create a bridge, not have any IP address assigned to the main interface, assign the IP on the bridge if you don’t have a second interface, then use bridge interface on the VM.

2022-11-08_01-11-1667862471

And the ip interface should look a little something like this:

1 Like

Yup. VirtManager must have already created the bridge interface. Running ‘ip a’ I found there was already a bridged interface. I just needed to fill in the name when creating a VM. On my other Pop!_OS instance it just fills in automatically. Simple. Thanks for sharing.

1 Like

I am using Pop!_OS 22.04 LTS, so not using netplan (I think).

Pop!_OS uses Network Manager, and I found this page that I think will crack this fort me:

I’ve still not made this work - which is very frustrating. I have used nm-connection-editor on my Pop!_OS desktop to create a bridge, and attached it to the physical network adapter.

Before I do anything with the virtual machine I checked the interfaces on the host with ‘ip a’ and I can see the bridge, but it has no IP. So I think the DHCP address assignment is not working.

Here are my steps in nm-connection editor:

nm1
nm2


nm4

nm6

At this stage ‘ip a’ shows the new bridge but it has no IP address. The Bridge1 IPv4 tab ‘Method’ is set to ‘Automatic (DHCP)’. So I think I misunderstand something. Does anyone spot where I am going wrong?

1 Like

Disable dhcp on wired 1, set it to manual. Enable dhcp on bridge and disable stp on it. Connection name can be bridge1, but make interface name vmbr0 (it’s a standard, might be some built-in kernel stuff to recognize vmbr).

Let me know if it doesn’t work, ip commands should work for sure.

I could not get it to work - tried disabling DHCP, set to manual IP, enabled DHCP on bridge and even disabled spanning tree protocol (STP). I think I fail to grasp the basis of bridges and would love to find a nice description of it.

Jay’s Ubuntu Server book does discuss bridge networking but there is a misalignment with Pop!_OS as the two do not use the same network manager.

However - I have solved my situation of getting a VM to be an equal partner on the local network. I added a second PCI network card, making a note of the interface name (in my case ‘enp4so’) disabled it in the host (Pop!_OS). Then using virt-manager I changed the VM’s NIC to be ‘macvtap’ and entered the device name (‘enp4so’). When the VM started it added a NIC for the new device and got a DHCP address from my pfsense firewall.

Finally I can run my SIP softphone for Windows in my VM (as there is no version for Linux).

1 Like

If it’s just regular SIP, for Linux there is Linphone, which works decently well.

1 Like