Tuesday, January 13, 2015

Configure bridge interface on CentOS

Install bridge command
$ sudo yum install bridge-utils


The brctl command howto

To create a bridge:
$ sudo brctl addbr br0
To remove a bridge:
$ sudo brctl delbr br0 
 
Add/ Remove interface in Bridge

To add an interface to a bridge:
$ sudo brctl addif br0 eth0
To remove an interface to a bridge:
$ sudo brctl delif br0 eth0 
 

Configure a permanent bridge interface on CentOS, RHEL or Fedora

You need to update existing eth0 configuration in /etc/sysconfig/network-scripts/ifcfg-eth0, and add bridge configuration in /etc/sysconfig/network-scripts/ifcfg-br100.
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
BRIDGE=br100
If eth0 has an IP address assigned by DHCP:
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-br100
DEVICE=br100
TYPE=Bridge
ONBOOT=yes
DELAY=0
BOOTPROTO=dhcp
ONBOOT=yes
STP=no
If eth0 has a static IP address:
 
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-br100 
 
DEVICE=br100
TYPE=Bridge
BOOTPROTO=static
IPADDR=<static_IP_address_of_eth0>
NETMASK=<netmask>
GATEWAY=<gateway>
ONBOOT=yes
STP=no

No comments:

Post a Comment