> (…) > The bonding seems to work now after these changes, but I find strange things > in the journal: > the systemd-netword.service sends a STOPPING notification to the journal > after about 30 seconds being “up”, and without mentioning any reason > (I increased the logLevel of the journal to “debug”). > it then spontaneously restarts when incoming traffic is detected on the > socket. This process is continuously repeated. > This starting/stopping is not really disturbing the IP communications; I > could work with SSH as before. Also, my Wireshark sniffer is not showing any > interruptions. > > Any suggestion to stop this strange behaviour is welcome, as well as any help > to set up a bonding device under systemV init. > > pvg > > -- > http://lists.linuxfromscratch.org/listinfo/blfs-support > FAQ: http://www.linuxfromscratch.org/blfs/faq.html > Unsubscribe: See the above information page
It’s lonely here at BLFS, so let’s continue answering my own mails… As explained a couple of months ago, I could set up bonding under systemd fairly easy. I spent some time during the Xmas holidays trying to set up bonding on my iMac-400, running LFS-7.2. Every kernel comes with a document ‘bonding.txt’ that explains how to set up a bonding interface. A manual setup is actually not that difficult t do: 1. load the ‘bonding’ kernel module. This creates automatically a bonding device ‘bond0’; 2. if you want another name for the bonding device, like bond1: bash-4.2# echo +bond1 > /sys/class/net/bonding_masters bash-4.2# cat /sys/class/net/bonding_masters bond0 bond1 bash-4.2# /sbin/ifconfig bond1 up 3. to add a slave interface to the bonding master: bash-4.2# echo +wlan0 > /sys/class/net/bond1/bonding/slaves The real challenge (for me anyway…) is to integrate this with the LFS scripts to automate the process. These are the steps I did: 1. add a line to /etc/sysconfig/modules to load the bonding module 2. create an additional service ‘bond’: lfs_imac [ ~ ]$ ls -l /lib/services totaal 48 -rwxr-xr-- 1 root root 932 26 dec 21:02 bond -rw-r--r-- 1 root root 29377 4 jan 2016 init-functions -rwxr-xr-- 1 root root 2361 4 jan 2016 ipv4-static -rwxr-xr-- 1 root root 1979 4 jan 2016 ipv4-static-route -rwxr-xr-- 1 root root 2343 30 apr 2014 wpa lfs_imac [ ~ ]$ cat /lib/services/bond #!/bin/sh ######################################################################## # Begin /lib/services/bond # # Description : create/delete a bonding interface # # Authors : Pol Vangheluwe - [email protected] # # Version : LFS 7.2-pvg # ######################################################################## . /lib/lsb/init-functions if [ ! -r "/sys/class/net/bonding_masters" ]; then log_failure_msg2 "Kernel module bonding is not loaded. Cannot create a bonding interface" exit 1 fi case "${2}" in up) log_info_msg "Creating the ${1} interface..." echo +${1} > /sys/class/net/bonding_masters evaluate_retval ;; down) log_info_msg "Deleting the ${1} interface..." echo -${1} > /sys/class/net/bonding_masters evaluate_retval ;; *) echo "Usage: ${0} [interface] {up|down}" exit 1 ;; esac # End /lib/services/bond 3. Add a section to /sbin/ifup to check for the keyword ‘MASTER’: (…) # Add interface as slave to a bonding interface if test -n "${MASTER}"; then ip link set ${IFACE} down echo +${IFACE} > /sys/class/net/${MASTER}/bonding/slaves evaluate_retval exit 0 fi (…) 4. Update the interface configuration files. I have an eth0 and a wlan0 that I want the enslave to bond1: lfs_imac [ ~ ]$ cat /etc/sysconfig/ifconfig.bond1 ONBOOT=yes IFACE=bond1 SERVICE="bond ipv4-static" IP=192.168.1.5 GATEWAY=192.168.1.1 PREFIX=24 BROADCAST=192.168.1.255 lfs_imac [ ~ ]$ cat /etc/sysconfig/ifconfig.eth0 ONBOOT=yes IFACE=eth0 MASTER=bond1 lfs_imac [ ~ ]$ cat /etc/sysconfig/ifconfig.wlan0 ONBOOT=yes IFACE=wlan0 SERVICE=wpa MASTER=bond1 The result is: lfs_imac [ ~ ]$ /sbin/ifconfig bond1: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500 metric 1 inet 192.168.1.5 netmask 255.255.255.0 broadcast 192.168.1.255 ether 00:30:65:4f:b8:a8 txqueuelen 0 (Ethernet) RX packets 1100 bytes 193752 (189.2 KiB) RX errors 0 dropped 4 overruns 0 frame 0 TX packets 469 bytes 67361 (65.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 metric 1 inet 192.168.1.6 netmask 255.255.255.0 broadcast 192.168.1.255 ether 00:30:65:4f:b8:a8 txqueuelen 1000 (Ethernet) RX packets 201 bytes 27400 (26.7 KiB) RX errors 0 dropped 2 overruns 0 frame 0 TX packets 69 bytes 9326 (9.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436 metric 1 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 0 (Local Loopback) RX packets 16 bytes 3482 (3.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16 bytes 3482 (3.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlan0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500 metric 1 ether 00:30:65:4f:b8:a8 txqueuelen 1000 (Ethernet) RX packets 899 bytes 166352 (162.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 400 bytes 58035 (56.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lfs_imac [ ~ ]$ ls -l /sys/class/net/bond1/slave_eth0 lrwxrwxrwx 1 root root 0 27 dec 09:27 /sys/class/net/bond1/slave_eth0 -> ../../../pci0002:20/0002:20:0f.0/net/eth0 lfs_imac [ ~ ]$ ls -l /sys/class/net/bond1/slave_wlan0 lrwxrwxrwx 1 root root 0 27 dec 09:27 /sys/class/net/bond1/slave_wlan0 -> ../../../pci0001:10/0001:10:19.0/usb2/2-1/2-1:1.0/net/wlan0 lfs_imac [ ~ ]$ ls -l /sys/class/net/eth0/master lrwxrwxrwx 1 root root 0 27 dec 09:27 /sys/class/net/eth0/master -> ../../../../virtual/net/bond1 lfs_imac [ ~ ]$ ls -l /sys/class/net/wlan0/master lrwxrwxrwx 1 root root 0 27 dec 09:28 /sys/class/net/wlan0/master -> ../../../../../../../virtual/net/bond1 This is only a very elementary setup. It just works, but I didn’t test/implement complete error handling. The script /sbin/ifdown may also need some adaptation. System feedback is bit messy (coming from the script but also form the kernel). So, suggestions for improvement are welcome. pvg -- http://lists.linuxfromscratch.org/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
