Setting Up a bridge: Difference between revisions

From Alpine Linux
(Created page with ' vi /etc/network/interfaces auto br0 iface br0 inet static pre-up brctl addbr br0 pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-arptables pre-up ec...')
 
No edit summary
Line 1: Line 1:
apk add bridge-utils


vi /etc/network/interfaces
vi /etc/network/interfaces


auto br0
auto br0
iface br0 inet static
iface br0 inet static
        pre-up brctl addbr br0
pre-up brctl addbr br0
        pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-arptables
pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-arptables
        pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-iptables
pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-iptables
        pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-ip6tables
pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-ip6tables
        address 192.168.0.253
address 192.168.0.253
        netmask 255.255.255.0
netmask 255.255.255.0
        gateway 192.168.0.254
gateway 192.168.0.254
        post-down brctl delbr br0
post-down brctl delbr br0
 
auto eth0
auto eth0
iface eth0 inet manual
iface eth0 inet manual
        up ip link set $IFACE up
up ip link set $IFACE up
        up brctl addif br0 $IFACE
up brctl addif br0 $IFACE
        down brctl delif br0 $IFACE || true
down brctl delif br0 $IFACE || true
        down ip link set $IFACE down
down ip link set $IFACE down
 
auto eth1
auto eth1
iface eth1 inet manual
iface eth1 inet manual
        up ip link set $IFACE up
up ip link set $IFACE up
        up brctl addif br0 $IFACE
up brctl addif br0 $IFACE
down brctl delif br0 $IFACE || true
down brctl delif br0 $IFACE || true
        down ip link set $IFACE down
down ip link set $IFACE down
 
...
...
 
 
 
 


That way you create br0 with: ifup br0, and you can add/remove
That way you create br0 with: ifup br0, and you can add/remove
individual interfaces to the bridge with ifup eth0, ifdown eth0.
individual interfaces to the bridge with ifup eth0, ifdown eth0.

Revision as of 12:04, 2 April 2010

apk add bridge-utils

vi /etc/network/interfaces

auto br0
iface br0 inet static
pre-up brctl addbr br0
pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-arptables
pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-iptables
pre-up echo 0 > /proc/sys/net/bridge/bridge-nf-call-ip6tables
address 192.168.0.253
netmask 255.255.255.0
gateway 192.168.0.254
post-down brctl delbr br0

auto eth0
iface eth0 inet manual
up ip link set $IFACE up
up brctl addif br0 $IFACE
down brctl delif br0 $IFACE || true
down ip link set $IFACE down

auto eth1
iface eth1 inet manual
up ip link set $IFACE up
up brctl addif br0 $IFACE
down brctl delif br0 $IFACE || true
down ip link set $IFACE down
...

That way you create br0 with: ifup br0, and you can add/remove individual interfaces to the bridge with ifup eth0, ifdown eth0.