Port Bonding on Linux & Network

Port Bonding Setup

Port bonding allows you to combine two ports to allow more throughput for your server

Setup on CentOS

It is important that the mode and xmit_hash_policy be set correctly.

edit /etc/modprobe.conf
add:

alias bond0 bonding

create /etc/sysconfig/network-scripts/ifcfg-bond0
add:

DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=
NETMASK=
GATEWAY=
USERCTL=no
BONDING_MASTER="yes"
BONDING_MODULE_OPTS="mode=802.3ad xmit_hash_policy=layer3+4 miimon=100"
BONDING_SLAVE0="eth0"
BONDING_SLAVE1="eth1"

edit /etc/sysconfig/network-scripts/ifcfg-eth0
change to:

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

edit /etc/sysconfig/network-scripts/ifcfg-eth1
change to:

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

Server Side Complete.

Switch Side Setup

Example Information
For the Example Below we shall assume:
That there’s only Portchannel 1.
The Switchports are Gi0/1 and Gi0/2.
That Portchannel 2 is currently nonexistent.
Vlan 990

Check what is set
Check your interfaces – this also puts in the buffer the older information in case of errors

show run int Gi0/1
show run int Gi0/2

Check the Portchannel Summary Information

show etherchannel summary

The Above will show you what Portchannels are in place already.

Start Configuring

Start the Configuration Terminal

conf t

Select The First Interface of the Port Channel – Here it’s Gi0/1

int Gi0/1

Utilize the Channel Group Command -this creates the Port Channel- Using Channel 2 here because 1 is always reserved -and in use!

channel-group 2 mode on

“Creating a port-channel interface Port-channel 2″ YOU SHOULD SEE THIS

Switch over to the second interface of the Port Channel (faster than “end” then “conf t” then “int Gi0/2″)

int Gi0/2

Utilize the Channel Group Command Again

channel-group 2 mode on

(It shouldn’t say anything this time)

Switch to your shiny new Portchannel

int po2

The Portchannel takes commands. This process overwrites whatever is there. Let’s use info for Vlan 990

Set the switchport Access to Vlan 990

switchport access vlan 990

Set the Switchport Mode to Access

switchport mode access

Set the Load interval to 30 (this sets the polling interval to 30 seconds.)

load-interval 30

Disable Portfast on bonded ports – this prevents a spanning tree loop while the port channel negotiates.

no spanning-tree portfast

End editing

end

Verify and Save

Before you write one last look at the new configuration for the port channel

show run int po2
Building configuration...

Current configuration : 125 bytes
!
interface Port-channel2
switchport access vlan 990
switchport mode access
load-interval 30
spanning-tree portfast
end

And then a last glance at the 2 ports in the portchannel for consistency, then the portchannel summary one last time.

show run int Gi0/1
Building configuration...

Current configuration : 155 bytes
!
interface GigabitEthernet0/1
switchport access vlan 990
switchport mode access
load-interval 30
channel-group 2 mode on
spanning-tree portfast
end
show run int Gi0/2
Building configuration...

Current configuration : 155 bytes
!
interface GigabitEthernet0/2
switchport access vlan 990
switchport mode access
load-interval 30
channel-group 2 mode on
spanning-tree portfast
end

Check the Portchannel summary

show etherchannel summary
Flags:  D - down        P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3      S - Layer2
U - in use      f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port

Number of channel-groups in use: 2
Number of aggregators:           2

Group  Port-channel  Protocol    Ports
------+-------------+-----------+-----------------------------------------------
1      Po1(SU)          -        Gi0/21(P)   Gi0/22(P)   Gi0/23(P)
Gi0/24(P)
2      Po2(SD)          -        Gi0/1(D)    Gi0/2(D)

Here we see that Po2 is down. This is only because the server’s not attached.

Write your configuration

write

Congratulations your Port Channel to Vlan 990 is complete. PXE Installs should be criminally fast.

Switch Side Complete

Leave a Reply