1.\" $NetBSD: vlan.4,v 1.28 2007/09/24 08:30:50 martti 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.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.Dd September 24, 2007 38.Dt VLAN 4 39.Os 40.Sh NAME 41.Nm vlan 42.Nd IEEE 802.1Q Virtual LAN network device 43.Sh SYNOPSIS 44.Cd "pseudo-device vlan" 45.Sh DESCRIPTION 46The 47.Nm 48interface provides support for 49.Tn IEEE 50802.1Q Virtual Local Area Networks 51.Pq Tn VLAN . 52This supports the 53trunking of more than one network on a single network interface. 54This is particularly useful on routers or on hosts which must be 55connected to many different networks through a single physical interface. 56.Pp 57To use a 58.Nm vlan 59interface, the administrator must first create the interface and then 60specify the VID 61.Po 62.Tn VLAN 63identifier, the first 12 bits from a 16-bit integer which 64distinguishes each 65.Tn VLAN 66from any others 67.Pc 68and physical interface associated with the 69.Tn VLAN . 70This can be done by using the 71.Xr ifconfig 8 72.Ic create , 73.Ic vlan , 74and 75.Ic vlanif 76subcommands from a shell command line or script. 77From within a C program, use the 78.Xr ioctl 2 79system call with the 80.Dv SIOCSIFCREATE 81and 82.Dv SIOCSIFVLAN 83arguments. 84.Pp 85To be compatible with other 86.Tn IEEE 87802.1Q devices, the 88.Nm 89interface supports a 1500 byte 90.Tn MTU , 91which means that the parent interface will have to handle packets 92that are 4 bytes larger than the original 93.Tn Ethernet 94standard. 95Drivers supporting this increased 96.Tn MTU 97are: 98.Pp 99.Bl -dash -compact 100.It 101drivers using the DP8390 core 102.Po 103such as 104.Xr ec 4 , 105.Xr ne 4 , 106.Xr we 4 , 107and possibly others 108.Pc 109.It 110.Xr bge 4 111.It 112.Xr bnx 4 113.It 114.Xr ea 4 115.It 116.Xr eb 4 117.It 118.Xr epic 4 119.It 120.Xr ex 4 121.It 122.Xr fxp 4 123.It 124.Xr gem 4 125.It 126.Xr hme 4 127.It 128.Xr le 4 129.It 130.Xr sip 4 131.It 132.Xr ste 4 133.It 134.Xr stge 4 135.It 136.Xr ti 4 137.It 138.Xr tl 4 139.It 140.Xr tlp 4 141.It 142.Xr vge 4 143.It 144.Xr wm 4 145.It 146.Xr xi 4 147.El 148.Pp 149.Nm 150can be used with devices not supporting the 151.Tn IEEE 152802.1Q 153.Tn MTU , 154but then the 155.Tn MTU 156of the 157.Nm 158interface will be 4 bytes too small and will not interoperate 159properly with other 160.Tn IEEE 161802.1Q devices, unless the 162.Tn MTU 163of the other hosts on the 164.Tn VLAN 165are also lowered to match. 166.Sh EXAMPLES 167The following will create interface 168.Sy vlan0 169with VID six, on the 170.Tn Ethernet 171interface 172.Sy tlp0 : 173.Bd -literal -offset indent 174ifconfig vlan0 create 175ifconfig vlan0 vlan 6 vlanif tlp0 176.Ed 177.Pp 178After this set up, 179.Tn IP 180addresses (and/or other protocols) can be assigned to the 181.Sy vlan0 182interface. 183All other hosts on the 184.Tn Ethernet 185connected to 186.Sy tlp0 187which configure a 188.Tn VLAN 189and use VID six will see all traffic transmitted through 190.Sy vlan0 . 191.Pp 192The same 193.Tn VLAN 194can be created at system startup time 195by placing the following in 196.Pa /etc/ifconfig.vlan0 : 197.Bd -literal -offset indent 198create 199vlan 6 vlanif tlp0 200.Ed 201.Sh SEE ALSO 202.Xr ifconfig 8 203.Sh HISTORY 204The 205.Nm 206device first appeared in 207.Nx 1.5.1 , 208and was derived from a 209.Tn VLAN 210implementation that appeared in 211.Fx 212and 213.Ox . 214.Sh BUGS 215The 216.Nm 217interfaces do not currently inherit changes made to the physical 218interfaces' 219.Tn MTU . 220