xref: /netbsd-src/share/man/man4/vlan.4 (revision ce18feac4c83f37fc3db8a2fc19bb10d5f6675af)
1.\"	$NetBSD: vlan.4,v 1.35 2017/05/29 03:41:53 ozaki-r Exp $
2.\"
3.\" Copyright (c) 2000, 2015 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe of Zembu Labs, Inc.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd May 29, 2017
31.Dt VLAN 4
32.Os
33.Sh NAME
34.Nm vlan
35.Nd IEEE 802.1Q Virtual LAN network device
36.Sh SYNOPSIS
37.Cd "pseudo-device vlan"
38.Sh DESCRIPTION
39The
40.Nm
41interface provides support for
42.Tn IEEE
43802.1Q Virtual Local Area Networks
44.Pq Tn VLAN .
45This supports the
46trunking of more than one network on a single network interface by using
47802.1Q tagged and untagged frames.
48.Pp
49To use a
50.Nm vlan
51interface, the administrator must first create the interface and then
52specify the VID
53.Po
54.Tn VLAN
55identifier, the first 12 bits from a 16-bit integer which
56distinguishes each
57.Tn VLAN
58from any others
59.Pc
60and
61.Pq parent
62physical interface associated with the
63.Tn VLAN .
64This can be done by using the
65.Xr ifconfig 8
66.Ic create ,
67.Ic vlan ,
68and
69.Ic vlanif
70subcommands from a shell command line or script.
71From within a C program, use the
72.Xr ioctl 2
73system call with the
74.Dv SIOCSIFCREATE
75and
76.Dv SIOCSIFVLAN
77arguments.
78.Pp
79Packets sent through a
80.Nm
81interface are tagged with the VID and passed to the parent interface for
82transmission.
83Tagged packets received on the parent interface are passed to the
84.Nm
85interface with the corresponding VID associated with the parent interface.
86Packets sent directly through the parent interface are transmitted as
87untagged frames.
88Untagged frames received on the parent interface are handled by the
89parent interface.
90Tagged frames received on the parent interface with a VID of 0 and an
91EtherType of IP or IPv6 are processed on the parent interface.
92Tagged frames received on the parent interface for which no
93.Nm
94interface with a matching VID exists are dropped and counted as
95.Dq unknown protocol .
96.Po
97These are displayed by the
98.Xr ifconfig 8
99.Fl v
100option.
101.Pc
102.Pp
103If the
104.Nm
105pseudo-device is not configured in the kernel only packets tagged with a
106VID of 0 are processed.
107.Pp
108To be compatible with other
109.Tn IEEE
110802.1Q devices, the
111.Nm
112interface supports a 1500 byte
113.Tn MTU ,
114which means that the parent interface will have to handle packets
115that are 4 bytes larger than the original
116.Tn Ethernet
117standard.
118.Pp
119.Nm
120can be used with devices not supporting the
121.Tn IEEE
122802.1Q
123.Tn MTU ,
124but then the
125.Tn MTU
126of the
127.Nm
128interface will be 4 bytes too small and will not interoperate
129properly with other
130.Tn IEEE
131802.1Q devices, unless the
132.Tn MTU
133of the other hosts on the
134.Tn VLAN
135are also lowered to match.
136.Sh EXAMPLES
137The following will create interface
138.Sy vlan0
139with VID six, on the
140.Tn Ethernet
141interface
142.Sy tlp0 :
143.Bd -literal -offset indent
144ifconfig vlan0 create
145ifconfig vlan0 vlan 6 vlanif tlp0
146.Ed
147.Pp
148After this set up,
149.Tn IP
150addresses (and/or other protocols) can be assigned to the
151.Sy vlan0
152interface.
153All other hosts on the
154.Tn Ethernet
155connected to
156.Sy tlp0
157which configure a
158.Tn VLAN
159and use VID six will see all traffic transmitted through
160.Sy vlan0 .
161.Pp
162The same
163.Tn VLAN
164can be created at system startup time
165by placing the following in
166.Pa /etc/ifconfig.vlan0 :
167.Bd -literal -offset indent
168create
169vlan 6 vlanif tlp0
170.Ed
171.Sh SEE ALSO
172.Xr bridge 4 ,
173.Xr ifconfig 8
174.Sh HISTORY
175The
176.Nm
177device first appeared in
178.Nx 1.5.1 ,
179and was derived from a
180.Tn VLAN
181implementation that appeared in
182.Fx
183and
184.Ox .
185.Sh BUGS
186The
187.Nm
188interfaces do not currently inherit changes made to the physical
189interfaces'
190.Tn MTU .
191