Bridge: Difference between revisions
No edit summary |
(fix minor typos) |
||
Line 2: | Line 2: | ||
== Using brctl == | == Using brctl == | ||
Bridges are managed with the '''brctl'' command. | Bridges are manually managed with the '''brctl''' command. | ||
<pre>Usage: brctl COMMAND [BRIDGE [INTERFACE]] | <pre> | ||
Usage: brctl COMMAND [BRIDGE [INTERFACE]] | |||
Manage ethernet bridges | Manage ethernet bridges | ||
Line 31: | Line 32: | ||
Note that you need to set the link status to ''up'' on the added interfaces. | Note that you need to set the link status to ''up'' on the added interfaces. | ||
{{Cmd|ip | {{Cmd|ip link set dev eth0 up | ||
ip link set dev eth1 up}} | ip link set dev eth1 up}} | ||
Line 40: | Line 41: | ||
In this example the address 192.168.0.1/24 is used. | In this example the address 192.168.0.1/24 is used. | ||
<pre>auto br0 | <pre> | ||
auto br0 | |||
iface br0 inet static | iface br0 inet static | ||
pre-up brctl addbr br0 | pre-up brctl addbr br0 |
Revision as of 01:54, 26 May 2010
This document describes how to configure a network bridge interface in Alpine Linux.
Using brctl
Bridges are manually managed with the brctl command.
Usage: brctl COMMAND [BRIDGE [INTERFACE]] Manage ethernet bridges Commands: show Show a list of bridges addbr BRIDGE Create BRIDGE delbr BRIDGE Delete BRIDGE addif BRIDGE IFACE Add IFACE to BRIDGE delif BRIDGE IFACE Delete IFACE from BRIDGE setageing BRIDGE TIME Set ageing time setfd BRIDGE TIME Set bridge forward delay sethello BRIDGE TIME Set hello time setmaxage BRIDGE TIME Set max message age setpathcost BRIDGE COST Set path cost setportprio BRIDGE PRIO Set port priority setbridgeprio BRIDGE PRIO Set bridge priority stp BRIDGE [1|0] STP on/off
To manually create a bridge interface br0:
brctl addbr br0
To add interface eth0 and eth1 to the bridge br0:
brctl addif br0 eth0 brctl addif br0 eth1
Note that you need to set the link status to up on the added interfaces.
ip link set dev eth0 up ip link set dev eth1 up
Configuration file
Bridging is configured in pre-up/up hooks in /etc/network/interfaces. Note that you normally don't assign ip addresses to the bridged interfaces (eth0 and eth1 in our example) but to the bridge itself (br0).
In this example the address 192.168.0.1/24 is used.
auto br0 iface br0 inet static pre-up brctl addbr br0 address 192.168.0.1 netmask 255.255.255.0 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 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 down ip link set $IFACE down