1.\" $NetBSD: vlan.4,v 1.24 2003/05/07 16:49:59 jwise 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 May 6, 2003 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 61.Tn VLAN 62tag 63.Po 64a 16-bit integer which distinguishes 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 ea 4 113.It 114.Xr eb 4 115.It 116.Xr epic 4 117.It 118.Xr ex 4 119.It 120.Xr fxp 4 121.It 122.Xr gem 4 123.It 124.Xr hme 4 125.It 126.Xr le 4 127.It 128.Xr sip 4 129.It 130.Xr ste 4 131.It 132.Xr stge 4 133.It 134.Xr ti 4 135.It 136.Xr tl 4 137.It 138.Xr tlp 4 139.It 140.Xr wm 4 141.It 142.Xr xi 4 143.El 144.Pp 145.Nm 146can be used with devices not supporting the 147.Tn IEEE 148802.1Q 149.Tn MTU , 150but then the 151.Tn MTU 152of the 153.Nm 154interface will be 4 bytes too small and will not interoperate 155properly with other 156.Tn IEEE 157802.1Q devices, unless the 158.Tn MTU 159of the other hosts on the 160.Tn VLAN 161are also lowered to match. 162.Sh EXAMPLES 163The following will create interface 164.Sy vlan0 165with 166.Tn VLAN 167tag six, on the 168.Tn Ethernet 169interface 170.Sy tlp0 : 171.Bd -literal -offset indent 172ifconfig vlan0 create 173ifconfig vlan0 vlan 6 vlanif tlp0 174.Ed 175.Pp 176After this set up, 177.Tn IP 178addresses (and/or other protocols) can be assigned to the 179.Sy vlan0 180interface. 181All other hosts on the 182.Tn Ethernet 183connected to 184.Sy tlp0 185which configure a 186.Tn VLAN 187and use 188.Tn VLAN 189tag 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 . 208.Sh AUTHORS 209The 210.Nm 211driver was integrated by 212.An Andrew Doran 213.Aq ad@NetBSD.org 214and 215.An Jason R. Thorpe 216.Aq thorpej@zembu.com . 217It was derived from a 218.Tn VLAN 219implementation that appeared in 220.Fx 221and 222.Ox . 223.Sh BUGS 224The 225.Nm 226interfaces do not currently inherit changes made to the physical 227interfaces' 228.Tn MTU . 229