Dec 19 2009

Redhat/Ubuntu/Debian Bridge Interface Startup Scripts

Published by at 7:00 pm under Linux

All systems need bridge-utils package installed either with yum or apt-get.
 

Redhat / Fedora

Edit each network interface startup file that is going to be added to the bridge

[root@redhat ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:C0:4F:44:41:8A
ONBOOT=yes
BRIDGE=br0

 
And create the bridge configuration file

[root@redhat ~]$ cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.100
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=no
ONBOOT=yes


Ubuntu

root@ubuntu:~$ cat /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback

auto br0
iface br0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        pre-up ifconfig eth1 down
        pre-up brctl addbr br0
        pre-up brctl addif br0 eth0
        pre-up brctl addif br0 eth1
        pre-up ifconfig eth0 0.0.0.0
        pre-up ifconfig eth1 0.0.0.0
        post-down ifconfig eth0 down
        post-down ifconfig eth1 down
        post-down ifconfig br0 down
        post-down brctl delif br0 eth0
        post-down brctl delif br0 eth1
        post-down brctl delbr br0


Debian

root@debian:~$ cat /etc/network/interfaces
iface eth0 inet manual

iface eth1 inet manual

 # Bridge setup
 iface br0 inet static
        bridge_ports eth0 eth1
        address 192.168.0.100
        broadcast 192.168.0.255
        netmask 255.255.255.0
        gateway 192.168.0.1

No responses yet

Comments RSS

Leave a Reply