IPv4 Address:-
IPv6 Address:-
Service Provider:-
SSL Information:-
HTTP Protocol:-
Link Failover in FreeBSD (without requiring switch configuration) [01/Jun/2016]   OpenVPN Setup in FreeBSD (with NAT for IPv4 and IPv6)     NetFlow v9 Exporting from FreeBSD routers/firewalls  

It's often useful to have simple link failover... for example a server connected to two discrete switches.  In this scenario, LACP is of no use as it can't (usually) span discrete switches.

Link failover in FreeBSD will failover to a second switchport in the event of a link down event of the first.  (it does require the link itself to drop)

The MAC address of the failover pseudo network card will be the MAC address of the first network card added to the failover interface.

First, we need to ensure the link aggregation module (failover is part of this module) is started at boot, so edit /boot/loader.conf and add the following line:

if_lagg_load="YES" Copy

Now we need to configure the port... in this example we will bond igb0 and bge0 together into a failover network, with igb0 being the primary port.  We will assign the IP to the interface.

Add the following to /etc/rc.conf:

ifconfig_lagg0="laggproto failover laggport igb0 laggport bge0 up"
ifconfig_lagg0_alias0="inet" Copy

Now it's possible to put the IP assignment on the same line as the failover definitions but I think it looks cleaner separate – so I used an alias instead.

You can use a lagg port in the same way as a normal network port (e.g. clone interfaces from it for vlans etc)

On the FreeBSD server, you can check the failover with 'ifconfig lagg0' command:

    laggproto failover lagghash l2,l3,l4
    laggport: bge0 flags=0<>
    laggport: igb0 flags=5<MASTER,ACTIVE> Copy

You can see both ports are connected, and igb0 is the master port, and active port.

Data received on any non-active port will be discarded, and data from the server outbound will only be sent to active ports.

You can, of course, have more than 2 network ports in a failover configuration – but only one will ever be active.

It can also be useful on a laptop environment so failover between wireless and wired connections with the wired connection being preferred if plugged in, and wireless if not.

  OpenVPN Setup in FreeBSD (with NAT for IPv4 and IPv6)     NetFlow v9 Exporting from FreeBSD routers/firewalls  
Copyright © 2024 Daniel Austin MBCS.
Proudly hosted using the FreeBSD operating system.
E-mail me
E-mail me
padlock icon
LOGIN ERROR#123: random error here