VLAN Setup

Synopsis:

A virtual LAN (VLAN) is any broadcast domain that is partitioned and isolated in a computer network. VLANs work by applying tags to network frames and handling these tags in networking systems. VLANs can keep network applications separate despite being connected to the same physical network. VLAN tagging falls under IEEE 802.1Q.


I. Setup with direct commands
Log into the Freebsd system as root. (Assumes networking is already configured.) In these examples, the interface is named re0 and the VID will be 100, seen with IP address 10.1.1.10/24.
#
# ifconfig vlan0 create
# ifconfig vlan0 inet 10.1.1.10/24 vlan 100 vlandev re0
#
To remove the vlan:
#
# ifconfig vlan0 destroy
#
II. Setup persistant VLAN in /etc/rc.conf

cloned_interfaces="vlan0"
ifconfig_re0="up"
ifconfig_vlan0="inet 10.1.1.10/24 vlan 100 vlandev re0"

For more information, see the FreeBSD Handbook.