Go to ...

Techpository

A Better Technical Repository

RSS Feed

Linux: NIC Bonding Examples


The following example creates to Bonds.
Bond0 is Active-Backup
Bond1 uses VLAN tagging and LACP

Kernel setup:
modprobe kernel configuration
/etc/modprobe.d/bonding1.conf
alias netdev-bond1 bonding
options bond1 miimon=100 mode=4 lacp_rate=1

Bond0:

ifcfg-bond0

DEVICE=bond0
IPADDR=172.16.0.3
NETMASK=255.255.255.0
NETWORK=172.16.0.0
BROADCAST=172.16.0.255
ONBOOT=yes
BOOTPROTO=none
TYPE=Bond
BONDING_MASTER=yes
PREFIX=24
DEFROUTE=yes
NAME=”Bond bond0″
BONDING_OPTS=”mode=active-backup miimon=0 arp_ip_target=172.16.0.1 arp_interval=1000″
LAST_CONNECT=1530826407
NM_CONTROLLED=no

ifcfg-bond0_slave_1

DEVICE=em1
TYPE=Ethernet
NAME=”System em1″
ONBOOT=yes
MASTER=bond0
SLAVE=yes
NM_CONTROLLED=no

ifcfg-bond0_slave_2

DEVICE=em2
TYPE=Ethernet
NAME=”System em2″
ONBOOT=yes
MASTER=bond0
SLAVE=yes
NM_CONTROLLED=no

Bond1:

ifcfg-bond1

DEVICE=bond1
TYPE=Bond
BONDING_MASTER=yes
NAME=bond1
ONBOOT=yes
BONDING_OPTS=”mode=4 miimon=100″
NM_CONTROLLED=no

ifcfg-bond1.15

VLAN=yes
TYPE=Vlan
DEVICE=bond1.15
VLAN_ID=15
BOOTPROTO=none
IPADDR=10.254.15.44
NETMASK=255.255.255.0
GATEWAY=10.254.15.1
DNS1=10.254.5.11
DNS2=10.254.5.12
DEFROUTE=yes
NAME=bond1.15
ONPARENT=yes
LAST_CONNECT=1530810269
NM_CONTROLLED=no

ifcfg-bond1_slave_1

DEVICE=p2p2
TYPE=Ethernet
NAME=bond1_slave_1
ONBOOT=yes
MASTER=bond1
SLAVE=yes
NM_CONTROLLED=no

ifcfg-bond1_slave_2

DEVICE=p3p2
TYPE=Ethernet
NAME=bond1_slave_2
ONBOOT=yes
MASTER=bond1
SLAVE=yes
NM_CONTROLLED=no