xref: /openbsd-src/share/man/man4/vlan.4 (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1.\" $OpenBSD: vlan.4,v 1.44 2016/04/28 21:32:11 dlg Exp $
2.\"
3.\" Copyright (c) 2000 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 $Mdocdate: April 28 2016 $
31.Dt VLAN 4
32.Os
33.Sh NAME
34.Nm vlan ,
35.Nm svlan
36.Nd IEEE 802.1Q/1AD pseudo-device
37.Sh SYNOPSIS
38.Cd "pseudo-device vlan"
39.Sh DESCRIPTION
40The
41.Nm vlan
42driver provides network interfaces supporting Virtual Local Area
43Networks (VLANs) on Ethernet networks.
44.Nm vlan
45interfaces implement virtual networks using the IEEE 802.1q protocol.
46.Nm svlan
47interfaces implement virtual networks using the IEEE 802.1ad protocol.
48.Pp
49.Nm svlan
50interfaces allow construction of IEEE 802.1ad-compliant provider bridges.
51.Nm vlan
52and
53.Nm svlan
54interfaces can be configured to provide QinQ or stacked VLANs.
55.Pp
56The interfaces can be created at runtime using the
57.Ic ifconfig vlan Ns Ar N Ic create
58command or by setting up a
59.Xr hostname.if 5
60configuration file for
61.Xr netstart 8 .
62The interface itself can be configured with
63.Xr ifconfig 8 ;
64see its manual page for more information.
65.Pp
66.Nm vlan
67and
68.Nm svlan
69interfaces must be configured with a parent Ethernet interface to
70operate, and a virtual network identifier.
71Packets transmitted through a
72.Nm vlan
73or
74.Nm svlan
75interface will be encapsulated in their respective protocols and
76transmitted on the specified physical interface.
77802.1q and 802.1ad packets received on the parent interface will be
78matched to the
79.Nm vlan
80and
81.Nm svlan
82interfaces by their respective protocol and virtual network
83identifiers, and decapsulated for reception on the associated virtual
84interfaces.
85.Pp
86The 802.1q and 802.1ad protocols include a priority field which may
87be altered via
88.Xr pf.conf 5 ;
89see the
90.Cm prio
91option for more information.
92.Pp
93.Nm vlan
94and
95.Nm svlan
96interfaces support the following
97.Xr ioctl 2 Ns s :
98.Bl -tag -width indent -offset 3n
99.It Dv SIOCSIFPARENT Fa "struct if_parent *"
100Set the parent interface.
101The parent may only be configured while the virtual interface is
102administratively down.
103.It Dv SIOCGIFPARENT Fa "struct if_parent *"
104Get the currently configured parent interface.
105.It Dv SIOCDIFPARENT Fa "struct ifreq *"
106Delete the parent interface configuration.
107The parent may only be removed while the virtual interface is
108administratively down.
109.It Dv SIOCSVNETID Fa "struct ifreq *"
110Set the virtual network identifier.
111Valid identifiers are in the range 1 to 4095.
112.It Dv SIOCGVNETID Fa "struct if_parent *"
113Get the currently configured virtual network identifier.
114.It Dv SIOCDVNETID Fa "struct ifreq *"
115Clear the current virtual network identifier.
116Virtual interfaces without a configured virtual network identifier
117will use 0 in their protocols tag field.
118.It Dv SIOCSIFLLADDR Fa "struct ifreq *"
119Configure a custom MAC address on the virtual interface.
120When the virtual interface is using a custom MAC address the parent
121interface will be configured to promiscuously receive packets.
122When operating without a custom MAC address the virtual interface
123will inherit the parent interfaces MAC address.
124Configuring 00:00:00:00:00:00 as the MAC address will clear the
125custom MAC address configuration and resume operation with the
126parents MAC address.
127.El
128.Pp
129.Nm vlan
130and
131.Nm svlan
132interfaces use the following capability on parent interfaces:
133.Bl -tag -width "IFCAP_VLAN_HWTAGGING" -offset 3n
134.It IFCAP_VLAN_MTU
135The parent interface can handle full sized frames, plus the size
136of the vlan tag.
137.El
138.Pp
139.Nm vlan
140interfaces use the following capability on parent interfaces:
141.Bl -tag -width "IFCAP_VLAN_HWTAGGING" -offset 3n
142.It IFCAP_VLAN_HWTAGGING
143The parent interface will offload the encapsulation and decapsulation
144of 802.1q frames.
145.El
146.Sh EXAMPLES
147Create an 802.1q virtual interface on top of the physical interface
148em0, with virtual network identifier 5:
149.Bd -literal -offset indent
150# ifconfig vlan0 create
151# ifconfig vlan0 parent em0 vnetid 5
152# ifconfig vlan0 10.1.1.100/24
153.Ed
154.Pp
155Create an 802.1q VLAN interface on network 10, on top of an 802.1ad
156provider bridge on network 8, on top of the physical interface bge0:
157.Bd -literal -offset indent
158# ifconfig svlan0 create
159# ifconfig svlan0 parent bge0 vnetid 8
160# ifconfig svlan0 up
161# ifconfig vlan0 create
162# ifconfig vlan0 parent svlan0 vnetid 10
163# ifconfig vlan0 10.1.1.101/24
164.Ed
165.Pp
166Configure an 802.1q VLAN interface with a custom MAC address:
167.Bd -literal -offset indent
168# ifconfig vlan0 lladdr fe:e1:ba:d0:84:0e
169.Ed
170.Pp
171Remove a custom MAC address from an 802.1q VLAN interface:
172.Bd -literal -offset indent
173# ifconfig vlan0 lladdr 00:00:00:00:00:00
174.Ed
175.Sh SEE ALSO
176.Xr inet 4 ,
177.Xr ip 4 ,
178.Xr netintro 4 ,
179.Xr hostname.if 5 ,
180.Xr pf.conf 5 ,
181.Xr ifconfig 8 ,
182.Xr netstart 8
183.Rs
184.%T IEEE 802.1q standard
185.%U http://standards.ieee.org/getieee802/802.1.html
186.Re
187.Rs
188.%Q Provider Bridges, QinQ
189.%T IEEE 802.1ad standard
190.Re
191.Sh AUTHORS
192Originally
193.An Garrett Wollman Aq Mt wollman@freebsd.org .
194.Sh CAVEATS
195Some Ethernet chips will either discard or truncate
196Ethernet frames that are larger than 1514 bytes.
197This causes a problem as 802.1Q tagged frames can be up to 1518 bytes.
198Most controller chips can be told not to discard large frames
199and/or to increase the allowed frame size.
200