A network bridge connects more network segments. A software bridge behaves like a virtual network switch to which any physical or virtual devices can be connected.
brctl addbr br0
Check the bridge status:
brctl show | grep br0
br0 8000.000000000000 no
brctl addif br0 enp9s0
Configuration for enp9s0 (/etc/sysconfig/network-scripts/ifcfg-enp9s0):
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
NAME=enp9s0
ONBOOT=yes
DEVICE=enp9s0
BRIDGE=br0
Configuration for br0 (/etc/sysconfig/network-scripts/ifcfg-br0):
DEVICE="br0"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=static
IPADDR=192.168.15.15
NETMASK=255.255.255.240
GATEWAY=192.168.0.4
STP=no
DNS1=4.2.2.2
DNS2=8.8.8.8
DEFROUTE=yes
NAME="br0"
brctl show | grep br0
br0 8000.001c2301fbdc no enp9s0
Additionally you can add gateway in /etc/sysconfig/network:
GATEWAY=192.168.0.4
Related Articles
How We Set Up Our KVM Hypervisor: From Bare Metal to Production-Ready VM Host
Detailed walkthrough of building a dedicated KVM/libvirt hypervisor with XFS tuning, hugepages, 10GbE tuning, and automation.
Installing eve-ng on ubuntu 24.04 LTS
Step-by-step guide to installing EVE-NG on Ubuntu 24.04 LTS bare metal server for running network labs.
Setting default gateway from virsh-net command line
Generally when a network is configured from virsh-define for a particular range say 192.168.4.0 it gateway will be automatically assigned to 192.168.4.1.