<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pierrep</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pierrep"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Pierrep"/>
	<updated>2026-04-30T13:57:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bridge&amp;diff=9943</id>
		<title>Bridge</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bridge&amp;diff=9943"/>
		<updated>2014-04-30T09:39:43Z</updated>

		<summary type="html">&lt;p&gt;Pierrep: adding info specific to dom0 bridging&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Networking]]&lt;br /&gt;
This document describes how to configure a [http://en.wikipedia.org/wiki/Bridging_%28networking%29 network bridge] interface in Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
== Using brctl ==&lt;br /&gt;
Bridges are manually managed with the &#039;&#039;&#039;brctl&#039;&#039;&#039; command.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Usage: brctl COMMAND [BRIDGE [INTERFACE]]&lt;br /&gt;
&lt;br /&gt;
Manage ethernet bridges&lt;br /&gt;
&lt;br /&gt;
Commands:&lt;br /&gt;
	show			Show a list of bridges&lt;br /&gt;
	addbr BRIDGE		Create BRIDGE&lt;br /&gt;
	delbr BRIDGE		Delete BRIDGE&lt;br /&gt;
	addif BRIDGE IFACE	Add IFACE to BRIDGE&lt;br /&gt;
	delif BRIDGE IFACE	Delete IFACE from BRIDGE&lt;br /&gt;
	setageing BRIDGE TIME		Set ageing time&lt;br /&gt;
	setfd BRIDGE TIME		Set bridge forward delay&lt;br /&gt;
	sethello BRIDGE TIME		Set hello time&lt;br /&gt;
	setmaxage BRIDGE TIME		Set max message age&lt;br /&gt;
	setpathcost BRIDGE COST		Set path cost&lt;br /&gt;
	setportprio BRIDGE PRIO		Set port priority&lt;br /&gt;
	setbridgeprio BRIDGE PRIO	Set bridge priority&lt;br /&gt;
	stp BRIDGE [1|0]		STP on/off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To manually create a bridge interface br0:&lt;br /&gt;
{{Cmd|brctl addbr br0}}&lt;br /&gt;
&lt;br /&gt;
To add interface eth0 and eth1 to the bridge br0:&lt;br /&gt;
{{Cmd|brctl addif br0 eth0&lt;br /&gt;
brctl addif br0 eth1}}&lt;br /&gt;
&lt;br /&gt;
Note that you need to set the link status to &#039;&#039;up&#039;&#039; on the added interfaces.&lt;br /&gt;
{{Cmd|ip link set dev eth0 up&lt;br /&gt;
ip link set dev eth1 up}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
&lt;br /&gt;
== Configuration file ==&lt;br /&gt;
{{Note|Alpine Linux v2.4 or newer is required for this}}&lt;br /&gt;
Install the scripts that configures the bridge.&lt;br /&gt;
{{Cmd|apk add bridge}}&lt;br /&gt;
&lt;br /&gt;
Bridging is then configured in &#039;&#039;/etc/network/interfaces&#039;&#039; with the &#039;&#039;bridge-ports&#039;&#039; keyword.&lt;br /&gt;
Note that you normally don&#039;t assign ip addresses to the bridged interfaces (eth0 and eth1 in our example) but to the bridge itself (br0).&lt;br /&gt;
&lt;br /&gt;
In this example the address 192.168.0.1/24 is used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto br0&lt;br /&gt;
iface br0 inet static&lt;br /&gt;
	bridge-ports eth0 eth1&lt;br /&gt;
	bridge-stp 0&lt;br /&gt;
	address 192.168.0.1&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can set the various options with those keywords:&lt;br /&gt;
; bridge-aging&lt;br /&gt;
: Set ageing time&lt;br /&gt;
; bridge-fd&lt;br /&gt;
: Set bridge forward delay&lt;br /&gt;
; bridge-hello&lt;br /&gt;
: Set hello time&lt;br /&gt;
; bridge-maxage&lt;br /&gt;
: Set bridge max message age&lt;br /&gt;
; bridge-pathcost&lt;br /&gt;
: Set path cost&lt;br /&gt;
; bridge-portprio&lt;br /&gt;
: Set port priority&lt;br /&gt;
; bridge-bridgeprio&lt;br /&gt;
: Set bridge priority&lt;br /&gt;
; bridge-stp&lt;br /&gt;
: STP on/off&lt;br /&gt;
&lt;br /&gt;
== Using pre-up/post-down ==&lt;br /&gt;
For older versions of Alpine Linux, or if you want be able to control the bridge interfaces individually, you need to use pre-up/post-down hooks.&lt;br /&gt;
&lt;br /&gt;
Example &#039;&#039;/etc/network/interfaces&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto br0&lt;br /&gt;
iface br0 inet static&lt;br /&gt;
	pre-up brctl addbr br0&lt;br /&gt;
	pre-up echo 0 &amp;gt; /proc/sys/net/bridge/bridge-nf-call-arptables&lt;br /&gt;
	pre-up echo 0 &amp;gt; /proc/sys/net/bridge/bridge-nf-call-iptables&lt;br /&gt;
	pre-up echo 0 &amp;gt; /proc/sys/net/bridge/bridge-nf-call-ip6tables&lt;br /&gt;
	address 192.168.0.253&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 192.168.0.254&lt;br /&gt;
	post-down brctl delbr br0&lt;br /&gt;
	&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet manual&lt;br /&gt;
	up ip link set $IFACE up&lt;br /&gt;
	up brctl addif br0 $IFACE&lt;br /&gt;
	down brctl delif br0 $IFACE || true&lt;br /&gt;
	down ip link set $IFACE down&lt;br /&gt;
	&lt;br /&gt;
auto eth1&lt;br /&gt;
iface eth1 inet manual&lt;br /&gt;
	up ip link set $IFACE up&lt;br /&gt;
	up brctl addif br0 $IFACE&lt;br /&gt;
	down brctl delif br0 $IFACE || true&lt;br /&gt;
	down ip link set $IFACE down&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That way you create br0 with: ifup br0, and you can add/remove&lt;br /&gt;
individual interfaces to the bridge with ifup eth0, ifdown eth0.&lt;br /&gt;
&lt;br /&gt;
== Bridging for a Xen dom0 ==&lt;br /&gt;
Bridging in a dom0 is a bit specific as it consists in bridging a real interface (i.e. ethX) with a virtual interface (i.e. vifX.Y).&lt;br /&gt;
At bridge creation time, the virtual interface does not exist and will be added by the Xen toolstack when a domU is booting (see Xen documentation on how to link the virtual interface to the correct bridge).&lt;br /&gt;
&lt;br /&gt;
;Particularities :&lt;br /&gt;
- the bridge consists of a single physical interface &amp;lt;br/&amp;gt;&lt;br /&gt;
- the physical interface does not have an IP and is configured as manual &amp;lt;br/&amp;gt;&lt;br /&gt;
- the bridge will have the IP and will be auto, resulting in bringing up the physical interface &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This translates to this sample config :&lt;br /&gt;
&lt;br /&gt;
Example &#039;&#039;/etc/network/interfaces&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
iface eth0 inet manual&lt;br /&gt;
&lt;br /&gt;
auto br0&lt;br /&gt;
iface br0 inet static&lt;br /&gt;
	address 192.168.0.253&lt;br /&gt;
	netmask 255.255.255.0&lt;br /&gt;
	gateway 192.168.0.254&lt;br /&gt;
        bridge_port eth0&lt;br /&gt;
        bridge_stp 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After the domU OS is started, the virtual interface wil be added and the working bridge can be checked with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brctl show&lt;br /&gt;
&lt;br /&gt;
ifconfig -a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pierrep</name></author>
	</entry>
</feed>