How to configure Software Bridge in RHEL 7 ?

Software Bridges can be configured in two ways. One is directly on ethernet interface and another is on bonded interface. Recommended way is to configured it on Bonded configuration. If one NIC in A/P bonding configuration is going down, at that time also we will be having working bridge configuration. This is not possible is bridge is directly configured on top of ethernet.

Here I am showing both method of bridge configuration.

  • Method 1 : Configuring bridge on top of ethernet. Create and modify the configuration as mentioned. Change the MAC address, IP and name as per your requirement.

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
IPADDR=192.168.120.21
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
DELAY=0

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33
TYPE=Ethernet
HWADDR=00:0c:29:2c:62:df
BOOTPROTO=none
ONBOOT=yes
BRIDGE=br0

[root@localhost ~]# systemctl restart network

After restarting the network services can you see the br0 in output of ifconfig -a. You can configure the VNIC on top of bridge which can be further assigned to LXC(Linux Containers.)

  • Method 2 : Creating bridge on top of bonded interface. Create and modify the configuration files as mentioned. Change the MAC address, IP and name as per your requirement.

Step 1 : I have created bonded interface by using one ethernet interface. If you want to take the true advantage of redundancy kindly create bond using two ethernet interfaces. If you existing bonding configuration jump to step 2.

[root@localhost network-scripts]# more ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.120.10
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS=”mode=1 miimon=100″

[root@localhost network-scripts]# more ifcfg-ens38
DEVICE=ens38
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no

[root@localhost network-scripts]# systemctl restart network

[root@localhost network-scripts]# more /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens38
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: ens38
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:2c:62:f3
Slave queue ID: 0

Step 2 : After configuring the bond, we can proceed further for configuration of bridge. Edit the existing bond configuration file as below compare it with step 1 configuration file notice the differences.
created the configuration file for bridge and then restart the network service.

[root@localhost network-scripts]# cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS=”mode=1 miimon=100″
BRIDGE=brbond1

[root@localhost network-scripts]# cat ifcfg-brbond1
DEVICE=brbond1
ONBOOT=yes
TYPE=Bridge
IPADDR=192.168.120.11
NETMASK=255.255.255.0

[root@localhost network-scripts]# systemctl restart network

Verify the results with below command or with ifconfig -a.

[root@localhost network-scripts]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:2c:62:df brd ff:ff:ff:ff:ff:ff
3: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:2c:62:e9 brd ff:ff:ff:ff:ff:ff
4: ens38: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:2c:62:f3 brd ff:ff:ff:ff:ff:ff
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue master brbond1 state UP mode DEFAULT
link/ether 00:0c:29:2c:62:f3 brd ff:ff:ff:ff:ff:ff
8: brbond1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 00:0c:29:2c:62:f3 brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 00:0c:29:2c:62:df brd ff:ff:ff:ff:ff:ff

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s