Can't seem to configure a bridge for Windows guest in virt-manager - UPDATE: Trying to use virtio

What I essentially want to do is have the Windows 10 OS guest be visible on my physical network. Based on the various wikis and guides I've read, this means I need a bridge as NAT and User Mode networking will not allow this.

I've configured a bridge using netctl with three devices. enp7s0 (my physical ethernet), br_0 (my bridge) and tap_0 (my tap device for QEMU).

Note: My terminal fonts are currently such that _ are not visible. I will fix that later. Any instance of tap 0 and br 0 are really tap_0 and br_0.

enp7s0's netctl config:

tap_0's netctl config:

br_0's netctl config:

My understanding has been that I would then tell the virtual machine to bind to the tap_0 device, but trying to do that within virt-manager results in the following error:

Setting it to br_0 works but then the guest OS doesn't have an IP address or access to the internet. It just has the usual 169.x.x.x "I can't get an IP address from DHCP" Windows networking.

Here is my list of network devices:

Note that the bridge and my physical ethernet have the same MAC (I blacked them out).

I realize virbr0 and virbr0-nic are created by virtual manager on it's own. Using either of those has the same error as using tap_0.

I am not sure what I should be doing with this. My understanding of bridges is that I should have the two interfaces I want to bridge be listed in BindToInterfaces in the /etc/netctl/br_0 file. I have both my physical nic and the tap device listed there.

I feel like I should be listing tap_0 as the device for my VM to use, but virt-manager wants a bridge. I don't know why. Why it would create virtbr0-nic then ask for a bridge? No clue.

Do I need to add the interfaces I've created in the virt-manager Virtual Network and Network Interfaces under Edit > Connection Details to use them correctly?

What distribution are you using?

When I'm using virt-manager, I always let it manage bridges automatically.

Have a look at the Archwiki page for Libvirt, specifically the part where it talks about network connectivity.

1 Like

Arch is my distro.

Hmm, I had read that bridge-utils was legacy, but that wiki page states to install it for bridged networking.

I will try using virt-manager to manage the bridge then with it's defaults. I had chosen to do that because while researching this on the arch forums, I had found someone who mentioned that they preferred to manage the connections themselves, and I wasn't sure if the default bridges would be recreated by virt-manager after I had deleted them.

But it seems they were recreated. We'll see how that goes.

Yeah, it's a bit finicky on Arch, let me know how it goes.

It's just easier for me to let virt-manager configure everything, but then again, I don't have time to drill down and do everything manually.

1 Like

So, when you say you let it configure everything, did virbr0 show up in this screen?

I got there by going to Edit > Connection Details.

I'd assume, since libvirt is creating these network connections, it would appear in virt-manager, but it's not.

Did you have to manually configure it within virt-manager? And if you did, how did you do that?

I believe I deleted the entry for the default network within virt-manager by deleting both virtbr0 and virtbr0-nic. Even though they are recreated, the entry is no longer there.

This is what it should look like:

Now I guess I'll try and use virsh to manually add it.

In trying to manually add the default virtual network, I am getting the idea that this will use NAT and thereby won't allow my guest OS to connection to the physical network directly.

@SgtAwesomesauce, do you usually leave the guest OS separate?

@Vitalius my bridge interface doesn't show in "network interfaces" or "virtual networks" it only shows in the vm details. You may have create the bridge correctly but I believe you have to start the interface and that may be causing your issue. I remember having a problem like that when I was setting up the bridge. It may be easier to use network manager to create the bridge as well, but you can use "nmcli connection up 'bridge name'" to start the interface if you have network manager that is

1 Like

See, and that's a bigger issue I'm running into.

Do I create the bridge with netctl, brctl, virsh, or what?

If I do stuff with ip link, netctl doesn't update. If I do stuff with netctl, ip link does update.

If I better understood the goal of all this, I might be able to do it myself without following guides, purely based on what I know I need and the manual pages of the commands.

For example, everything requires a device for the VM. i.e. either virbr0-nic (auto-generated by virt-manager) or tap0 (when creating your own bridge), or whatever. But no where is the VM set to actually use that device, AFAICT. In virt-manager, it asks for the bridge name. So what is the purpose in the virtual nic/tap device?

If I try to create a network for virt-manager to use with virsh, I don't have permissions as my user. But the default network already exists for root in that if I do sudo virsh it is listed.

Now that I've moved the default.xml file to my local users .config/libvirt/qemu/networks folder, the default network appears correctly. However, if I try to start it, it complains that my physical NIC is already in use.

I can manually create a bridge between a tap device and my physical NIC, but if I point the VM at that bridge, it will not have an internet connection.

I don't really understand how you are supposed to create the bridge, if I were to use ip link, brctl, and/or netctl. Do I set both the tap device and my physical NIC to UP before I enable the bridge? Or do I leave them down and just enable the bridge?

The former won't let me use the bridge in virt-manager because of an error. The latter won't give me internet connection.

nmcli connection add autoconnect yes con-name br_0 connection.type bridge ifname <interface name>. Trying to work from memory but then run nmcli connection up br_0 and then you should be able to add br_0 to "Bridge name" from your 4th screen shot and it should work.

1 Like

Here's the question though. You mentioned using dnsmasq.

That means NAT, I think, and that means my VM won't be visible to the physical network.

I need it to be visible to access network resources, if possible.

I gave you incorrect reply. follow arch wiki here (i would follow the iproute instructions since like you said brctl is deprecated) then i believe you only need to issue ip link set br_0 up to start the interface close and open virt-manager add the bridge name as in your 4th screen shot and then it should work

1 Like

For some reason, it didn't click for me that ip was part of iproute2. It makes sense why things were getting confused now that I realize I was using multiple packages to try to do the same thing.

I've finally had a chance to try out your instructions. This is what I did:

Default config for me is that upon login I have just my ethernet device as networking. That is: enp7s0. It gets the static IP 10.0.12.121.

I did ip link add name br_0 type bridge followed by ip link set br_0 up. Then I did ip link set enp7s0 master br_0 followed by going to virt-manager and adding a NIC that used br_0.

Not only did my Virtual Machine not have an IP address or access to the physical LAN, but my host PC also lost network connectivity.

I should point out I've set libvirt's modules to load. i.e. this:

lsmod | grep virt
virtio_pci 24576 0
virtio_net 32768 0
virtio_blk 20480 0
virtio_ring 20480 3 virtio_blk,virtio_net,virtio_pci
virtio 16384 3 virtio_blk,virtio_net,virtio_pci

And I installed the virtio drivers into my Windows guest OS during installation. I'm not sure if that changes things?

I had read that virt improved performance, so I figured "whynot?"

As an update to this, I am able to get what I want within the VM, but it creates a new problem.

What I'm doing now is pretty simple:

  • I boot into Arch and login.
  • I set my main physical NIC to UP using sudo ip link set eth0 up.
  • I give it an IP address. In this case it's sudo ip addr add 10.0.1.50/22 dev eth0.
  • I set the default route as the following: sudo ip route add default via 10.0.1.5 as that's my gateway.

Now that gives my system Internet. Netctl was handling that just fine though. So me doing that manually (for now) is necessary because I can only get the VM to have internet using iproute2. For the VM, I do the following:

  • I create a network bridge to my main physical NIC eth0 here: sudo ip link add name br_0 type bridge.
  • I set that bridge to up with sudo ip link set br_0 up.
  • I set eth0's master as br_0 with sudo ip link set eth0 master br_0.

And that's it. When I start my VM in virt-manager, the tap0 device is created automatically and it's master becomes br_0. The VM gets direct access to the network without the host using routing or NAT to accomplish this.

However, my issue is now that once I've done that, my host loses internet connectivity.

As in, I can't access the network as the host, but I can as the VM. I don't know what virt-manager does in creating the tap0 device, but it prevents Destinations from being Reachable. My VM has the IP address 10.0.1.60, so it's not that, I think.

"Why don't you use Netctl?"

Because copying the example ethernet-static and bridge config files from /etc/netctl/examples and configuring them to do the same setup as I did above with iproute2 doesn't give me the same results. iproute2 is the only way I've been able to get the VM direct access to the network.