How to setup a bridge on Redhat, CentOS, or Scientific Linux

By jbayer - Last updated: Thursday, July 14, 2011 - Save & Share - Leave a Comment

This has been tested on a RHEL 5.6 system.  These instructions should work on any clone.  While not tested, they should work on any 6.0 system as well.

 

These instructions are taken from the following page, with some additions:

http://www.linux-kvm.org/page/Networking

 

 

Assuming that the NIC the bridge is to connect to is eth0:

 

  1. Update the /etc/sysconfig/network-scripts/ifcfg-eth0 file:
    1. Change  the BOOTPROTO to:

BOOTPROTO=none

 

  1. Add the following line to the same file:

BRIDGE=br0

 

  1. Create /etc/sysconfig/network-scripts/ifcfg-br0
    1. The content should be:

DEVICE=br0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Bridge

IPV6INIT=no

USERCTL=no

 

  1. To assign a static IP address, change the BOOTPROTO line in the ifcfg-br0 file to:

BOOTPROTO=static

 

  1. And add the following lines, with the appropriate IP info set:

GATEWAY=10.0.2.2

NETMASK=255.255.255.0

IPADDR=10.0.2.15

  1. If you have any aliases on the device you are bridging to, you will rename the aliases to refer to the bridge instead of the device.  For example, if in normal mode you have:
Eth0 192.168.100.20
Eth0:0 192.168.100.41
Eth0:1 192.168.100.42

 

In bridging mode you will have:

 

Eth0
Br0 192.168.100.20
Br0:0 192.168.100.41
Br0:0 192.168.100.42

 

  1. The gatewaydev in /etc/sysconfig/network will need to be updated to:

 

GATEWAYDEV=br0

 

  1. When using VLANs on a setup like this and no traffic is getting through to your guest(s), you might want to do:

 

# cd /proc/sys/net/bridge
# ls
bridge-nf-call-arptables  bridge-nf-call-iptables
bridge-nf-call-ip6tables  bridge-nf-filter-vlan-tagged
# for f in bridge-nf-*; do echo 0 > $f; done

Posted in Administration, Networking, Virtulization • • Top Of Page
5,642 views

Write a comment

asd