Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 434020

Summary: net.example in docs dir suggest a faulty bond0-configuration.
Product: Gentoo Hosted Projects Reporter: Xake <kanelxake>
Component: netifrcAssignee: netifrc Team <netifrc>
Status: IN_PROGRESS ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard: netifrc:bonding
Package list:
Runtime testing required: ---

Description Xake 2012-09-05 11:55:57 UTC
net.example states the following:

# To bond interfaces together
#slaves_bond0="eth0 eth1 eth2"
#config_bond0="null" # You may not want to assign an IP the the bond


# If any of the slaves require extra configuration - for example wireless or
# ppp devices - we need to depend function on the bonded interfaces
#rc_need_bond0="net.eth0 net.eth1"

Lets start with the bottom paragraph.
First the thing you usually have bond for is fail-safe if one network-card or switch in you infrastructure does not work correctly. So lets ask ourself what happens if you set rc_need_bond0="net.ppp0 net.eth0 net.eth1" and net.eth0 fails to start...
That means that bond0 will never start (and enslave ppp0 and eth1, configure it and communicate only over it) since a needed dependency is not met, and also leaving your system with a unsatisfied "need net" dependency (so sshd does not start either).
So here I propose to tell people to NOT configure their devices (i.e. config_eth0="null" or no net.eth0 at all) if they do not need it, and use "rc_before_bond0=" so openrc tries to start ppp0 before bond0, but does not block bond0 if net.ppp0 failed since it does not strictly need it (i.e. net.ppp0 failed because carrier was not detected, or udev decided eth1 was better off as eth3). This since bond0 still can use the other interfaces so you do not have to take the monitor-and-keyboard-cart to find out what went wrong with your newly rebooted server.

Next thing:
If you do not configure a IP-adress on bond0, where should its IP-address come from?
net.bond0 cleans eth0, eth1 and eth2 of all traces of addresses, slams the same MAC on each and every one of them, and then the kernel expects bond0 to hold the IP-address for the system to communicate over (unless you are using a bridge on top of the bond)...

So my proposed examples will essentially suggest the following as a working configuration:
Only have net.ppp0 and net.bond0 in /etc/init.d

$ cat /etc/conf.d/net
config_ppp0=<...> # A appropriate configuration for net.ppp0
slaves_bond0="eth0 eth1 ppp0"
config_bond0="dhcp" # Or something static

This actually works, and does not leave the user with a server that fails to start sshd on the correct IP if a cable breaks.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-08-28 16:21:58 UTC
Please suggest a newer block of documentation then.