Updated: 2022/Sep/29
Please read Privacy Policy. It's for your privacy.
VLAN(4) Device Drivers Manual VLAN(4)
NAME
vlan - IEEE 802.1Q Virtual LAN network device
SYNOPSIS
pseudo-device vlan
DESCRIPTION
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 by using 802.1Q tagged and untagged frames.
To use a vlan interface, the administrator must first create the
interface and then specify the VID (VLAN identifier, the first 12 bits
from a 16-bit integer which distinguishes each VLAN from any others) and
(parent) 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 program, use the ioctl(2)
system call with the SIOCSIFCREATE and SIOCSIFVLAN arguments.
Packets sent through a vlan interface are tagged with the VID and passed
to the parent interface for transmission. Tagged packets received on the
parent interface are passed to the vlan interface with the corresponding
VID associated with the parent interface. Packets sent directly through
the parent interface are transmitted as untagged frames. Untagged frames
received on the parent interface are handled by the parent interface.
Tagged frames received on the parent interface with a VID of 0 and an
EtherType of IP or IPv6 are processed on the parent interface. Tagged
frames received on the parent interface for which no vlan interface with
a matching VID exists are dropped and counted as "unknown protocol".
(These are displayed by the ifconfig(8) -v option.)
If the vlan pseudo-device is not configured in the kernel only packets
tagged with a VID of 0 are processed.
To be compatible with other IEEE 802.1Q devices, the vlan interface
supports a 1500 byte MTU, which means that the parent interface will have
to handle packets that are 4 bytes larger than the original Ethernet
standard.
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.
EXAMPLES
The following will create interface vlan0 with VID 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 VID six will see all traffic
transmitted through vlan0.
The same VLAN can be created at system startup time by placing the
following in /etc/ifconfig.vlan0:
create
vlan 6 vlanif tlp0
SEE ALSO
bridge(4), ifconfig(8)
HISTORY
The vlan device first appeared in NetBSD 1.5.1, and was derived from a
VLAN implementation that appeared in FreeBSD and OpenBSD.
BUGS
The vlan interfaces do not currently inherit changes made to the physical
interfaces' MTU.
NetBSD 10.99 May 29, 2017 NetBSD 10.99