Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: virbr0 has no master interfaces (Read 3801 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

virbr0 has no master interfaces

Hi there, firstly apologies as I don't know much about networking. I've tried to piece together my problems through reading various articles online but haven't been able to find a solution.

I'm using virt-manager with qemu/kvm for virtual machines. To provide my VMs with internet access, I created a bridge as specified here. However, my VMs are unable to access the internet.

I think the issue is that there's no virbr0-nic interface that virbr0 is bound to.

Output of `ip link show type bridge`:

Code: [Select]
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc htb state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:0a:cd:21 brd ff:ff:ff:ff:ff:ff

Output of `ip link show master virbr0` is empty.

Output of `ip link` is

Code: [Select]
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether e0:d5:5e:23:27:82 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc htb state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:0a:cd:21 brd ff:ff:ff:ff:ff:ff

I've tried binding virbr0 to eth0 but that makes my internet go down outside of VMs. As I understand it binding a bridge to an interface means that the interface can't be used outside of the bridge?

My understanding is that virbr0-nic is supposed to be automatically created, made the master of virbr0, and is meant to allow you to access your physical network card through it. But virbr0-nic seems to not be getting created.

How do I A. create it, and B. make it automatically create itself upon startup? Thanks.

Edit: If relevant, I am using runit


Re: virbr0 has no master interfaces

Reply #2
You will need to install and start the services virtlogd and librvirtd; that will do what you need.
This page might get you started: https://wiki.archlinux.org/title/Virt-manager

artist
I have both services installed and running already. Using virt-manager with KVM/QEMU  works except for internet access, but I can otherwise use my VMs as normal.

Re: virbr0 has no master interfaces

Reply #3
Pls provide all related details so the issue can be analyzed.

artist

Re: virbr0 has no master interfaces

Reply #4
Pls provide all related details so the issue can be analyzed.

artist
I provided the details I thought were relevant in the OP. I think this is a case of me not knowing enough to know what info to share. XML for my default virtual network is

Code: [Select]
<network connections="1">
  <name>default</name>
  <uuid>9a05da11-e96b-47f3-8253-a3a482e445f5</uuid>
  <forward mode="nat">
    <nat>
      <port start="1024" end="65535"/>
    </nat>
  </forward>
  <bridge name="virbr0" stp="on" delay="0"/>
  <mac address="52:54:00:0a:cd:21"/>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
    </dhcp>
  </ip>
</network>
as specified in the thing I linked to in the OP which I just copied.

I've found a stack exchange on how to create such an interface but from what I've read, this virbr0-nic interface is supposed to get auto-created, and I don't want to have to recreate the interface manually every time I reboot or add a janky startup script to create it. It sounds like I've either misconfigured libvirt or there's a bug.

Re: virbr0 has no master interfaces

Reply #5
What init do you use and what method of managing the network ?

I could be wrong and there's some magic where virt-manager / libvirt does all this for you but the way I do it is:
Create the bridge with the network management tool. Which for me is netifrc and comprises of
Code: [Select]
config_eth0="null"
config_br0="192.168.1.111/24"
bridge_br0="eth0"
routes_br0="default via 192.168.1.1"
in /etc/conf.d/net

The same setup with 'ip' commands
Code: [Select]
ip link set eth0 down
ip link add name br0 type bridge
ip link set eth0 master br0
ip link set eth0 up
ip addr add 192.168.1.111/24 dev br0
ip link set br0 up
ip route add default via 192.168.1.1 dev br0

Then I tell virt-manager to use br0

Edit:
192.168.1.1 is my router. Change to your routers ip address if it differs.

Re: virbr0 has no master interfaces

Reply #6
What init do you use and what method of managing the network ?
runit with NetworkManager.

Code: [Select]
ip link set eth0 down
ip link add name br0 type bridge
ip link set eth0 master br0
ip link set eth0 up
ip addr add 192.168.1.111/24 dev br0
ip link set br0 up
ip route add default via 192.168.1.1 dev br0

If I make eth0 the master of virbr0, that prevents me from using eth0 except through virbr0, meaning that e.g. if I launch a browser on the host machine I can't browse the internet.

Having just tried again just now, following the same commands as you (except omitting `ip link add name br0 type bridge` and using `virbr0` instead of `br0` since `virbr0` already exists, and using the IP address of my router and not yours), on the host machine I seem to be able to ping external IP addresses but not domains, ie DNS resolution doesn't work. In VMs I can access the internet just fine, both IP addresses and domains.

Re: virbr0 has no master interfaces

Reply #7
If I make eth0 the master of virbr0, that prevents me from using eth0 except through virbr0
That's how it works except vibr0 is the master.
Quote
on the host machine I seem to be able to ping external IP addresses but not domains, ie DNS resolution doesn't work. In VMs I can access the internet just fine, both IP addresses and domains.
You just needed to temporarily correct the DNS on the host then.
But the  ip commands were just a proof of concept.
Use networkmanager to create a bridge (with eth0 bound to it). Use that bridge in virt-manager.

Re: virbr0 has no master interfaces

Reply #8
You just needed to temporarily correct the DNS on the host then.
Sorry, but how do I do this? I'm using one of Mullvad's DNS resolvers which I've set on my router, so I'm getting DNS resolution from my router.

Re: virbr0 has no master interfaces

Reply #9
I've tried

Code: [Select]
nmcli con add type bridge-slave ifname eth0 master virbr0

(which I think is the reverse of the master/slave relationship from above? edit: nvm, i think i got things mixed up in the op, it's the same as the above) which seems to not affect my internet connectivity on the host machine, but in VMs connection seems to be unreliable. I did some testing in a Fedora VM with KDE, and browsing websites with Librewolf seems to not work, whilst I am able to ping most IP addresses and domains (so DNS resolution is working to some degree). KDE reports the connection as having "limited connectivity". Am I missing something?

Re: virbr0 has no master interfaces

Reply #10
Ok so what I was missing was

Code: [Select]
nmcli connection modify virbr0 connection.autoconnect-slaves 1
nmcli connection up virbr0

which gets me the same results as before, except on the host I also can't ping IP addresses and have no internet connectivity at all.

Code: [Select]
$ nmcli dev show

GENERAL.DEVICE:                         eth0
GENERAL.TYPE:                           ethernet
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     bridge-slave-eth0
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/3
WIRED-PROPERTIES.CARRIER:               on
IP4.GATEWAY:                            --
IP6.GATEWAY:                            --

GENERAL.DEVICE:                         lo
GENERAL.TYPE:                           loopback
GENERAL.HWADDR:                         00:00:00:00:00:00
GENERAL.MTU:                            65536
GENERAL.STATE:                          100 (connected (externally))
GENERAL.CONNECTION:                     lo
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
IP4.ADDRESS[1]:                         127.0.0.1/8
IP4.GATEWAY:                            --
IP6.ADDRESS[1]:                         ::1/128
IP6.GATEWAY:                            --

GENERAL.DEVICE:                         virbr0
GENERAL.TYPE:                           bridge
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected (externally))
GENERAL.CONNECTION:                     virbr0
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/2
IP4.ADDRESS[1]:                         192.168.122.1/24
IP4.GATEWAY:                            --
IP4.ROUTE[1]:                           dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0
IP6.GATEWAY:                            --

virbr0.nmconnection:

Code: [Select]
[connection]
id=virbr0
uuid=9ee909ac-8ec0-4fcc-ab08-a79f21274c8f
type=bridge
autoconnect=false
autoconnect-ports=0
interface-name=virbr0
timestamp=1750955422

[ethernet]

[bridge]
forward-delay=2

[ipv4]
address1=192.168.122.1/24
method=manual

[ipv6]
addr-gen-mode=default
method=disabled

[proxy]

bridge-slave-eth0.nmconnection, generated by the command in my previous reply:

Code: [Select]
[connection]
id=bridge-slave-eth0
uuid=6b0e9285-6bee-423a-b45c-04b2e8f42f05
type=ethernet
controller=virbr0
interface-name=eth0
port-type=bridge

[ethernet]

[bridge-port]

Re: virbr0 has no master interfaces

Reply #11
Sorry, but how do I do this? I'm using one of Mullvad's DNS resolvers which I've set on my router, so I'm getting DNS resolution from my router.
Would have done. You could have just stuck 'nameserver 1.1.1.1' in /etc/resolv.conf  and commented out the other entry.
Or backed up the file etc. But I fear this is adding to the confusion which I'm partly responsible for (more below).
I've tried

Code: [Select]
nmcli con add type bridge-slave ifname eth0 master virbr0

(which I think is the reverse of the master/slave relationship from above?) which seems to not affect my internet connectivity on the host machine, but in VMs connection seems to be unreliable. I did some testing in a Fedora VM with KDE, and browsing websites with Librewolf seems to not work, whilst I am able to ping most IP addresses and domains (so DNS resolution is working to some degree). KDE reports the connection as having "limited connectivity". Am I missing something?
When I read your initial post you were talking about a bridge. I think you did as well?
What I have described configuring is what I consider a software network bridge.

What I've since learnt about virbr0 is it is sort of a bridge, a virtual network bridge, but it provides NAT not a connection to your physical network i.e.
If you use NAT (virb0) , and it's working, your vm guests would be able to connect to the internet, and connect to each other, but not host to guest or guest to host because they'd be on separate networks.

If NAT is what you actually want then disregard anything I've said and figure out why NAT is not working, which I probably can't help with as I have rarely used it.

If a bridge is what you want then I'd suggest deleting virbr0 and going with br0 . While the name may not matter there's the chance libvirt is interfering with it?

imho a standard bridge is better as you set one up and then it's always there to be used by any vm's you spin up.
I'd only use NAT if i specifically want the vm's on a separate network.

edit: I haven't addressed your most recent post in this one.



Re: virbr0 has no master interfaces

Reply #12
which gets me the same results as before, except on the host I also can't ping IP addresses and have no internet connectivity at all.
Without being sat at your computer it's hard to say what's going on.

But if I was you I'd try and start again from as close to a blank slate as possible.

Get all references to virbr0 gone from your system network setup, and the guest vm's network setup then create the br0 bridge and set up  the guest to use it.

To me networkmanager just seems to add complexity rather than making it all easier?
But unfortunately netifrc is unique to openrc so you are probably best sticking with networkmanager.

Re: virbr0 has no master interfaces

Reply #13
Thanks for your help, and apologies for any frustration arising out of my ignorance.

Yes, I guess the problem I am ultimately trying to solve is that I want QEMU/KVM VMs managed by virt-manager to have internet access through my regular ethernet connection. I would like to be able to ssh into my VMs from the host, and still have internet access as usual from the host. I suppose VMs being able to connect to each other might be useful but I've never needed that functionality.

I was under the impression that virbr0, which is set up by libvirt, is how this is done. If there is a better way to achieve this, or if this is the wrong way entirely to achieve this, I'm of course open to other options. Just from reading things online the only thing that seemed out of place about my setup is that `ip link show master virbr0` didn't output anything, when normally there is a slave (?) interface called virbr0-nic generated by libvirt, based on the virt-manager networking guides I read online. So I assumed that my problem lay in whatever issue was preventing that interface from being created. But if the issue is that I'm barking up the wrong tree entirely, do let me know.

Looking in virt-manager, my "Network source" for all my VMs is set to "Virtual network 'default': NAT". So it seems I am using the NAT created by libvirt. It sounds like based on what you've said, I should try creating a completely different bridge to connect to and switch "Network source" in virt-manager to "Bridge device" and select the bridge I created?

Would I still have the aforementioned issue though, of not having internet connectivity on the host after creating this bridge and getting it working? As it seems when I've been setting eth0 as a slave of a bridge, that makes eth0 unusable.

As for using something other than NM, I'm not wholly opposed to it but I use NM because it "just works" especially with WiFi (I don't use WiFi on this device but I do for laptops) and generally things seem to be very easy with NM. VMs are not crucial to my workflow but I like having them to test things out without affecting my computer. I've not used anything else to manage my networking so I'd have to learn whatever other software I switch to if I were to switch.

Re: virbr0 has no master interfaces

Reply #14
No worries.

In the setup link you posted was this:
Code: [Select]
<network>
  <name>default</name>
  <uuid>9a05da11-e96b-47f3-8253-a3a482e445f5</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:0a:cd:21'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

That is NAT.
If you want to ssh to and from the hosts and the guest(s) you want a proper bridge as I've described.
Libvirt cannot setup a proper bridge  on it own. Onnly the NAT type.