# Lagg(4) failover



## SirDice (Jan 6, 2014)

I'm testing with lagg(4) to see if we can use it for failover on one of our database servers. However I'm running into a couple of snags.

I have two test systems, test1 and test2, both FreeBSD 9.1 and both are connected to an HP Procurve Layer2 switch. Test2 is configured with lagg(4) on igb0 and igb1. Testing is done from test1. Initial configuration works, test2 is on the network and accessible. The active interface is igb0. If I unplug the cable on the active interface, a ping running from test1 has only a slight delay but continues without problems. So far so good. However, if I plug the cable back in, the switch keeps sending traffic to igb1 (I can see the activity LED blinking) but because igb0 is now the active interface again nothing is received. Pings all fail. I have to wait until the MAC address times-out on the switch before it starts working again. This makes lagg(4) rather useless. 

I did find kern/156226 that looks like it could solve my  issue but the last actions on it are almost two years old. Do I need some specific configuration on the switch? It's currently just running a default configuration.


----------



## junovitch@ (Jan 7, 2014)

How about trying to set up a proper LACP EtherChannel if the HP supports that configuration?  I've never ran switch to server link aggregation but I've been using EtherChannels for years all over the place in my network infrastructure.  That might solve the seamless fail-over problem as well as double up your bandwidth when both links are up.


----------



## SirDice (Jan 13, 2014)

Would that also work if the machine is connected to two switches? I'm currently only testing with one switch but for production each of the connections is supposed to be attached to a different switch. I can't remember where I read it but I can remember some issues in that case.


----------



## kpa (Jan 13, 2014)

If I'm reading your description right you would like to have two servers that appear as a single IP address to the outside world and with automatic failover in case the primary fails? Have you looked at carp(4) if it can do what you want?


----------



## SirDice (Jan 13, 2014)

kpa said:
			
		

> If I'm reading your description right you would like to have two servers that appear as a single IP address to the outside world and with automatic failover in case the primary fails? Have you looked at carp(4) if it can do what you want?


For the situation you're describing carp(4) works like a charm. In this case however I have one machine that needs to failover if one of the switches dies, lagg(4) should be what I need.

As for my original problem, it seems that setting the sysctl(8) net.link.lagg.failover_rx_all to a non-zero value is the solution. Not an ideal situation perhaps but it'll do. Ideally I think the master interface should send out a couple of gracious ARPs when it becomes active again. Similar to what the backup interface does when it becomes active.


----------



## JanJurkus (Jan 18, 2014)

What kind of laggproto are you using? I haven't played with it for a while, but this is what I put in my rc.conf a year and a half ago:


```
ifconfig_igb0="up"
ifconfig_igb1="up"
defaultrouter="10.23.0.23"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto lacp laggport igb0 laggport igb1 10.23.0.42/16"
```


----------



## SirDice (Jan 19, 2014)

I'm using failover as I'm only interested in that. We currently have no need to bundle two or more interfaces.


----------



## ondra_knezour (Jan 19, 2014)

The loadbalance mode may help you if "being silent" on a backup line is not mandatory in your setup.

Some higher HP switches support the distributed LACP, where member ports may be on several switches of one stack.

Also use of the bridge() may help, just put both ports into one bridge and let the STP/RSTP between bridge and switches take care of setting one port active, see Bridging - 30.5.2.5. Layer 2 Redundancy in the handbook.


----------



## JanJurkus (Jan 21, 2014)

SirDice said:
			
		

> I'm using failover as I'm only interested in that. We currently have no need to bundle two or more interfaces.



Well, doesn't lacp also include some sort of failover? Maybe this is handled totally differently and will work in your situation. But lacp probably will not work with two switches, I should mess with that one day.


----------



## SirDice (Jan 21, 2014)

JanJurkus said:
			
		

> But LACP probably will not work with two switches, I should mess with that one day.


Yeah, that's what I read too. Unfortunately I can't remember where I read it though. Having one server connected to two switches is the reason why I'm looking into lagg(4). The idea is that we can spread HAProxy (with carp(4)), a couple of web servers and a database server over two switches. That way if one of the switches dies/reboots the network would still continue to work.

I have thought about using bridge(4) (with STP) too. If lagg(4) doesn't work for me I'm going to try that.


----------



## ondra_knezour (Jan 21, 2014)

Two days ago I saw hp white paper about such feature, it is called switch-to-switch distributed trunking, but I am not able to find it right now. Also stacking and mesh network may help here. Couple of years ago ICS (inter connect switch) connector was necessary, but nowadays with multigigabit links, who knows.


----------

