Monday, April 20, 2009

FreeBSD VLANs Configuration using ifconfig command

To create a new VLAN interface, enter:
# ifconfig {vlan-name} create

To associate the VLAN interface with a physical interface and assign a VLAN ID, IP address, and netmask:
# ifconfig {vlan-name} {ip-address} netmask {subnet-mask} vlan {vlan-id} vlandev {physical-interface}

The following examples, all packets will be marked on egress with 802.1Q VLAN tags, specifying a VLAN ID of 500:
# ifconfig vlan500 netmask vlan500 vlandev em0

To remove a VLAN interface, enter:
# ifconfig {vlan-name} destroy

To make configuration persistence, open /etc/rc.conf:
# vi /etc/rc.conf

Append / modify as follows:
cloned_interfaces=“vlan500 vlan600”
ifconfig_vlan500="inet x.x.x.x netmask y.y.y.y vlan 500 vlandev em0"
ifconfig_vlan600="inet x.x.x.x netmask y.y.y.y vlan 600 vlandev em0"

No comments:

Post a Comment