Adding new Bridge in CentOS Linux KVM
We have 4 ethernet network ports running on a server. Recently we have activated another ports with an upstream provider, we decided to active one of the port to create the VM on the new upstream provider’s port.
First, check how many bridge network is running on your server
# brctl show bridge name bridge id STP enabled interfaces br0 8000.00219b9db5e5 no eth1 vnet0 vnet1 vnet2 vnet3 vnet4 virbr0 8000.5254001bf78c yes virbr0-nic
From the above result, it shows currently there is one bridge network on eth1. The VMs are running on bridge 1. To add new bridge network, execute the command below;
# brctl addbr br1
Congrats, the bridge interface has been create, next is to configure the network interface script at system side. Go to /etc/sysconfig/network-scripts/, next create a new file name vi ifcfg-eth2 with the configuration below;
DEVICE="eth2" HWADDR="78:2B:CB:20:8E:F8" NM_CONTROLLED="yes" ONBOOT="yes" BRIDGE="br1"
Above config is to create a bridge between eth2 with br1. Next create the configuration file for br1 at /etc/sysconfig/network-scripts/, vi ifcfg-br1
DEVICE="br1" BOOTPROTO="none" ONBOOT="yes" TYPE="Bridge"
Please take note that we have the host server configured with IP Address on eth0, that is the reason why we don’t configure IP Address on br1.
That is done with network interface configuration, next restart the network services. Please take note that if you are ssh-ing into the server, you might experience disconnection for 10-15 seconds. Before restarting the network service, make sure the config is correct, we do not responsible if your server completely went down 😉
# /etc/init.d/network restart
If you connectivity came up and alive, congrats the network interface configuration has completed. Next add the network interface into bridge network
# brctl addif br1 eth2
Now you will see new interface has been added with brctl show
# brctl show bridge name bridge id STP enabled interfaces br0 8000.00219b9db5e5 no eth1 vnet0 vnet1 vnet2 vnet3 vnet4 br1 8000.00219b9db5e3 no eth2 virbr0 8000.5254001bf78c yes virbr0-nic