Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 408333 - sys-apps/openrc-0.9.9.3: bonding stanzas are gone from net.example
Summary: sys-apps/openrc-0.9.9.3: bonding stanzas are gone from net.example
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard: openrc:oldnet
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-15 11:40 UTC by Martin Mokrejš
Modified: 2013-04-25 23:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Mokrejš 2012-03-15 11:40:17 UTC
I just upgraded from openrc-0.8.3 to 0.9.9.3 (with upgrade to sys-apps/net-tools-1.60_p20120127084908) and I cannot find any places where the bonded eth interfaces could be defined.

I used to have:

# grep -v "^#" /etc/conf.d/net | uniq

routes_bond0=(
        "default via 172.25.9.1"                # IPv4 default route
)

config_eth0=( "null" )
config_eth1=( "null" )

slaves_bond0="eth0 eth1"
config_bond0=( "172.25.9.182/24" ) # You may not want to assign an IP the the bond

dns_domain_eth0="xxxxx"
dns_servers_eth0="172.25.8.83"

#



And, there used to be a section with this code:

#preup() {
        # Adjusting the bonding mode / MII monitor
        # Possible modes are : 0, 1, 2, 3, 4, 5, 6,
        #     OR
        #   balance-rr, active-backup, balance-xor, broadcast,
        #   802.3ad, balance-tlb, balance-alb
        # MII monitor time interval typically: 100 milliseconds
        #if [[ ${IFACE} == "bond0" ]] ; then
        #       BOND_MODE="active-backup"
        #       BOND_MIIMON="100"
        #       echo ${BOND_MODE} >/sys/class/net/bond0/bonding/mode
        #       echo ${BOND_MIIMON}  >/sys/class/net/bond0/bonding/miimon
        #       einfo "Bonding mode is set to ${BOND_MODE} on ${IFACE}"
        #       einfo "MII monitor interval is set to ${BOND_MIIMON} ms on ${IFACE}"
        #else
        #       einfo "Doing nothing on ${IFACE}"
        #fi
        #return 0
#}

Where is it gone now?
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-03-15 19:26:41 UTC
The slaves part exists, line 610:
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=blame;f=doc/net.example.Linux.in;hb=44e4c21f056437043d990d21a4db41a8f9799687

However that preup block never existed like that from anything I can find.
# git show 5af58b45146ab5253ca964738f4e45287bf963d4..HEAD |grep balance-xor
That's grepping every single commit to openrc ever, and the string balance-xor from your preup block has never turned up.

Your config should look like this:
routes_bond0="default via 172.25.9.1"
config_eth0="null"
config_eth1="null"
slaves_bond0="eth0 eth1"
config_bond0="172.25.9.182/24"
dns_domain_eth0="xxxxx"
dns_servers_eth0="172.25.8.83"
miimon_bond0=100
mode_bond0=active-backup
Comment 2 Martin Mokrejš 2012-03-15 22:53:14 UTC
(In reply to comment #1)
> The slaves part exists, line 610:
> http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=blame;f=doc/net.
> example.Linux.in;hb=44e4c21f056437043d990d21a4db41a8f9799687
> 
> However that preup block never existed like that from anything I can find.
> # git show 5af58b45146ab5253ca964738f4e45287bf963d4..HEAD |grep balance-xor
> That's grepping every single commit to openrc ever, and the string
> balance-xor from your preup block has never turned up.

Weird. Maybe look for the ${BOND_MIIMON}? ;)

> 
> Your config should look like this:
> routes_bond0="default via 172.25.9.1"
> config_eth0="null"
> config_eth1="null"
> slaves_bond0="eth0 eth1"
> config_bond0="172.25.9.182/24"
> dns_domain_eth0="xxxxx"
> dns_servers_eth0="172.25.8.83"

Thanks for ensuring what should be working.

> miimon_bond0=100
> mode_bond0=active-backup

No double quotes around?


Would you mind updating the net.example file to add the lines with "miimon_bond0", "mode_bond0" and "routes_bond0" lines?

But hey, shouldn't I also overwrite the MAC adress of the bond interface
so that it does not pick up teh one from eth0? ;-)

mac_bond0="00:25:90:18:3f:2e" # make sure eth0, eth1 and bond0 have
                              # different MACs, they get temporarily synced
                              # as explained in bug #408339#c2 ?
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-03-15 23:06:21 UTC
(In reply to comment #2)
> Weird. Maybe look for the ${BOND_MIIMON}? ;)
I think you got it from here:
http://www.gentoo-wiki.info/HOWTO_Setup_Bonded_ethernet_adapters
Not anywhere in Gentoo (I grepped all of CVS too).

> 
> > 
> > Your config should look like this:
> > routes_bond0="default via 172.25.9.1"
> > config_eth0="null"
> > config_eth1="null"
> > slaves_bond0="eth0 eth1"
> > config_bond0="172.25.9.182/24"
> > dns_domain_eth0="xxxxx"
> > dns_servers_eth0="172.25.8.83"
> 
> Thanks for ensuring what should be working.
> 
> > miimon_bond0=100
> > mode_bond0=active-backup
> 
> No double quotes around?
It's bash rules. The quotes are optional there, since there are no spaces or anything that needs escaping.

That actually feeds the sysfs stuff, so the rest of your preup isn't needed at all.

> Would you mind updating the net.example file to add the lines with
> "miimon_bond0", "mode_bond0" and "routes_bond0" lines?
It is described in there already, per the sysfs reference.

> 
> But hey, shouldn't I also overwrite the MAC adress of the bond interface
> so that it does not pick up teh one from eth0? ;-)
> 
> mac_bond0="00:25:90:18:3f:2e" # make sure eth0, eth1 and bond0 have
>                               # different MACs, they get temporarily synced
>                               # as explained in bug #408339#c2 ?
No. Do NOT do that. I'll address it on the other bug.
Comment 4 Martin Mokrejš 2012-03-19 13:00:27 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Weird. Maybe look for the ${BOND_MIIMON}? ;)
> I think you got it from here:
> http://www.gentoo-wiki.info/HOWTO_Setup_Bonded_ethernet_adapters
> Not anywhere in Gentoo (I grepped all of CVS too).

Bingo!

> 
> > 
> > > 
> > > Your config should look like this:
> > > routes_bond0="default via 172.25.9.1"
> > > config_eth0="null"
> > > config_eth1="null"
> > > slaves_bond0="eth0 eth1"
> > > config_bond0="172.25.9.182/24"
> > > dns_domain_eth0="xxxxx"
> > > dns_servers_eth0="172.25.8.83"
> > 
> > Thanks for ensuring what should be working.
> > 
> > > miimon_bond0=100
> > > mode_bond0=active-backup
> > 
> > No double quotes around?
> It's bash rules. The quotes are optional there, since there are no spaces or
> anything that needs escaping.
> 
> That actually feeds the sysfs stuff, so the rest of your preup isn't needed
> at all.

Confirming (read below). 

> 
> > Would you mind updating the net.example file to add the lines with
> > "miimon_bond0", "mode_bond0" and "routes_bond0" lines?
> It is described in there already, per the sysfs reference.

This already sets the values for me on a kernel command line in grub.conf:

title Gentoo Linux 2.6.39.4
root (hd0,0)
kernel /boot/vmlinuz-2.6.39.4 root=/dev/md1 bonding.mode=1 bonding.miimon=100 console=ttyS0,115200n8 console=tty0 udev
makeactive


as can be seen in dmesg output:

[    9.489305] bonding: Ethernet Channel Bonding Driver: v3.7.0 (June 2, 2010)
[    9.496498] bonding: MII link monitoring set to 100 ms

while much later is when /etc/conf.d/net kicks in:

[   38.153205] igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[   40.443225] igb: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[   47.254464] bonding: bond0: setting mode to active-backup (1).
[   47.256603] bonding: bond0: Setting MII monitoring interval to 100.
[   47.947150] bonding: bond0: Adding slave eth0.
[   48.030383] bonding: bond0: enslaving eth0 as a backup interface with a down link.
[   48.032418] bonding: bond0: Adding slave eth1.
[   48.115769] bonding: bond0: enslaving eth1 as a backup interface with a down link.
[   50.611091] igb: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[   50.650501] bonding: bond0: link status definitely up for interface eth0, 1000 Mbps full duplex.
[   50.650507] bonding: bond0: making interface eth0 the new active one.
[   50.650748] bonding: bond0: first active interface up!
[   50.900138] igb: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[   50.949556] bonding: bond0: link status definitely up for interface eth1, 1000 Mbps full duplex.

accomodated with the relevant section in /var/log/rc.log:

 * Bringing up interface eth0
 [ ok ]
 * Bringing up interface eth1
 [ ok ]
 * Bringing up interface bond0
 *   Setting mode: active-backup
 *   Setting miimon: 100
 *   Adding slaves to bond0 ...
 *     eth0 eth1
 *     Removing addresses
 *       Removing addresses
 [ ok ]
 *   172.25.9.182/24 ...
 [ ok ]
 *   Adding routes
 *     default via 172.25.9.1 ...
 [ ok ]

> 
> > 
> > But hey, shouldn't I also overwrite the MAC adress of the bond interface
> > so that it does not pick up teh one from eth0? ;-)
> > 
> > mac_bond0="00:25:90:18:3f:2e" # make sure eth0, eth1 and bond0 have
> >                               # different MACs, they get temporarily synced
> >                               # as explained in bug #408339#c2 ?
> No. Do NOT do that. I'll address it on the other bug.

OK, so this works fine for me: bug #408337#c3 . Aside from the fact that in bug #408339#c9 another user changes the MAC address of the bond0 interface I have no more problems. ;) Thanks!
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-03-19 20:21:14 UTC
I made the bonding documentation in net.example more explicit:
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=76d3fceb58d757a2acd72a89f6098a45b53fc944
Comment 6 Martin Mokrejš 2012-03-19 21:08:48 UTC
One more http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b26493:

doc/net.example: Add warnings that changing MAC on bonds can break things.

authorRobin H. Johnson <robbat2@gentoo.org>
Mon, 19 Mar 2012 21:53:09 +0100 (13:53 -0700)
committerRobin H. Johnson <robbat2@gentoo.org>
Mon, 19 Mar 2012 21:53:09 +0100 (13:53 -0700)
commitb264931034bedef6f0a384302334393359dc59c9

doc/net.example: Add warnings that changing MAC on bonds can break things.

In most cases, changing the MAC on a bond manually is wrong. The bonding
module will do it as needed to failover between interfaces, or to get
multiple interfaces to correctly have the same MAC.

We cannot however enforce it, as there are some corner cases where it is
actually valid (hardware that requires specific MAC configuration, like
some quad-port NICs).