unix

How do I create a bonded interface in Linux?

To create a bonded interface on a Linux server or desktop, do the following:

1. Create a bond0 configuration file
vi /etc/sysconfig/network-scripts/ifcfg-bond0

And add the following lines:

DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

2. Update the eth0 and eth1 config files:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

3. The next step is to load the bonding module to the kernel. To do so, update /etc/modprobe.conf with these two lines:

alias bond0 bonding
options bond0 mode=balance-alb miimon=100

4. Load the module into the kernel by running modprobe bonding and then restart the network service (service network restart).

5. You can confirm that bonding is working by reviewing /proc/net/bonding/bond0. Some sample output is shown below.

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 01:ac:19:c6:b1:59

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 01:ac:29:c6:1e:60

You can also run ifconfig bond0 or ifconfig -a to ensure that all interfaces are listed.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top