xref: /freebsd/share/man/man4/vlan.4 (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1.\"
2.\" Copyright (c) 2001 Yar Tikhiy
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd December 26, 2020
27.Dt VLAN 4
28.Os
29.Sh NAME
30.Nm vlan
31.Nd "IEEE 802.1Q VLAN network interface"
32.Sh SYNOPSIS
33To compile this driver into the kernel,
34place the following line in your
35kernel configuration file:
36.Bd -ragged -offset indent
37.Cd "device vlan"
38.Ed
39.Pp
40Alternatively, to load the driver as a
41module at boot time, place the following line in
42.Xr loader.conf 5 :
43.Bd -literal -offset indent
44if_vlan_load="YES"
45.Ed
46.Sh DESCRIPTION
47The
48.Nm
49driver demultiplexes frames tagged according to
50the IEEE 802.1Q standard into logical
51.Nm
52network interfaces, which allows routing/bridging between
53multiple VLANs through a single switch trunk port.
54.Pp
55Each
56.Nm
57interface is created at runtime using interface cloning.
58This is
59most easily done with the
60.Xr ifconfig 8
61.Cm create
62command or using the
63.Va cloned_interfaces
64variable in
65.Xr rc.conf 5 .
66.Pp
67To function, a
68.Nm
69interface must be assigned a parent interface and
70numeric VLAN tag using
71.Xr ifconfig 8 .
72A single parent can be assigned to multiple
73.Nm
74interfaces provided they have different tags.
75The parent interface is likely to be an Ethernet card connected
76to a properly configured switch port.
77The VLAN tag should match one of those set up in the switched
78network.
79.Pp
80.Nm
81initially assumes the same minimum length for tagged and untagged frames.
82This mode is selected by setting the
83.Xr sysctl 8
84variable
85.Va net.link.vlan.soft_pad
86to 0
87.Pq default .
88However, there are network devices that fail to adjust frame length
89when it falls below the allowed minimum due to untagging.
90Such devices should be able to interoperate with
91.Nm
92after changing the value of
93.Va net.link.vlan.soft_pad
94to 1.
95In the latter mode,
96.Nm
97will pad short frames before tagging them
98so that their length is not less than the minimum value
99after untagging by the non-compliant devices.
100.Sh HARDWARE
101The
102.Nm
103driver supports efficient operation over parent interfaces that can provide
104help in processing VLANs.
105Such interfaces are automatically recognized by their capabilities.
106Depending on the level of sophistication found in a physical
107interface, it may do full VLAN processing or just be able to
108receive and transmit long frames (up to 1522 bytes including an Ethernet
109header and FCS).
110The capabilities may be user-controlled by the respective parameters to
111.Xr ifconfig 8 ,
112.Cm vlanhwtag ,
113and
114.Cm vlanmtu .
115However, a physical interface is not obliged to react to them:
116It may have either capability enabled permanently without
117a way to turn it off.
118The whole issue is very specific to a particular device and its driver.
119.Pp
120At present, these devices are capable of full VLAN processing
121in hardware:
122.Xr ae 4 ,
123.Xr age 4 ,
124.Xr alc 4 ,
125.Xr ale 4 ,
126.Xr bce 4 ,
127.Xr bge 4 ,
128.Xr bxe 4 ,
129.Xr cxgb 4 ,
130.Xr cxgbe 4 ,
131.Xr em 4 ,
132.Xr igb 4 ,
133.Xr ixgbe 4 ,
134.Xr jme 4 ,
135.Xr liquidio 4 ,
136.Xr msk 4 ,
137.Xr mxge 4 ,
138.Xr nge 4 ,
139.Xr re 4 ,
140.Xr sge 4 ,
141.Xr stge 4 ,
142.Xr ti 4 ,
143and
144.Xr vge 4 .
145.Pp
146Other Ethernet interfaces can run VLANs using software emulation in the
147.Nm
148driver.
149However, some lack the capability
150of transmitting and receiving long frames.
151Assigning such an interface as the parent to
152.Nm
153will result in a reduced MTU on the corresponding
154.Nm
155interfaces.
156In the modern Internet, this is likely to cause
157.Xr tcp 4
158connectivity problems due to massive, inadequate
159.Xr icmp 4
160filtering that breaks the Path MTU Discovery mechanism.
161.Pp
162These interfaces natively support long frames for
163.Nm :
164.Xr axe 4 ,
165.Xr bfe 4 ,
166.Xr cas 4 ,
167.Xr dc 4 ,
168.Xr et 4 ,
169.Xr fwe 4 ,
170.Xr fxp 4 ,
171.Xr gem 4 ,
172.Xr le 4 ,
173.Xr nfe 4 ,
174.Xr rl 4 ,
175.Xr sis 4 ,
176.Xr sk 4 ,
177.Xr ste 4 ,
178.Xr vr 4 ,
179.Xr vte 4 ,
180and
181.Xr xl 4 .
182.Pp
183The
184.Nm
185driver automatically recognizes devices that natively support long frames
186for
187.Nm
188use and calculates the appropriate frame MTU based on the
189capabilities of the parent interface.
190Some other interfaces not listed above may handle long frames,
191but they do not advertise this ability.
192The MTU setting on
193.Nm
194can be corrected manually if used in conjunction with such a parent interface.
195.Sh SEE ALSO
196.Xr ifconfig 8 ,
197.Xr sysctl 8
198