Bridge configuration for KVM Slave¶
Warning: The actions described below are dangerous and can cause loosing of remote access to the server. It is recommended to have direct access to the server in order to revert the changes back in case of emergency.
If the server is in OVH infrastructure, additional configuration steps are required MAC assigning per IP Address
The instruction vary for different OSes. The instructions for the following OSes can be found in this document.
CentOS 7, CentOS 8 Stream, AlmaLinux 8:¶
1. Connect to the slave KVM node via SSH
2. Disable Network Manager as it may interfere with the bridge.
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
systemctl enable network.service
systemctl start network.service
/etc/sysconfig/network-scripts/ifcfg-eth0
and verify that
it is disabled there as well
NM_CONTROLLED=no
/etc/sysconfig/network-scripts/ifcfg-eth0
before bridge
interface is configured
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
NM_CONTROLLED=no
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
UUID="8d6f722c-b945-4083-b50e-9661bf62ae5f"
DEVICE="eth0"
ONBOOT="yes"
IPADDR="203.0.113.2"
GATEWAY="203.0.113.1"
NETMASK="255.255.0.0"
DNS1="8.8.8.8"
IPV6_PRIVACY="no"
# yum install -y bridge-utils
6. Create a copy of the network interface to make changes revertible:
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.orig
Note: It is recommended move non-used configuration files out of the network-scripts/ sub-directory. Be aware that configuration files that starts from ifcfg-* files will be applied, including ifcfg-eth0.backup file.
7. Create the bridge file:
vi /etc/sysconfig/network-scripts/ifcfg-br0
8. Copy network configuration settings from ifcfg-eth0 to ifcfg-br0 file to make it look like below:
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes
NM_CONTROLLED=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPADDR=203.0.113.2
NETMASK=255.255.0.0
GATEWAY=203.0.113.1
/etc/sysconfig/network-scripts/ifcfg-eth0
as below:
NAME=eth0
DEVICE=eth
ONBOOT=yes
NM_CONTROLLED=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
BRIDGE=br0
Warning: All parameters should be written with capitalized characters, e.g. BRIDGE=br0 and NOT Bridge=br0
Warning: In case there is a /etc/sysconfig/network-scripts/route-eth0 file (some Hetzner installation has them), the file should be renamed to /etc/sysconfig/network-scripts/route-br0 accordingly.
10. Restart the network service to apply the changes:
service network restart
11. Check that physical interface eth0 is linked to bridged interface br0
brctl show
bridge name bridge id STP enabled interfaces
br0 8000.001c42717243 no eth0
AlmaLinux 9:¶
-
Connect to the KVM node via SSH.
-
Install bridge-utils package:
dnf install -y bridge-utils
-
RHEL 9 uses NetworkManager configuration files, however, the network scripts files can be still recognized. Create the network configuration file
/etc/sysconfig/network-scripts/ifcfg-eth0
with the following content:BOOTPROTO=static DEFROUTE=yes DEVICE=eth0 TYPE=Ethernet BRIDGE=br0
-
Create the bridge file
/etc/sysconfig/network-scripts/ifcfg-br0
with the following content replacing the IPs with the actual ones:BOOTPROTO=static DEFROUTE=yes DEVICE=br0 ONBOOT=yes TYPE=Bridge GATEWAY=203.0.113.1 IPADDR=203.0.113.2 NETMASK=255.255.0.0
All parameters should be written with capitalized characters, e.g. BRIDGE=br0 and NOT Bridge=br0
Warning: In case there is a
/etc/sysconfig/network-scripts/route-eth0
file (some Hetzner installation has them), the file should be renamed to/etc/sysconfig/network-scripts/route-br0
accordingly. -
Add network interface to the bridge:
brctl addif br0 eth0
-
Disable the
eth0
interface:nmcli connection down eth0
-
NetworkManager can bound the default route to the
eth0
interface which leads to network loss. To avoid such behavior, modify the file/etc/NetworkManager/system-connections/ens3.nmconnection
and add the following line to the[ipv4]
section:ignore-auto-routes=true
-
Restart the NetworkManager to apply the changes:
systemctl restart NetworkManager
-
Check that physical interface
eth0
is linked to bridged interface:brctl show bridge name bridge id STP enabled interfaces br0 8000.001c42717243 no eth0
If there are any errors while configuring bridge check for known
issues on our Support Portal,
like below:
Bridge interface does not work on the fresh
install
During configuration of bridge interface network fails to restart:
bridge support not available: brctl not
found