Page tree
Skip to end of metadata
Go to start of metadata

This chapter explains how to set up a dedicated network bridge for Linux KVM virtualization. The chapter also presumes the network interface is eth0 and the bridge will be called br0.

Please note that the document is just for reference, the network configuration on your server would be different than the documentation. All you have to do is refer the document and configure the bridge as per your server network configuration. You don't have to copy & paste everything from the document.

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 you get an output - it's installed, if not, it needs installing:

yum install bridge-utils

Before setting up your bridge, the contents of /etc/sysconfig/network-scripts/ifcfg-eth0 will look like the following:

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="enp1s0f0"
ONBOOT="yes"
IPADDR="182.112.25.4"
PREFIX="23"
GATEWAY="182.112.24.1"
DNS1="8.8.8.8"
IPV6_PRIVACY="no"

To back up your current ifcfg-eth0 before modification:

1. Run the following command:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/backup-ifcfg-eth0

2.Create the bridge file:

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

3. Copy parts of ifcfg-eth0 to it and edit the config file as per the example below obviously replacing the parts unique to your server:

TYPE=Bridge
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=bridge0
DEVICE=br0
ONBOOT=yes
IPADDR=182.112.24.4
PREFIX=23
GATEWAY=182.112.24.1
DNS1=8.8.8.8
DNS2=8.8.4.4
IPV6_PRIVACY=no
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
HWADDR=ac:1f:6b:94:55:22

4. Save that file and edit ifcfg-eth0:

nano -w /etc/sysconfig/network-scripts/ifcfg-eth0

5. Remove the networking parts and specify the bridge:

TYPE=Ethernet
NAME=eth0
UUID=8d6f722c-b945-4083-b50e-9661bf62ae5f
DEVICE=eth0
ONBOOT=yes
BRIDGE=br0
HWADDR=ac:1f:6b:94:55:22

6. Bridge is  set up. Make sure that the changes are correct and restart the networking:

/etc/init.d/network restart

7. Once it's restarted you see the new bridge using the ifconfig command:

[root@dev1 ~]# ifconfig
br0       Link encap:Ethernet  HWaddr ac:1f:6b:94:55:22
          inet addr:182.112.25.4  Bcast:182.112.24.255  Mask:255.255.255.0
          inet6 addr: fe80::227:eff:fe09:cb2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2984 (2.9 KiB)  TX bytes:13154 (12.8 KiB)

eth0      Link encap:Ethernet  HWaddr 00:27:0E:09:0C:B2
          inet6 addr: fe80::227:eff:fe09:cb2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:31613 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9564 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:2981335 (2.8 MiB)  TX bytes:2880868 (2.7 MiB)
          Memory:d0700000-d0720000                                     


 


  • No labels