Table of Contents

BSD Networking

This is actually “advanced networking” as we will be talking about LACP and vlans.

LAPC (bonding)

Edit /etc/rc.conf and modify as follows. be sure to remove any other network stanzas

ifconfig_bce0="up"
ifconfig_bce1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport bce0 laggport bce1 10.0.0.15/24"

The mode (laggproto) is one of:

Best thing would be to use lacp if you can set up the switch, otherwise use either failover (preferred) or fec

vlan

In /etc/rc.conf, add one line, vlans_em0=“list of vlans”, then create an ifconfig line for each vlan defined, ie

vlans_bce0="10 20 30 40 50"
ifconfig_bce0_10="inet 192.168.20.20/24"
ifconfig_bce0_20="up"
ifconfig_bce0_30="SYNCDHCP"
ifconfig_bce0_40="up"
ifconfig_bce0_50="inet 10.0.0.15/24"

NOTE: notice the use of SYNCDHCP above.

vlan plus bonding

In the following configuration, we are setting up two separate LAPC bonds, using two pair of interfaces, then adding appropriate vlans to them.

bce0 and bce1 will be paired into lagg0, and work on vlans 10, 20, 30 and 40.

em0 and em1 will be paired into lagg1, and work only with vlan 50.

when you are done, ifconfig should show you all the interfaces, properly sorted.

ifconfig_bce0="up"
ifconfig_bce1="up"
cloned_interfaces="lagg0 lagg1"
ifconfig_lagg0="laggproto failover laggport bce0 laggport bce1"

vlans_lagg0="10 20 30 40"
ifconfig_lagg0_10="inet 192.168.20.21/32"
ifconfig_lagg0_20="up"
ifconfig_lagg0_30="dhcp"
ifconfig_lagg0_40="up"

# iscsi interface
ifconfig_em0="up"
ifconfig_em1="up"
ifconfig_lagg1="laggproto failover laggport em0 laggport em1"

vlans_lagg1="50"
ifconfig_lagg1_50="inet 10.0.0.15/24"

Manual Setup

In a few cases, I've had to manually bring up an interface, so here are the notes on that. This sets up an LACP LAGG (named lagg0) using two ports (igb0 and igb1) on 192.168.1.5/24, then adds 192.168.1.1 as the default route. NOTE: you are responsible for ensuring the IP is not duplicated, and the default route is correct.

# bring up the two network ports
ifconfig igb0 up
ifconfig igb1 up
# create the link aggregation as lagg0
ifconfig lagg0 create
# configure lagg0
ifconfig lagg0 up laggproto lacp laggport igb0 laggport igb1 192.168.1.5/24
# set default route to 192.168.1.1
route add default 192.168.1.1
# see routing table
netstat -r

Resources