1.\" $NetBSD: l2tp.4,v 1.4 2018/08/14 06:26:52 wiz Exp $ 2.\" 3.\" Copyright (C) 2017 Internet Initiative Japan Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the project nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.Dd August 14, 2018 31.Dt L2TP 4 32.Os 33.Sh NAME 34.Nm l2tp 35.Nd layer two tunneling protocol version 3 36.Sh SYNOPSIS 37.Cd "pseudo-device l2tp" 38.Sh DESCRIPTION 39The 40.Nm 41interface implements version 3 of the Layer Two Tunneling Protocol (L2TPv3). 42It can tunnel layer 2 protocol traffic over IPv4 or IPv6, as specified in 43.Li RFC3931 . 44.Pp 45The L2TPv3 protocol is comprised of two types of messages: control messages 46and data messages. 47Control messages are used in the establishment, 48maintenace, and clearing of control connections and sessions. 49The 50.Nm 51interface can send control messages and data messages; furthermore 52the management of control messages is entrusted to userland daemon. 53Without a management daemon, the 54.Nm 55interface can send data messages using the 56.Xr ifconfig 8 57.Cm tunnel 58and 59.Cm session 60subcommands, or the 61.Dv SIOCSIFPHYADDR 62and 63.Dv SIOCSL2TPSESSION 64ioctls. 65Additionally, it can use cookies specified in 66.Li RFC3931 67by using the 68.Xr ifconfig 8 69.Cm cookie 70subcommand, or the 71.Dv SIOCSL2TPCOOKIE 72ioctl. 73.Ss Packet format 74Layer 2 frames are prepended with a L2TPv3 header as described by 75RFC 3931. 76The resulting L2TPv3 packets will be encapsulated in an outer packet, 77which may be either an IPv4 or IPv6 packet, with IP protocol number 115. 78.Sh EXAMPLES 79Configuration example: 80.Bd -literal 81wm0 = 192.168.0.1/24 wm0 = 192.168.0.2/24 82 83+------------+ +------------+ 84| NetBSD_A | | NetBSD_B | 85|------------| |------------| 86| [l2tp0] - - - - - - - - (tunnel) - - - - - - - - [l2tp0] | 87| [wm0]------------- ... --------------[wm0] | 88| | | | 89+---[wm1]----+ +----[wm1]---+ 90 | | 91 | | 92+------------+ +------------+ 93| Host_X | | Host_Y | 94+------------+ +------------+ 95.Ed 96.Ss Configuration example without cookies 97On NetBSD_A: 98.Bd -literal 99# ifconfig wm0 inet 192.168.0.1/24 100# ifconfig l2tp0 create 101# ifconfig l2tp0 tunnel 192.168.0.1 192.168.0.2 102# ifconfig l2tp0 session 1234 4321 103# ifconfig bridge0 create 104# brconfig bridge0 add wm1 105# brconfig bridge0 add l2tp0 106# ifconfig l2tp0 up 107# ifconfig wm1 up 108# ifconfig bridge0 up 109.Ed 110.Pp 111On NetBSD_B: 112.Bd -literal 113# ifconfig wm0 inet 192.168.0.2/24 114# ifconfig l2tp0 create 115# ifconfig l2tp0 tunnel 192.168.0.2 192.168.0.1 116# ifconfig l2tp0 session 4321 1234 117# ifconfig bridge0 create 118# brconfig bridge0 add wm1 119# brconfig bridge0 add l2tp0 120# ifconfig l2tp0 up 121# ifconfig wm1 up 122# ifconfig bridge0 up 123.Ed 124.Ss Configuration example with cookies 125On NetBSD_A: 126.Bd -literal 127# ifconfig wm0 inet 192.168.0.1/24 128# ifconfig l2tp0 create 129# ifconfig l2tp0 tunnel 192.168.0.1 192.168.0.2 130# ifconfig l2tp0 session 1234 4321 131# ifconfig l2tp0 cookie 4 12345 4 54321 132# ifconfig bridge0 create 133# brconfig bridge0 add wm1 134# brconfig bridge0 add l2tp0 135# ifconfig l2tp0 up 136# ifconfig wm1 up 137# ifconfig bridge0 up 138.Ed 139.Pp 140On NetBSD_B: 141.Bd -literal 142# ifconfig wm0 inet 192.168.0.2/24 143# ifconfig l2tp0 create 144# ifconfig l2tp0 tunnel 192.168.0.2 192.168.0.1 145# ifconfig l2tp0 session 4321 1234 146# ifconfig l2tp0 cookie 4 54321 4 12345 147# ifconfig bridge0 create 148# brconfig bridge0 add wm1 149# brconfig bridge0 add l2tp0 150# ifconfig l2tp0 up 151# ifconfig wm1 up 152# ifconfig bridge0 up 153.Ed 154.Sh SEE ALSO 155.Xr inet 4 , 156.Xr inet6 4 , 157.Xr ifconfig 8 158.Rs 159.%A J. Lau, Ed. 160.%A M. Townsley, Ed. 161.%A I. Goyret, Ed. 162.%B RFC 3931 163.%T Layer Two Tunneling Protocol - Version 3 (L2TPv3) 164.%D March 2005 165.%U ftp://ftp.ietf.org/rfc/rfc3931.txt 166.Re 167.Sh HISTORY 168The 169.Nm 170device first appeared in 171.Nx 8.0 . 172.Sh BUGS 173Currently, the 174.Nm 175interface supports Ethernet frames over IPv4 or IPv6 only. 176