domenica 24 maggio 2015

FreeBSD and lagg at boot

I was experimenting with my FreeBSD and lagg(4), the link aggregator.
The idea is to perform a network interface teaming using more than one at the same time with a specific protocol, for instance, to provide high availability and redundancy.
So I fired up my VirtualBox instance with the more NICs I could and did some aggregation. Nothing special so far.
When I was satisfied, I tried to put the same configuration in /etc/rc.conf to enable it on boot, but here comes the problem: I was unable to create the lagg interface and, consequently, to aggregate NICs.
It tooks me a while, but finally got the hint from the rc.conf(5) man page: cloned_devices! This variable contains a list of interfaces that are clonable, and therefore created on boot.
Since it was not so simple to find out how to setup the rc.conf, the following is mine in the hope it can help anyone.


############################
## Link Aggregation Setup ##
############################
#
# First of all bring up the interface,
# then create the lagg0 interface using the
# cloned_interfaces (which in rc.conf means
# to create the interface) and then
# with a single command bring up the lagg0, specify the
# protocol to use and add each interface (laggport).
#
#
ifconfig_em1="up"
ifconfig_em2="up"
ifconfig_em3="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="up laggproto roundrobin laggport em1 laggport em2 laggport em3 192.168.200.222 netmask 255.255.255.0"

Nessun commento: