ifenslave is a Linux package for bonding (also known as trunking or teaming) multiple network interfaces. Bonding provides improved bandwidth and provides fault tolerance.
An example of
/etc/network/interfaces is shown below.
1 # First NIC 2 auto eth0 3 iface eth0 inet manual 4 bond-master bond0 5 pre-up /sbin/ifconfig $IFACE mtu 9000 6 post-up /sbin/ethtool -G $IFACE rx 4096 7 post-up /sbin/ethtool -G $IFACE tx 4096 8 9 # Second NIC 10 auto eth1 11 iface eth1 inet manual 12 bond-master bond0 13 pre-up /sbin/ifconfig $IFACE mtu 9000 14 post-up /sbin/ethtool -G $IFACE rx 4096 15 post-up /sbin/ethtool -G $IFACE tx 4096 16 17 # Virtual NIC 18 auto bond0 19 iface bond0 inet dhcp 20 # address 192.168.30.100 21 # netmask 255.255.255.0 22 # network 192.168.30.0 23 # broadcast 192.168.30.255 24 # gateway 192.168.30.1 25 # dns-* options are implemented by the resolvconf package, if installed 26 # dns-nameservers 22.214.171.124 192.168.30.1 27 # dns-search helene 28 bond-mode balance-rr 29 bond-miimon 2000 30 bond-slaves eth0 eth1 31 pre-up /sbin/ifconfig $IFACE mtu 9000 32 pre-up /sbin/ifconfig $IFACE hw ether 00:1f:29:5f:db:6a
This config will bond 2 NICs together into a round-robin bond using DHCP. The interfaces are permitted to use 9000bit jumbo frames. The links are checked for upness every 2 seconds. The TX and RX buffers on the network cards are allowed to be used fully, 4096kB each, per card.
- The MAC address of the bond is set on line 34 to keep it consistent through reboots. If not set, ifenslave will use the MAC of the first NIC to go up, which will cause MAC address filtering to not work.
- The TX and RX buffers are set on lines 7, 8, 16, 17 to the maximum size available on the card. This value will depend on the NIC itself. This improves performance and reduces the likelihood of a buffer overrun. Doing this requires the installation of the