Bridge: Difference between revisions

From Alpine Linux
(Use the ifupdown scripts from bridge package)
Line 1: Line 1:
[[Category:Networking]]
[[Category:Networking]]
This document describes how to configure a [http://en.wikipedia.org/wiki/Bridging_%28networking%29 network bridge] interface in Alpine Linux.
This document describes how to configure a [http://en.wikipedia.org/wiki/Bridging_%28networking%29 network bridge] interface in Alpine Linux.
Alpine linux 2.4 or newer is required.


== Using brctl ==
== Using brctl ==
Line 39: Line 41:


== Configuration file ==
== 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).
Install the scripts that configures the bridge.
{{Cmd|apk add bridge}}
 
Bridging is then configured in ''/etc/network/interfaces'' with the ''bridge-ports'' keyword.
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.
In this example the address 192.168.0.1/24 is used.
Line 46: Line 52:
auto br0
auto br0
iface br0 inet static
iface br0 inet static
pre-up brctl addbr br0
bridge-ports eth0 eth1
bridge-stp 0
address 192.168.0.1
address 192.168.0.1
netmask 255.255.255.0
netmask 255.255.255.0
post-down brctl delbr br0
</pre>


auto eth0
You can set the various options with those keywords:
iface eth0 inet manual
; bridge-aging
up ip link set $IFACE up
: Set ageing time
up brctl addif br0 $IFACE
; bridge-fd
down brctl delif br0 $IFACE
: Set bridge forward delay
down ip link set $IFACE down
; bridge-hello
 
: Set hello time
auto eth1
; bridge-maxage
iface eth1 inet manual
: Set bridge max message age
up ip link set $IFACE up
; bridge-pathcost
up brctl addif br0 $IFACE
: Set path cost
down brctl delif br0 $IFACE
; bridge-portprio
down ip link set $IFACE down
: Set port priority
</pre>
; bridge-bridgeprio
: Set bridge priority
; bridge-stp
: STP on/off

Revision as of 12:06, 22 August 2012

This document describes how to configure a network bridge interface in Alpine Linux.

Alpine linux 2.4 or newer is required.

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

Install the scripts that configures the bridge.

apk add bridge

Bridging is then configured in /etc/network/interfaces with the bridge-ports keyword. 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
	bridge-ports eth0 eth1
	bridge-stp 0
	address 192.168.0.1
	netmask 255.255.255.0

You can set the various options with those keywords:

bridge-aging
Set ageing time
bridge-fd
Set bridge forward delay
bridge-hello
Set hello time
bridge-maxage
Set bridge max message age
bridge-pathcost
Set path cost
bridge-portprio
Set port priority
bridge-bridgeprio
Set bridge priority
bridge-stp
STP on/off