Quantcast
Channel: Toki Winter » network configuration
Viewing all articles
Browse latest Browse all 3

Configuring Interface Bonding on Debian (Wheezy)

$
0
0

This is a brief article detailing the steps to configure network interface bonding on Debian Wheezy (7.0 stable). The procedure is very different from RHEL/CentOS. I will be configuring active-backup (i.e. failover) mode bonding – there are other modes available, including round-robin load-balanced, LACP aggregation, etc. Read /usr/share/doc/ifenslave-2.6/README.Debian or http://www.kernel.org/doc/Documentation/networking/bonding.txt for further information.

First, verify via ifconfig that your two slave interfaces are available – I’ll be bonding eth0 and eth1 into a bond called bond0:

# ifconfig eth0
...
# ifconfig eth1
...

Install the ifenslave package:

# aptitude install ifenslave

Next, stop networking. As you’re stopping networking, ensure that you’re connected to your host via a console of some form:

# invoke-rc.d networking stop

Modify /etc/network/interfaces. Remove (or comment out) any existing configuration for your slave interfaces (eth0 and eth1), and configure your new bond0 interface appropriately:

# vi /etc/network/interfaces
...
auto bond0
iface bond0 inet static
    address 192.168.122.15
    netmask 255.255.255.0
    gateway 192.168.122.1
    slaves eth0 eth1
    bond_mode active-backup
    bond_miimon 100
    bond_downdelay 200
    bond_updelay 200

bond_miimon is the MII link monitoring frequency in milliseconds, and bond_{down,up}delay are the time, in milliseconds, to wait before disabling or enabling an interface in the bond (to safeguard against flapping), and should be a multiple of the bond_miimon value. You can adjust these values to suit your needs. These bond_<parameter> directives correlate to the <parameter> directives passed to the bonding module itself.

Once configured, start networking:

# invoke-rc.d networking start

There is no need to fiddle with module loading (editing /etc/modules, creating a file under /etc/modprobe.d, etc.) – the ifenslave-2.6 package deposits scripts to do this for us. Take a look at /etc/network/if-pre-up.d/ifenslave to see this being done.

You can see the other scripts installed by ifenslave-2.6 with a dpkg -L:

# dpkg -L ifenslave-2.6 | grep etc
/etc
/etc/network
/etc/network/if-pre-up.d
/etc/network/if-pre-up.d/ifenslave
/etc/network/if-post-down.d
/etc/network/if-post-down.d/ifenslave
/etc/network/if-up.d
/etc/network/if-up.d/ifenslave

Running ifconfig -a should now show the correct network configuration:

# ifconfig -a
bond0     Link encap:Ethernet  HWaddr 52:54:00:14:6b:b3  
          inet addr:192.168.122.15  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe14:6bb3/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:6221 errors:0 dropped:698 overruns:0 frame:0
          TX packets:3253 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5172756 (4.9 MiB)  TX bytes:397929 (388.6 KiB)

eth0      Link encap:Ethernet  HWaddr 52:54:00:14:6b:b3  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:5512 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3253 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5135486 (4.8 MiB)  TX bytes:397929 (388.6 KiB)
          Interrupt:11 Base address:0x2000 

eth1      Link encap:Ethernet  HWaddr 52:54:00:14:6b:b3  
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:709 errors:0 dropped:698 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:37270 (36.3 KiB)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

You can also view the contents of /proc/net/bonding/bond0 to check the status of the bond:

# cat /proc/net/bonding/bond0 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200

Slave Interface: eth0
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 52:54:00:14:6b:b3
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 52:54:00:f2:28:8b
Slave queue ID: 0

 

 


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images