Trying to create a bond between two ethernet interfaces. Everything works fine if I bring it up *twice*, but it fails the first boot I suspect that this is an ordering issue in /lib64/rc/net/bonding.sh Original ticket was interesting: http://marples.name/projects/openrc/ticket/105 Output during boot is: * null ... [ ok ] * Bringing up interface eth1 * null ... [ ok ] * Bringing up interface bond0 * Setting miimon: 100 * Setting mode: 802.3ad /lib64/rc/net/bonding.sh: line 57: echo: write error: Operation not permitted * Failed to configure mode (mode_bond0) * Adding slaves to bond0 ... * eth0 eth1 [ ok ] * null ... [ ok ] * Bringing up interface br0 * Creating bridge br0 ... * Adding ports to br0 * bond0 ... [ ok ] * 192.168.105.9/24 ... [ ok ] * Adding routes * default via 192.168.105.254 ... [ ok ] Config file is: # Bonding slaves_bond0="eth0 eth1" miimon_bond0="100" mode_bond0="802.3ad" config_bond0=( "null" ) rc_need_bond0="net.eth0 net.eth1" # config tap0 to bring up bridge tuntap_tap0="tap" config_tap0=( "null" ) bridge_add_tap0="br0" rc_need_tap0="net.br0" # Config bridge to come up with just eth0 bridge_br0="bond0" config_br0=( "192.168.105.9/24" ) routes_br0=( "default via 192.168.105.254" ) # Make the bridge depend on tap0 / eth0 rc_need_br0="net.bond0" dmesg shows that the interface is brought up too early initially: [ 224.835336] ADDRCONF(NETDEV_UP): bond0: link is not ready [ 224.843461] bonding: bond0: Setting MII monitoring interval to 100. [ 224.844807] bonding: unable to update mode of bond0 because interface is up. However, after stopping the bond and restarting it seems to be brought up later: [ 240.696828] bonding: bond0: Setting MII monitoring interval to 100. [ 240.698263] bonding: bond0: setting mode to 802.3ad (4). [ 240.714005] ADDRCONF(NETDEV_UP): bond0: link is not ready Can anyone shed some insight on this (and preferably a fix?) Oh, kernel is 2.6.32.22 in case it's relevant. Openrc 0.6.3 Thanks
Aha, isn't that always the way. Once you post the bug the problem becomes clear... So I don't use a bonding kernel module (not sure if that's significant) and the kernel appears to bring up bond0 on it's own at boot, without being asked. Because the interface is already up we can't then change the mode... # cat /sys/class/net/bonding_masters bond0 I modified the bonding.sh script to force the interface down (during creation). Perhaps someone can comment on whether this is the neatest fix? The next issue which came up is that you can only set certain params *after* changing the bond mode. I have adjusted bonding.sh to first look if there is a "mode" entry and if so to set it, then secondly we set all other parameters. It's a tad inelegant in that we end up duplicating some code, but it has the merit that if we discover we need to force other params to be set early then they can be added to the same first loop I have submitted these as two individual patches so that hopefully at least one will be accepted even if the second part is controversial? Grateful if these could be tested and committed since they appear to be blockers for anyone using bonding (clearly not many folks based on the lack of bug reports...)
Created attachment 251147 [details, diff] force interface down during creation (in case kernel has brought it up, eg automatically at boot)
Created attachment 251149 [details, diff] Force interface down and also set bond mode *before* trying to set other configuration
We will push 0.6.4 in next few days thanks for your patch :)