Nfs – Using NFS-root with bonded interfaces

bondinglacpnetworkingnfs

I would like to configure our servers to boot with an NFS-root with two bonded interfaces.

I managed to successfully set up the NFS-root with one network interface using a NFS-root enabled initrd and the following kernel parameters

root=/dev/nfs nfsroot=192.168.1.1:/nfsroot/ubuntu ip=dhcp initrd=initrd.img

I found information on how to setup bonding with NFS-root in a blog post.

As I'm using Ubuntu I had to add the bonding module to the end of /etc/initramfs-tools/modules. I build a new initrd and used the kernel parameters

root=/dev/nfs nfsroot=192.168.1.1:/nfsroot/ubuntu biosdevname=0 bond=bond0:eth0,eth1:mode=4:miimon=100:lacp-rate=1:slaves=none:xmit_hash_policy=layer3+4 ip=bond0:dhcp initrd=initrd.img

When I boot the server I get a kernel panic which is shown right after the message

ipconfig: can't parse IP address 'bond0'

Can anyone help me solve this issue?

The relevant part of the boot log can be found in this gist.

Update:

After a deep dive into the Ubuntu boot process, I figured out that there are currently two different approaches for creating initial ramdisks. Ubuntu uses the initramfs-tools and RedHat uses the newer dracut tool. The blog post I referenced is written for Fedora and the boot parameters listed for dracut are not usable for Ubuntu. As I couldn't figure out how to handle bonded interfaces with the initramfs-tools, I used dracut on Ubuntu and wrote up my findings in the blog post Installing and configuring dracut to boot Ubuntu 12.10 from an NFS-root over a VLAN tagged network using bonded interfaces.

Best Answer

After a little scripting I was able to get it working with initramfs-tools using dynamic slave interfaces specified via the kernel cmdline.

Add the bonding module and your ethernet module to /etc/initramfs-tools/modules

igb
bonding

Then create /etc/initramfs-tools/scripts/nfs-top/00_bonding_init with 0755 perms and populate it with the following:

#!/bin/sh -e
PREREQS=""
case $1 in
        prereqs) echo "${PREREQS}"; exit 0;;
esac

echo "Network interfaces loaded: "
echo `ls /sys/class/net`

for x in $cmdline; do
    case $x in
    bondslaves=*)
            bondslaves="${x#bondslaves=}"
            ;;
    esac
done

IFS=","
for x in $bondslaves; do
    echo "+$x" > /sys/class/net/bond0/bonding/slaves
done

Afterwards you will be able to use bondslaves= kernel cmdline parameter to specify your slave interfaces, for example: boot=nfs root=/dev/nfs initrd=ubuntu/initrd.img-3.13.0-44-generic ip=:::::bond0:dhcp aufs=tmpfs console=ttyS1,115200 console=tty0 bondslaves=p1p1,p1p2

Related Topic