I‘ve two Intel gigabit network card installed in HP server. I know how to setup bounding under CentOS Linux, but I’d like to do same under FreeBSD. How do I setup link aggregation of multiple network interfaces as one virtual trunk interface for the purpose of providing fault-tolerance and high-speed links under FreeBSD 7.x server?

FreeBSD has lagg – link aggregation and link failover interface. The lagg interface allows aggregation of multiple network interfaces as one virtual lagg interface for the purpose of providing fault-tolerance and high-speed links.

How do I load lagg driver?

First, you need to load the lagg driver into the memory. To load the driver as a module at boot time, place the following line in loader.conf:
Type the following command to add line to /boot/loader.conf file, enter:
# echo 'if_lagg_load="YES"' >> /boot/loader.conf
To load driver for current session use kldload command, type:
# kldload if_lagg
# kldstat

A note about custom FreeBSD kernels

If you have custom compiled kernel, you need to compile this driver into the kernel, place the following line in your FreeBSD kernel configuration file:
device lagg

How do I create a lagg interface?

A lagg interface can be created using the following command:
# ifconfig laggN create
# ifconfig lagg0 create

It can use different link aggregation protocols specified using the laggproto proto option. The driver currently supports the following aggregation protocols:

Aggregation Protocols Description
failover Sends and receives traffic only through the master port. If the master port becomes unavailable, the next active port is used. The first interface added is the master port; any interfaces added after that are used as failover devices.
fec Supports Cisco EtherChannel. This is a static setup and does not negotiate aggregation with the peer or exchange frames to monitor the link.
lacp Supports the IEEE 802.3ad Link Aggregation Control Protocol (LACP) and the Marker Protocol. LACP will negotiate a set of aggregable links with the peer in to one or more Link Aggregated Groups. Each LAG is composed of ports of the same speed, set to full-duplex operation. The traffic will be balanced across the ports in the LAG with the greatest total speed, in most cases there will only be one LAG which contains all ports. In the event of changes in physical connectivity, Link Aggregation will quickly converge to a new configuration.
loadbalance Balances outgoing traffic across the active ports based on hashed protocol header information and accepts incoming traffic from any active port. This is a static setup and does not negotiate aggregation with the peer or exchange frames to monitor the link. The hash includes the Ethernet source and destination address, and, if available, the VLAN tag, and the IP source and destination address.
roundrobin Distributes outgoing traffic using a round-robin scheduler through all active ports and accepts incoming traffic from any active port.
none This protocol is intended to do nothing: it disables any traffic without disabling the lagg interface itself.

An Example – Create link aggregation using LACP

To create a 802.3ad link aggregation using LACP with two em Intel PRO/1000 Gigabit Ethernet adapter driver Gigabit Ethernet interfaces use the following procedure. First, you do not need to assign any IPs to em0 and em1 interfaces. Do not configure them via /etc/rc.conf. Next, bring up both interfaces, enter:
# ifconfig em0 up
# ifconfig em1 up

Create a lagg interface called lagg0, enter:
# ifconfig lagg0 create
Finally, assign an IP address to lagg0:
# ifconfig lagg0 laggproto lacp laggport em0 laggport em1 netmask
If you need to create failover between NIC instead of lacp , enter:
# ifconfig lagg0 up laggproto failover laggport em0 laggport em1 netmask
To verify status of your links, enter:
# ifconfig
You may also need to add a default gateway, enter:
# route add default
# netstat -nr


  • lagg0 : Bounding interface name.
  • laggproto lacp : Bounding protocol. See above tables for possible values.
  • laggport em0 : Your first Ethernet interface name.
  • laggport em1 : Your second Ethernet interface name.
  • : IP address for lagg0 interface.
  • netmask : Netmask address for lagg0 interface.

How do I create an active failover interface?

The following example uses an active failover interface to set up roaming between wired and wireless networks using two network devices. Whenever the wired master interface is unplugged, the wireless failover device will be used:
# ifconfig em0 up
# ifconfig ath0 nwid my_ssid up
# ifconfig lagg0 laggproto failover laggport em0 laggport ath0 netmask

How do I make link aggregation configuration persistent?

To make link aggregation configuration persistent use cloned_interfaces variable in /etc/rc.conf. Open /etc/rc.conf file, enter:
# vi /etc/rc.conf
Append the following configuration:
ifconfig_lagg0="laggproto failover laggport em0 laggport em1"

Save and close the file. Now, FreeBSD will remember your configuration after the system reboot.


The research for this FAQ is based upon the following man pages:

  • rc.conf, ifconfig, and lagg

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 19 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
19 comments… add one
  • Ashwani Feb 14, 2009 @ 13:01

    very good info…but i wonder there are not much of people who r using freeBSD ;-)

  • Valqk Feb 16, 2009 @ 10:52

    Oh yes, they are! :)

  • Ladd Spencer Feb 18, 2009 @ 20:47

    Is it possible to use a lagg device to aggregate two ADSL links with static IP addresses? If so, what configuration would be required?

    • 🐧 nixCraft Feb 18, 2009 @ 21:42

      Yes, you can trunk two ADSL link with lagg. However, I recommend FreeBSD firewall distribution called pfSense. it has exactly what your talking about built in, and easy to configure.

      PFSense project

      Alternatively, read the ng_one2many(4) and ngctl(8) manual page as a good starting point.

  • Deskapahendri Feb 20, 2009 @ 16:02

    thank you for share and info. i can try at adsl link like speedy :D

  • Ladd Spencer Feb 23, 2009 @ 16:44

    Thanks Vivek, pfSense works great.

  • RepsaJ Apr 8, 2009 @ 8:51
    ifconfig_lagg0="laggproto failover laggport em0 laggport em1" 

    Altough PFSense could be handy. Don’t forget some sysadmins would like to have Link Aggregration on their production servers. And then PFSense would require a new server. This trick above you can just use on a production server.

  • Aleks Jul 17, 2009 @ 19:18


    Thank you for your tutorial. It really helped me to setup lagg with lacp for my file server.

  • Julia Sep 14, 2009 @ 10:14

    Brilliant documentation!
    Thanks a lot!

  • Dave Abrahams Dec 15, 2009 @ 17:37

    Hi, this is great to see. Any idea if there’s something similar for MacOS?

  • RepsaJ Dec 15, 2009 @ 18:45

    I have never tried it with a Mac. Altough I found a helpfile on apple.com.


    On non-server Mac it is supported to.

  • tex Dec 21, 2009 @ 19:29

    Vivek Gite says: “Yes, you can trunk two ADSL link with lagg.”

    You cant. Link agregation is layer 3. You dont have layer 3 betwen 2 adsl.

  • David Feb 12, 2010 @ 1:18

    For the permanent setup in /etc/rc.conf, I think you want a /24 mask (or whatever prefix length) rather than a /32.

  • vhor May 31, 2010 @ 14:53

    Thank you for this tutorial, it helps me.

  • brij Jun 4, 2010 @ 12:08

    Hi, i have two wireless links and want to club the bandwidth of both the links and also provide failover using LAGG.. How can i do it.. and what device L3/L2 switch should i use to do so..

  • shadow Nov 2, 2011 @ 16:50

    this is very good tutorial, it helps me.

  • Siddharth Rao Feb 24, 2012 @ 9:48

    Thanks for this. Couple of questions.
    1. Do the interfaces have to be up while creating the link aggregation?
    2. I suppose we can achieve the same using ioctls, SIOCSLAGG and SIOCGLAGG. I keep getting errors when i try these. Any suggestion in this regard will be very useful.

  • Frederic Jul 20, 2014 @ 20:44


    Thank you for this great tutorial :)
    Could you please clarify something for me please.
    At the moment (no failover), my network card is set as follow in my rc.conf file

    ### Local network configuration ###
    ifconfig_bce0=”inet netmask″

    What I would like to know is:
    1- In the lagg setup, do I use the same IP address as the one I currently have or a new one?
    2- Do I need to set an IP for my 2nd NIC card?
    3- Do I need to delete the line
    ifconfig_bce0=”inet netmask″

    Thank You in advance

  • unficyp Jul 15, 2016 @ 17:47

    Lagg failover dont work in FreeBSD because there is no gratuitous arp sent to the switch.Failover takes way too long then.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum