0

I have set the virtual guest to use the virtual bridge interface (virbro) but there is no network connectivity. The host is running Alma 8.6.

Here's a list of current network connections on the host system:

# nmcli con show
NAME    UUID                                  TYPE      DEVICE
enp3s0  e41b3cfe-222d-49c1-8636-6457b0b71ade  ethernet  enp3s0
virbr0  970bbdf5-05de-4906-98c8-11d867dcf143  bridge    virbr0
vnet0   6aa2549a-8770-40d4-8545-60387c365436  tun       vnet0

Here the devices that are currently configured on the system:

# nmcli device show
GENERAL.DEVICE:                         enp3s0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         B8:AE:ED:D9:02:10
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     enp3s0
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         172.29.225.10/24
IP4.GATEWAY:                            172.29.225.254
IP4.ROUTE[1]:                           dst = 172.29.225.0/24, nh = 0.0.0.0, mt = 100
IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 172.29.225.254, mt = 100
IP4.DNS[1]:                             172.29.240.3
IP4.DNS[2]:                             172.29.240.1
IP4.DNS[3]:                             172.29.240.2
IP6.ADDRESS[1]:                         fe80::baae:edff:fed9:210/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 1024

GENERAL.DEVICE:                         virbr0
GENERAL.TYPE:                           bridge
GENERAL.HWADDR:                         FE:54:00:42:C4:1B
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
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 = 425
IP6.ADDRESS[1]:                         fe80::fc54:ff:fe42:c41b/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 256

GENERAL.DEVICE:                         vnet0
GENERAL.TYPE:                           tun
GENERAL.HWADDR:                         FE:54:00:42:C4:1B
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected (externally))
GENERAL.CONNECTION:                     vnet0
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/3
IP4.GATEWAY:                            --
IP6.ADDRESS[1]:                         fe80::fc54:ff:fe42:c41b/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 256

GENERAL.DEVICE:                         lo
GENERAL.TYPE:                           loopback
GENERAL.HWADDR:                         00:00:00:00:00:00
GENERAL.MTU:                            65536
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.ADDRESS[1]:                         127.0.0.1/8
IP4.GATEWAY:                            --
IP6.ADDRESS[1]:                         ::1/128
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = ::1/128, nh = ::, mt = 256

brctl shows a bridge

# brctl show
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.fe540042c41b       yes             vnet0

When listing the virtual networks, the default is inactive:

# virsh net-list --all
 Name      State    Autostart   Persistent
--------------------------------------------
 default   active   yes         yes

Here's the IP configuration on the guest

$ ifconfig
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.29.225.11  netmask 255.255.255.0  broadcast 172.29.225.255
        inet6 fe80::5054:ff:fe42:c41b  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:42:c4:1b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 117  bytes 8644 (8.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I can't ping the host or gateway.

1 Answer 1

2

By the IP address you've chosen for the guest, it seems you are looking for a bridged network connectivity solution for your VM.

Since the physical network interface is not joined to the bridge and your system is not configured to route traffic between enp3s0 and virbr0, your VM cannot communicate with the outside world.

Enabling routing would require using a different IP address segment with the VM, or the use of NAT/masquerading on on the host for the VM, and your choice of IP address for the VM implies you might not want that.

(If you are familiar with VMware virtualization, think of bridges as virtual switches.)

You would need to create a new bridge interface on the host, assign the host system's physical enp3s0 interface to that bridge, and move the host's IP configuration from the enp3s0 interface to that bridge interface. Then you could tell KVM to connect the VMs' virtual network interfaces to that bridge too, instead of virbr0.

Having the host's IP address configured on the bridge instead of on the physical interface allows the host to use the same IP address both when communicating with the outside physical network and with the VMs inside the host. When the host's IP address is configured directly on the enp3s0 interface, that IP address is usable with the external physical network only - and it might stop working anyway when the enp3s0 interface is attached to a bridge.

Assuming you don't have any ebtables rules that would block the bridged communication, the VMs would then be able to access the physical network (and also each other and the host).


So the virbr0 is configured with RHEL 8-style defaults: to have VMs in network segment 192.168.122.0/24 and to allow only outgoing network connectivity in NAT mode. Apparently it's not what you want. So the first step is to create a new bridge and have it take control of your physical network interface:

nmcli c add type bridge con-name bridge0 ifname bridge0
nmcli c modify enp3s0 master bridge0  # this will break host's network connectivity!

Then re-apply your host IP configuration to the bridge. I assume you're using static IPs; if you use DHCP, this will need to be modified.

nmcli c mod bridge0 ipv4.addresses 172.29.225.10/24
nmcli c mod bridge0 ipv4.gateway 172.29.225.254
nmcli c mod bridge0 ipv4.dns 172.29.240.3,172.29.240.1,172.29.240.2
nmcli c mod bridge0 ipv4.dns-search domain.example
nmcli c mod bridge0 ipv4.method manual
nmcli c up bridge0        # this should restore host's network connectivity

Now your host's physical network connectivity should work just as before (however you might need to update your firewall rules), but bridge0 also works as an attachment point for VMs that allows both incoming and outgoing connectivity.

Then modify your VM(s) to use bridge0 instead of virbr0:

virt-xml your-VM --edit --network bridge=bridge0
virsh start your-VM

Now brctl should show both the physical enp3s0 and the virtual vnet0 as members of bridge0. Also ip link show master bridge0 should show both enp3s0 and vnet0, and ip link show master virbr0 should show nothing at all.

(vnet0 is the host-visible "back-end" of the VM's enp1s0.)

Your VM should now have full connectivity for both incoming & outgoing connections.

2
  • I'm using Alma 8
    – supmethods
    Commented Jul 12, 2022 at 12:17
  • Please edit your question to add that information in, otherwise it will get lost once the comments expire, and then the question will be less useful for others with similar issues.
    – telcoM
    Commented Jul 12, 2022 at 12:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .