Comment 16 for bug 1015199

Ewen McNeill (ewen) wrote :

Even with the apparently fixed version, this "does not work after ifdown bond0/ifup bond0 cycle" appears to persist:

-=- cut here -=-
ewen@nas06:~$ cat /etc/issue
Ubuntu 14.04.4 LTS \n \l

ewen@nas06:~$ dpkg -l | grep ifenslave
ii ifenslave 2.4ubuntu1.2 all configure network interfaces for parallel routing (bonding)
ewen@nas06:~$
-=- cut here -=-

-=- cut here -=-
root@nas06:~# ifdown bond0
em1=em1
em2=em2
root@nas06:~# ifup bond0
Waiting for a slave to join bond0 (will timeout after 60s)
No slave joined bond0, continuing anyway
root@nas06:~# ifup em1
root@nas06:~# ifup em2
root@nas06:~#
-=- cut here -=-

After "ifdown bond0" the link does not work properly again until "ifup bond0" is done, followed by "ifup" on the individual interfaces. Which appears to be because "ifdown bond0" disables much more than "ifup bond0" is willing to enable. In particular it appears that "ifup bond0" does not make any attempt to start the slave interfaces -- it seems to solely rely on them being auto-started, which happens only on discover on boot.

The only way I seem to be able to get semi-sane behaviour is to add:

-=- cut here -=-
        pre-up (sleep 2 && ifup em1) &
        pre-up (sleep 2 && ifup em2) &
-=- cut here -=-

to the bond0 interface stanza. It has to:
(a) be pre-up, because post-up is called only after the 60 second up delay; and
(b) be delayed, because bond0 won't exist without an modprobe.d alias, until "ifup bond0" has mostly completed.

Which feels very fragile.

Surely the network scripts for ifenslave could iterate over bond-slaves and do the equivalent of "ifup" on those slave interfaces (or just enslave them directly)? Or have some other way to indicate the interfaces to auto-start. Given that the scripts are already auto-stopping them.

BTW, the documentation in README.Debian.gz is clearly wrong:

-=- cut here -=-
A bonding master is defined like this:

iface bond0 inet static
        address 208.77.188.166
        ...
        bond-primary eth0 eth1

The bonding slaves should then be defined like this:
[...]
-=- cut here -=-

as the whole bonding configuration in bond0 will be ignored if it does not contain "bond-slaves" (as noted later in the file).

My current configuration (works with the "pre-up" lines; fails "ifdown bond0; sleep 5; ifup bond0" cycle without):

-=- cut here -=-
auto em1
allow-bond0 em1
iface em1 inet manual
 bond-master bond0

auto em2
allow-bond0 em2
iface em2 inet manual
 bond-master bond0

auto bond0
iface bond0 inet static
 address [...]
        bond-mode 802.3ad
        bond-primary em1 em2
        bond-slaves em1 em2
        bond-downdelay 200
        bond-updelay 200
        bond-miimon 100
        bond-lacp-rate 1
        pre-up (sleep 2 && ifup em1) &
        pre-up (sleep 2 && ifup em2) &
-=- cut here -=-

(I've not yet rebooted to see what happens then, but I'm hopeful worst case I get some warnings about interfaces already being up.)

Ewen

PS: Ironically the referenced bug (https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1337873) says in a comment:

-=- cut here -=-
In your case ifupdown will be responsible for bringing eth2 and eth3 devices while setting up bond0, so you don't need to undertake any additional actions in the bond0 section - please depend on this.
-=- cut here -=-

which does not appear to be something that one can depend on :-(