← Back to team overview

touch-packages team mailing list archive

[Bug 1224007] Re: mtu not always set properly on bond/vlan interface

 

*** This bug is a duplicate of bug 1065077 ***
    https://bugs.launchpad.net/bugs/1065077

This is definitely not a duplicate of bug #1065077. It is amazing that having LACP+VLAN+Jumboframes configuration doesn't work since 2013 on two consecutive LTS server editions, so I explored this problem.
It was probably introduced when Upstart started to manage interfaces.

A race condition occurs during ifup phase, because configuration of
descdenant interface (especially setting MTU) depends on successful
configuration of parent interface.

In this particular case, bond0.X's MTU cannot be set to value greater than MTU of bond0, so ifup fails on execution for bond0.X with
"RTNETLINK answers: Numerical result out of range" and status code of 2. As a result, interface is left in half-configured state.

Direct cause of problem is a lack of synchronization between starting networking tasks for main interface and its subinterfaces.
It is especially an issue for bonding with LACP, because it takes some time to LACP negotiation.
MTU is set by ifupdown binary itself, with some delay on bond0 (1-2s in my case).
Unfortunatelly, before it is finished, task for bond0.X is also fired and failed immediatelly.
I've checked timings and I needed to wait about 0.6s in bond0.X's pre-up to have MTU on bond0 properly set.

I attached a poor man's synchronization script, which solves the problem
by implementing sleep until parent interface has correct MTU.

I'm unsure if it's possible to enforce correct order in Upstart, maybe a
Upstart master is here and could confirm this?

It is very likely that the similar problem occurs in VLAN+Bridge+MTU
configuration.

** Attachment added: "if-pre-up.d_00mtufix"
   https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1224007/+attachment/4470226/+files/if-pre-up.d_00mtufix

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ifupdown in Ubuntu.
https://bugs.launchpad.net/bugs/1224007

Title:
  mtu not always set properly on bond/vlan interface

Status in ifupdown package in Ubuntu:
  Confirmed
Status in ifupdown package in Debian:
  New

Bug description:
  * Description

  When configuring a network with bonding+vlan and setting the MTU,
  occasionally the MTU doesn't get set properly on the vlan interface.

  In addition if one checks /var/log/upstart/networking.log whenever there is a failure the following message is printed:
  SIOCSIFMTU: Numerical result out of range

  I've tested the latest ifupdown package (0.7.44) and the problem still exists.
  Multi/single CPU settings both exhibit the issue.

  * Versions
  This affects latest ifupdown and ubuntu p/q/r/s.

  * Test Case

  # Create a p/q/r/s server vm with two network interfaces
  # This is reproducible on real hardware as well

  # Install the following
  sudo apt-get install vlan ifenslave-2.6 bridge-utils
  sudo modprobe bonding 8021q

  # Edit the interfaces file
  /etc/networking/interfaces:

  auto bond0
  iface bond0 inet manual
    bond-mode 802.3ad
    bond-miimon 100
    bond-lacp-rate 1
    bond-slaves eth0 eth1
    post-up ifconfig bond0 mtu 9000

  auto eth0
  iface eth0 inet manual
    bond-master bond0
    post-up ifconfig eth0 mtu 9000

  auto eth1
  iface eth1 inet manual
    bond-master bond0
    post-up ifconfig eth1 mtu 9000

  auto bond0.123
  iface bond0.123 inet static
    address 192.168.122.68
    netmask 255.255.255.0
    gateway 192.168.122.1
    post-up ifconfig bond0.123 mtu 9000

  # edit rc.local (or another startup script) so we reboot until we hit the error
  /etc/rc.local:

  DEVS="eth0 eth1 bond0 bond0.123"
  for d in $DEVS; do
          mtu=$(cat /sys/class/net/$d/mtu)
          if [ $mtu != 9000 ]; then
                  echo "FAIL"
                  exit 1
          fi
  done

  reboot
  exit 0

  # Now reboot the machine, within 10m or so you should be at the login prompt
  # if you ifconfig | grep MTU you will see some of our interfaces did not get 
  # the MTU properly set and the test failed.
  # Essentially we want to ensure that all MTU's (except lo) were set to 9000

  * Workaround

  Change the bond0.123 post-up command to:
    post-up sleep 2 && ifconfig bond0.123 mtu 9000

  Now when rebooting the interfaces will all be brought up with the
  proper MTU.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1224007/+subscriptions