- Package:
- bridge-utils
- Source:
- bridge-utils
- Description:
- Utilities for configuring the Linux Ethernet bridge
- Submitter:
- Rien Broekstra
- Date:
- 2013-08-29 23:03:05 UTC
- Severity:
- normal
I try to configure a bridge with different path costs for the ports in the bridge like this in /etc/network/interfaces:
auto mybridge
iface mybridge inet manual
bridge-ports ctz-priv eth0.3084
bridge_bridgeprio 1
bridge_stp yes
bridge_pathcost ctz-priv 100
bridge_pathcost eth0.3084 10
Trying to ifup this interface results in:
vpnbox-f2-en1:/etc/network# ifup mybridge
/etc/network/interfaces:39: duplicate option
ifup: couldn't read interfaces file "/etc/network/interfaces"
Can ifup accept multiple options for per-port configuration of a bridge (i.e. path cost and port prio, and maybe waitport)?
The error
" vpnbox-f2-en1:/etc/network# ifup mybridge /etc/network/interfaces:39:
duplicate option ifup: couldn't read interfaces file
"/etc/network/interfaces"
is not seen in 1.5-6.
However there is another error in 1.5-6. Multiple bridge_pathcost lines
in in /etc/network/interfaces for multiple ports does not work.
Only the last bridge_pathcost line sticks.
This is because env variable IF_BRIDGE_PATHCOST can contain only
pathcost for one bridge port and that happens to be the last pathcost
line for the interface.
Eg:
auto mybridge
iface mybridge inet manual
bridge-ports ctz-priv eth0.3084
bridge_bridgeprio 1
bridge_stp yes
bridge_pathcost ctz-priv 100
bridge_pathcost eth0.3084 10
IF_BRIDGE_PATHCOST only contains "eth0.3084 10"
Thanks for your contribution, looks nice at first glance, I'll take a closer look at it, but I'm afraid it is too late for this to reach wheezy, so we'll have to make this and other changes for post wheezy. Regards.
The contributed patch is nice but has a race condition in it; the bridge if-pre-up.d tests whether the interface is defined, but not whether it is up yet so when rebooting the brctl setpathcost fails for the interfaces that aren't there yet. (I'm reporting from Ubuntu 12.04 but I'm hoping there's not too much difference) I have three interfaces on my bridge, two of which are a tap device and one or both of them consistently fail to have the pathcost applied. It does work, however, if I port the patch to the if-up.d directory. M.
I have to retract my previous statement; it does not work perfectly. In kernels in < 3.11 (I think) the bridge resets its pathcost settings every time the carrier from a bridged device drops and comes back. Only since this patch made it into mainline http://www.spinics.net/lists/linux-ethernet-bridging/msg04818.html (and again, I'm not really sure when it merged but it was > 3.8 and < 3.11) the bridge remembers the pathcost that you gave it. I've now worked around it using ifplugd. M.