Wednesday, 5 March 2014

Load balancing interfaces on Debian/Centos using round Robin

Nothing like holding a IBM server worth more than your car in your hands (and thinking - do not drop it repeatedly... :-)

So basically we have two of these awesome servers ready for action, ample network ports, and a need to communicate directly with each other... which leaves only one geek option :-) - lets bond those free interfaces and kick some ass and speed and failover wise!

I know you can define the following in config files but with one server in production mode I couldn't afford a network restart going wrong (additionally I'm 50KM away from the facility in Johannesburg).

Instead I opted for the command route and adding them to /etc/rc.local in the rare event a server reboots. The commands (I was using eth2/eth3 so it may need tweaking for re-use).

If you experience any issues with more than 2 ports it may require a change to ALB mode (balance-alb) which load balances transceived frames using a MAC change method.

Application Server - Centos - installed by default?:
modprobe bonding mode=balance-rr miimon=100
ifconfig bond0 192.168.71.1 netmask 255.255.255.0 up
ifenslave bond0 eth2
ifenslave bond0 eth3

Database Server - Debian - package: ifenslave-2.6:
modprobe bonding mode=balance-rr miimon=100
ifconfig bond0 192.168.71.2 netmask 255.255.255.0 up
ifenslave bond0 eth2
ifenslave bond0 eth3
ip a add 192.168.70.1/24 dev eth1
ip link set up dev eth1

The results:

[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  2.13 GBytes  1.83 Gbits/sec

Awesome!

No comments:

Post a Comment