Qemu - enabling "bridge mode" for primary physical interface for VMs

I have a physical host with a single physical network adapter. I want to host several VMs on host. (guest1 - guest4) The guest systems are accessible via 192.168.122.* as is the default with qemu/virsh.
There are 4 IP addresses being routed to the primary interface on host. I can set up an alias for the NIC and "see" these ip addresses.
I understand that it's possible to allow the 4 VM guest systems to each have a "direct" fixed IP address and access the addresses \via the host network adapter, while the host retains its fixed IP.
I've been googling like crazy and there is a lot of stale and conflicting information.
Has anybody here done this successfully?
Host and all guests are running Alma 8.
Thanks.
Ben S

You need to create a bridge on the physical host. For example:
# cat /etc/sysconfig/network-scripts/ifcfg-br0 TYPE=Bridge NAME=br0 DEVICE=br0 IPADDR=<public ip> PREFIX=23 GATEWAY=<gateway> DNS1=10.254.254.251 DNS2=8.8.8.8
While the actual physical interface looks something like this:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # Generated by dracut initrd NAME=eth0 ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=none TYPE=Ethernet DEFROUTE=yes IPV4_FAILURE_FATAL=yes BRIDGE=br0
Then under the devices section in your VM config you might have something like this:
<interface type='bridge'> <mac address='52:54:00:c2:49:bf'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
Does this get you going in the right direction? Now you should be able to bind the IPs directly within each VM as you desire.
On Tue, Dec 7, 2021 at 6:50 PM Lists lists@benjamindsmith.com wrote:
I have a physical host with a single physical network adapter. I want to host several VMs on host. (guest1 - guest4) The guest systems are accessible via 192.168.122.* as is the default with qemu/virsh.
There are 4 IP addresses being routed to the primary interface on host. I can set up an alias for the NIC and "see" these ip addresses.
I understand that it's possible to allow the 4 VM guest systems to each have a "direct" fixed IP address and access the addresses \via the host network adapter, while the host retains its fixed IP.
I've been googling like crazy and there is a lot of stale and conflicting information.
Has anybody here done this successfully?
Host and all guests are running Alma 8.
Thanks.
Ben S_______________________________________________ AlmaLinux Users mailing list -- users@lists.almalinux.org To unsubscribe send an email to users-leave@lists.almalinux.org
participants (2)
-
Jonathan Wright
-
Lists