1.\" $NetBSD: vlan.4,v 1.29 2008/04/30 13:10:55 martin 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 September 24, 2007 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. 47This is particularly useful on routers or on hosts which must be 48connected to many different networks through a single physical interface. 49.Pp 50To use a 51.Nm vlan 52interface, the administrator must first create the interface and then 53specify the VID 54.Po 55.Tn VLAN 56identifier, the first 12 bits from a 16-bit integer which 57distinguishes each 58.Tn VLAN 59from any others 60.Pc 61and physical interface associated with the 62.Tn VLAN . 63This can be done by using the 64.Xr ifconfig 8 65.Ic create , 66.Ic vlan , 67and 68.Ic vlanif 69subcommands from a shell command line or script. 70From within a C program, use the 71.Xr ioctl 2 72system call with the 73.Dv SIOCSIFCREATE 74and 75.Dv SIOCSIFVLAN 76arguments. 77.Pp 78To be compatible with other 79.Tn IEEE 80802.1Q devices, the 81.Nm 82interface supports a 1500 byte 83.Tn MTU , 84which means that the parent interface will have to handle packets 85that are 4 bytes larger than the original 86.Tn Ethernet 87standard. 88Drivers supporting this increased 89.Tn MTU 90are: 91.Pp 92.Bl -dash -compact 93.It 94drivers using the DP8390 core 95.Po 96such as 97.Xr ec 4 , 98.Xr ne 4 , 99.Xr we 4 , 100and possibly others 101.Pc 102.It 103.Xr bge 4 104.It 105.Xr bnx 4 106.It 107.Xr ea 4 108.It 109.Xr eb 4 110.It 111.Xr epic 4 112.It 113.Xr ex 4 114.It 115.Xr fxp 4 116.It 117.Xr gem 4 118.It 119.Xr hme 4 120.It 121.Xr le 4 122.It 123.Xr sip 4 124.It 125.Xr ste 4 126.It 127.Xr stge 4 128.It 129.Xr ti 4 130.It 131.Xr tl 4 132.It 133.Xr tlp 4 134.It 135.Xr vge 4 136.It 137.Xr wm 4 138.It 139.Xr xi 4 140.El 141.Pp 142.Nm 143can be used with devices not supporting the 144.Tn IEEE 145802.1Q 146.Tn MTU , 147but then the 148.Tn MTU 149of the 150.Nm 151interface will be 4 bytes too small and will not interoperate 152properly with other 153.Tn IEEE 154802.1Q devices, unless the 155.Tn MTU 156of the other hosts on the 157.Tn VLAN 158are also lowered to match. 159.Sh EXAMPLES 160The following will create interface 161.Sy vlan0 162with VID six, on the 163.Tn Ethernet 164interface 165.Sy tlp0 : 166.Bd -literal -offset indent 167ifconfig vlan0 create 168ifconfig vlan0 vlan 6 vlanif tlp0 169.Ed 170.Pp 171After this set up, 172.Tn IP 173addresses (and/or other protocols) can be assigned to the 174.Sy vlan0 175interface. 176All other hosts on the 177.Tn Ethernet 178connected to 179.Sy tlp0 180which configure a 181.Tn VLAN 182and use VID six will see all traffic transmitted through 183.Sy vlan0 . 184.Pp 185The same 186.Tn VLAN 187can be created at system startup time 188by placing the following in 189.Pa /etc/ifconfig.vlan0 : 190.Bd -literal -offset indent 191create 192vlan 6 vlanif tlp0 193.Ed 194.Sh SEE ALSO 195.Xr ifconfig 8 196.Sh HISTORY 197The 198.Nm 199device first appeared in 200.Nx 1.5.1 , 201and was derived from a 202.Tn VLAN 203implementation that appeared in 204.Fx 205and 206.Ox . 207.Sh BUGS 208The 209.Nm 210interfaces do not currently inherit changes made to the physical 211interfaces' 212.Tn MTU . 213