179458d0bSYaroslav Tykhiy.\" 279458d0bSYaroslav Tykhiy.\" Copyright (c) 2001 Yar Tikhiy 379458d0bSYaroslav Tykhiy.\" All rights reserved. 479458d0bSYaroslav Tykhiy.\" 579458d0bSYaroslav Tykhiy.\" Redistribution and use in source and binary forms, with or without 679458d0bSYaroslav Tykhiy.\" modification, are permitted provided that the following conditions 779458d0bSYaroslav Tykhiy.\" are met: 879458d0bSYaroslav Tykhiy.\" 1. Redistributions of source code must retain the above copyright 979458d0bSYaroslav Tykhiy.\" notice, this list of conditions and the following disclaimer. 1079458d0bSYaroslav Tykhiy.\" 2. Redistributions in binary form must reproduce the above copyright 1179458d0bSYaroslav Tykhiy.\" notice, this list of conditions and the following disclaimer in the 1279458d0bSYaroslav Tykhiy.\" documentation and/or other materials provided with the distribution. 1379458d0bSYaroslav Tykhiy.\" 1479458d0bSYaroslav Tykhiy.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1579458d0bSYaroslav Tykhiy.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1679458d0bSYaroslav Tykhiy.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1779458d0bSYaroslav Tykhiy.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1879458d0bSYaroslav Tykhiy.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1979458d0bSYaroslav Tykhiy.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2079458d0bSYaroslav Tykhiy.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2179458d0bSYaroslav Tykhiy.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2279458d0bSYaroslav Tykhiy.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2379458d0bSYaroslav Tykhiy.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2479458d0bSYaroslav Tykhiy.\" SUCH DAMAGE. 2579458d0bSYaroslav Tykhiy.\" 2623af96adSMarius Strobl.Dd December 26, 2020 2779458d0bSYaroslav Tykhiy.Dt VLAN 4 2879458d0bSYaroslav Tykhiy.Os 2979458d0bSYaroslav Tykhiy.Sh NAME 3079458d0bSYaroslav Tykhiy.Nm vlan 3186e3186eSTom Rhodes.Nd "IEEE 802.1Q VLAN network interface" 3279458d0bSYaroslav Tykhiy.Sh SYNOPSIS 3316d78bb8STom RhodesTo compile this driver into the kernel, 3400a58aedSWarren Blockplace the following line in your 3590296834STom Rhodeskernel configuration file: 3686e3186eSTom Rhodes.Bd -ragged -offset indent 3786e3186eSTom Rhodes.Cd "device vlan" 3886e3186eSTom Rhodes.Ed 3986e3186eSTom Rhodes.Pp 4016d78bb8STom RhodesAlternatively, to load the driver as a 4116d78bb8STom Rhodesmodule at boot time, place the following line in 4286e3186eSTom Rhodes.Xr loader.conf 5 : 4386e3186eSTom Rhodes.Bd -literal -offset indent 4486e3186eSTom Rhodesif_vlan_load="YES" 4586e3186eSTom Rhodes.Ed 4679458d0bSYaroslav Tykhiy.Sh DESCRIPTION 4779458d0bSYaroslav TykhiyThe 4879458d0bSYaroslav Tykhiy.Nm 4979458d0bSYaroslav Tykhiydriver demultiplexes frames tagged according to 5079458d0bSYaroslav Tykhiythe IEEE 802.1Q standard into logical 5179458d0bSYaroslav Tykhiy.Nm 5279458d0bSYaroslav Tykhiynetwork interfaces, which allows routing/bridging between 5379458d0bSYaroslav Tykhiymultiple VLANs through a single switch trunk port. 5479458d0bSYaroslav Tykhiy.Pp 550d35b35aSBrooks DavisEach 560d35b35aSBrooks Davis.Nm 570d35b35aSBrooks Davisinterface is created at runtime using interface cloning. 580d35b35aSBrooks DavisThis is 590d35b35aSBrooks Davismost easily done with the 600d35b35aSBrooks Davis.Xr ifconfig 8 610d35b35aSBrooks Davis.Cm create 620d35b35aSBrooks Daviscommand or using the 630d35b35aSBrooks Davis.Va cloned_interfaces 640d35b35aSBrooks Davisvariable in 650d35b35aSBrooks Davis.Xr rc.conf 5 . 660d35b35aSBrooks Davis.Pp 6779458d0bSYaroslav TykhiyTo function, a 6879458d0bSYaroslav Tykhiy.Nm 6979458d0bSYaroslav Tykhiyinterface must be assigned a parent interface and 7079458d0bSYaroslav Tykhiynumeric VLAN tag using 7179458d0bSYaroslav Tykhiy.Xr ifconfig 8 . 7279458d0bSYaroslav TykhiyA single parent can be assigned to multiple 7379458d0bSYaroslav Tykhiy.Nm 7479458d0bSYaroslav Tykhiyinterfaces provided they have different tags. 75c5f116aaSChristian BruefferThe parent interface is likely to be an Ethernet card connected 7679458d0bSYaroslav Tykhiyto a properly configured switch port. 7779458d0bSYaroslav TykhiyThe VLAN tag should match one of those set up in the switched 7879458d0bSYaroslav Tykhiynetwork. 79f6e5e0adSYaroslav Tykhiy.Pp 80f6e5e0adSYaroslav Tykhiy.Nm 81161172e5SWarren Blockinitially assumes the same minimum length for tagged and untagged frames. 82161172e5SWarren BlockThis mode is selected by setting the 836572700eSYaroslav Tykhiy.Xr sysctl 8 84f6e5e0adSYaroslav Tykhiyvariable 85f6e5e0adSYaroslav Tykhiy.Va net.link.vlan.soft_pad 86161172e5SWarren Blockto 0 87161172e5SWarren Block.Pq default . 88161172e5SWarren BlockHowever, there are network devices that fail to adjust frame length 89161172e5SWarren Blockwhen it falls below the allowed minimum due to untagging. 90f6e5e0adSYaroslav TykhiySuch devices should be able to interoperate with 91f6e5e0adSYaroslav Tykhiy.Nm 92f6e5e0adSYaroslav Tykhiyafter changing the value of 93f6e5e0adSYaroslav Tykhiy.Va net.link.vlan.soft_pad 94f6e5e0adSYaroslav Tykhiyto 1. 95f6e5e0adSYaroslav TykhiyIn the latter mode, 96f6e5e0adSYaroslav Tykhiy.Nm 97f6e5e0adSYaroslav Tykhiywill pad short frames before tagging them 98161172e5SWarren Blockso that their length is not less than the minimum value 99f6e5e0adSYaroslav Tykhiyafter untagging by the non-compliant devices. 100f41b145cSYaroslav Tykhiy.Sh HARDWARE 10179458d0bSYaroslav TykhiyThe 10279458d0bSYaroslav Tykhiy.Nm 103f41b145cSYaroslav Tykhiydriver supports efficient operation over parent interfaces that can provide 104f41b145cSYaroslav Tykhiyhelp in processing VLANs. 105f41b145cSYaroslav TykhiySuch interfaces are automatically recognized by their capabilities. 106f41b145cSYaroslav TykhiyDepending on the level of sophistication found in a physical 107f41b145cSYaroslav Tykhiyinterface, it may do full VLAN processing or just be able to 10868721affSYaroslav Tykhiyreceive and transmit long frames (up to 1522 bytes including an Ethernet 10968721affSYaroslav Tykhiyheader and FCS). 110f41b145cSYaroslav TykhiyThe capabilities may be user-controlled by the respective parameters to 111f41b145cSYaroslav Tykhiy.Xr ifconfig 8 , 112161172e5SWarren Block.Cm vlanhwtag , 113f41b145cSYaroslav Tykhiyand 114f41b145cSYaroslav Tykhiy.Cm vlanmtu . 115f41b145cSYaroslav TykhiyHowever, a physical interface is not obliged to react to them: 116f41b145cSYaroslav TykhiyIt may have either capability enabled permanently without 117f41b145cSYaroslav Tykhiya way to turn it off. 118f41b145cSYaroslav TykhiyThe whole issue is very specific to a particular device and its driver. 119f41b145cSYaroslav Tykhiy.Pp 12000a58aedSWarren BlockAt present, these devices are capable of full VLAN processing 12100a58aedSWarren Blockin hardware: 122f7a029ebSStanislav Sedov.Xr ae 4 , 1237a0bde84SPyun YongHyeon.Xr age 4 , 124ff24f054SPyun YongHyeon.Xr alc 4 , 125cad7d367SPyun YongHyeon.Xr ale 4 , 126ae34b8fcSYaroslav Tykhiy.Xr bce 4 , 1272ba5fff2SYaroslav Tykhiy.Xr bge 4 , 1284e400768SDavid Christensen.Xr bxe 4 , 129ae34b8fcSYaroslav Tykhiy.Xr cxgb 4 , 13054e4ee71SNavdeep Parhar.Xr cxgbe 4 , 131a5a8905cSYaroslav Tykhiy.Xr em 4 , 1321f253c5dSPyun YongHyeon.Xr igb 4 , 133*cadb71e4SAlexander Ziaee.Xr ix 4 , 134629bf506SPyun YongHyeon.Xr jme 4 , 135f173c2b7SSean Bruno.Xr liquidio 4 , 1361f95590dSPyun YongHyeon.Xr msk 4 , 1371f253c5dSPyun YongHyeon.Xr mxge 4 , 13879458d0bSYaroslav Tykhiy.Xr nge 4 , 139d57916b1SYaroslav Tykhiy.Xr re 4 , 14053ac9f49SPyun YongHyeon.Xr sge 4 , 14197fe1b09SPyun YongHyeon.Xr stge 4 , 14279458d0bSYaroslav Tykhiy.Xr ti 4 , 14379458d0bSYaroslav Tykhiyand 144317bb722SYaroslav Tykhiy.Xr vge 4 . 14579458d0bSYaroslav Tykhiy.Pp 146161172e5SWarren BlockOther Ethernet interfaces can run VLANs using software emulation in the 14779458d0bSYaroslav Tykhiy.Nm 14879458d0bSYaroslav Tykhiydriver. 149161172e5SWarren BlockHowever, some lack the capability 15068721affSYaroslav Tykhiyof transmitting and receiving long frames. 151f41b145cSYaroslav TykhiyAssigning such an interface as the parent to 152f41b145cSYaroslav Tykhiy.Nm 153f41b145cSYaroslav Tykhiywill result in a reduced MTU on the corresponding 15479458d0bSYaroslav Tykhiy.Nm 15579458d0bSYaroslav Tykhiyinterfaces. 15679458d0bSYaroslav TykhiyIn the modern Internet, this is likely to cause 15779458d0bSYaroslav Tykhiy.Xr tcp 4 15879458d0bSYaroslav Tykhiyconnectivity problems due to massive, inadequate 15979458d0bSYaroslav Tykhiy.Xr icmp 4 16079458d0bSYaroslav Tykhiyfiltering that breaks the Path MTU Discovery mechanism. 16179458d0bSYaroslav Tykhiy.Pp 162161172e5SWarren BlockThese interfaces natively support long frames for 163161172e5SWarren Block.Nm : 164bc96a575SPyun YongHyeon.Xr axe 4 , 16566d204f8SYaroslav Tykhiy.Xr bfe 4 , 1667cd038bcSMarius Strobl.Xr cas 4 , 16766d204f8SYaroslav Tykhiy.Xr dc 4 , 1681f253c5dSPyun YongHyeon.Xr et 4 , 169ae34b8fcSYaroslav Tykhiy.Xr fwe 4 , 17066d204f8SYaroslav Tykhiy.Xr fxp 4 , 17166d204f8SYaroslav Tykhiy.Xr gem 4 , 17266d204f8SYaroslav Tykhiy.Xr le 4 , 173ae34b8fcSYaroslav Tykhiy.Xr nfe 4 , 17466d204f8SYaroslav Tykhiy.Xr rl 4 , 17566d204f8SYaroslav Tykhiy.Xr sis 4 , 17666d204f8SYaroslav Tykhiy.Xr sk 4 , 17766d204f8SYaroslav Tykhiy.Xr ste 4 , 17866d204f8SYaroslav Tykhiy.Xr vr 4 , 179bb0667afSPyun YongHyeon.Xr vte 4 , 18066d204f8SYaroslav Tykhiyand 18166d204f8SYaroslav Tykhiy.Xr xl 4 . 18272ddf849SRuslan Ermilov.Pp 183a5eb8d53SSam LefflerThe 18479458d0bSYaroslav Tykhiy.Nm 18568721affSYaroslav Tykhiydriver automatically recognizes devices that natively support long frames 186a5eb8d53SSam Lefflerfor 18779458d0bSYaroslav Tykhiy.Nm 188a5eb8d53SSam Leffleruse and calculates the appropriate frame MTU based on the 189a5eb8d53SSam Lefflercapabilities of the parent interface. 19068721affSYaroslav TykhiySome other interfaces not listed above may handle long frames, 19100a58aedSWarren Blockbut they do not advertise this ability. 192f41b145cSYaroslav TykhiyThe MTU setting on 193f41b145cSYaroslav Tykhiy.Nm 19466d204f8SYaroslav Tykhiycan be corrected manually if used in conjunction with such a parent interface. 19519e1bfc7SYaroslav Tykhiy.Sh SEE ALSO 196f6e5e0adSYaroslav Tykhiy.Xr ifconfig 8 , 197f6e5e0adSYaroslav Tykhiy.Xr sysctl 8 198