To use a
vlan
interface, the administrator must first create the interface and then
specify the VID
the first 12 bits from a 16-bit integer which distinguishes each
VLAN from any oth-
ers
(VLAN identifier,)
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 program, use the
ioctl(2)
system call with the
SIOCSIFCREATE
and
SIOCSIFVLAN
arguments.
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. Drivers supporting this increased MTU are:
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.
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