- NetBSD Manual Pages
VLAN(4) NetBSD Kernel Interfaces Manual VLAN(4)
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
vlan -- IEEE 802.1Q Virtual LAN network device
The vlan interface provides support for IEEE 802.1Q Virtual Local Area
Networks (VLAN). This supports the trunking of more than one network on
a single network interface. This is particularly useful on routers or on
hosts which must be connected to many different networks through a single
To use a vlan interface, the administrator must first create the inter-
face and then specify the VLAN tag (a 16-bit integer which distinguishes
each VLAN from any others) and physical interface associated with the
VLAN. This can be done by using the ifconfig(8) create, vlan, and vlanif
subcommands from a shell command line or script. From within a C pro-
gram, use the ioctl(2) system call with the SIOCSIFCREATE and SIOCSIFVLAN
To be compatible with other IEEE 802.1Q devices, the vlan interface sup-
ports a 1500 byte MTU, which means that the parent interface will have to
handle packets that are 4 bytes larger than the original Ethernet stan-
dard. Drivers supporting this increased MTU are:
- drivers using the DP8390 core (such as ec(4), ne(4), we(4), and
vlan can be used with devices not supporting the IEEE 802.1Q MTU, but
then the MTU of the vlan interface will be 4 bytes too small and will not
interoperate properly with other IEEE 802.1Q devices, unless the MTU of
the other hosts on the VLAN are also lowered to match.
The following will create interface vlan0 with VLAN tag six, on the
Ethernet interface tlp0:
ifconfig vlan0 create
ifconfig vlan0 vlan 6 vlanif tlp0
After this set up, IP addresses (and/or other protocols) can be assigned
to the vlan0 interface. All other hosts on the Ethernet connected to
tlp0 which configure a VLAN and use VLAN tag six will see all traffic
transmitted through vlan0.
The same VLAN can be created at system startup time by placing the fol-
lowing in /etc/ifconfig.vlan0:
vlan 6 vlanif tlp0
The vlan device first appeared in NetBSD 1.5.1, and was derived from a
VLAN implementation that appeared in FreeBSD and OpenBSD.
The vlan interfaces do not currently inherit changes made to the physical
NetBSD 4.0 September 24, 2007 NetBSD 4.0