How to configure bridge interface for KVM slave node?

Have more questions? Submit a request

Applicable to:

  • SolusVM

Question

How to configure bridge interface for KVM slave node?

Answer

The article describes how to set up a dedicated network bridge for Linux KVM virtualization. It presumes the network interface is eth0 and the bridge will be called br0.

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.

  1. Connect to the slave KVM node via SSH
  2. Bridging requires the bridge-utils package to be installed on the server. To check if it's installed, do the following:

    # rpm -q bridge-utils

    If there is an output in the command above - it's installed, if not, it needs installing:

    # yum install bridge-utils

  3. The example of the network configuration file is below:

    CONFIG_TEXT: TYPE="Ethernet"
    PROXY_METHOD="none"
    BROWSER_ONLY="no"
    BOOTPROTO="none"
    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"

  4. Create a copy of the network interface:

    # cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.orig

    Warning: 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.

  5. Create the bridge file:

    # nano -w /etc/sysconfig/network-scripts/ifcfg-br0

  6. Copy network configuration settings from ifcfg-eth0 to ifcfg-br0 file to make it look like below:

    CONFIG_TEXT: DEVICE=br0
    TYPE=Bridge
    BOOTPROTO=static
    ONBOOT=yes
    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"

    Note: placeholder values for IPADDR, NETMASK,GATEWAY should be replaced with the actual values

  7. Edit the ifcfg-eth0 as below:

    CONFIG_TEXT: NAME=eth0
    DEVICE=eth0
    ONBOOT=yes
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    BRIDGE=br0

    Warning: All parameters should be written with capitalized characters, e.g. BRIDGE=br0 and NOT Bridge=br0

  8. Restart the network service to apply the changes:

    # service network restart

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.

Articles in this section

Was this article helpful?
0 out of 0 found this helpful
Share

Comments

0 comments

Please sign in to leave a comment.