L2TP(4)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’– NAME πŸ’–

l2tp β€” layer two tunneling protocol version 3.

okay bestie, welcome to the L2TP(4) page from the Kernel Interfaces Manual ✨ this whole page is about l2tp, the layer two tunneling protocol version 3, and yes we're gonna make it make sense.


✨ SYNOPSIS ✨

pseudo-device l2tp

short and iconic, just like this πŸ’…

🌈 DESCRIPTION 🌈

The l2tp interface implements version 3 of the Layer Two Tunneling Protocol (L2TPv3). It can tunnel layer 2 protocol traffic over IPv4 or IPv6, exactly as specified in RFC3931.

The L2TPv3 protocol is made of two message types: control messages and data messages. Control messages handle establishment, maintenance, and clearing of control connections and sessions. The l2tp interface can send control messages and data messages; on top of that, management of control messages is entrusted to a userland daemon. Without a management daemon, the l2tp interface can send data messages using the ifconfig(8) tunnel and session subcommands, or the SIOCSIFPHYADDR and SIOCSL2TPSESSION ioctls. It can also use cookies specified in RFC3931 by using the ifconfig(8) cookie subcommand, or the SIOCSL2TPCOOKIE ioctl.

πŸ“¦ Packet format πŸ“¦

Layer 2 frames are prepended with a L2TPv3 header as described by RFC 3931. The resulting L2TPv3 packets get encapsulated in an outer packet, which may be either an IPv4 or IPv6 packet, with IP protocol number 115. No cap.

πŸ§ͺ EXAMPLES πŸ§ͺ

okay bestie, here's the configuration example. It's giving tunnel diagram realness:

wm0 = 192.168.0.1/24                        wm0 = 192.168.0.2/24

+------------+                                    +------------+
|  NetBSD_A  |                                    |  NetBSD_B  |
|------------|                                    |------------|
|   [l2tp0] - - - - - - - - (tunnel) - - - - - - - - [l2tp0]   |
|          [wm0]------------- ... --------------[wm0]          |
|            |                                    |            |
+---[wm1]----+                                    +----[wm1]---+
      |                                                  |
      |                                                  |
+------------+                                    +------------+
|   Host_X   |                                    |   Host_Y   |
+------------+                                    +------------+

πŸͺ Configuration example without cookies πŸͺ

On NetBSD_A:

# ifconfig wm0 inet 192.168.0.1/24
# ifconfig l2tp0 create
# ifconfig l2tp0 tunnel 192.168.0.1 192.168.0.2
# ifconfig l2tp0 session 1234 4321
# ifconfig bridge0 create
# brconfig bridge0 add wm1
# brconfig bridge0 add l2tp0
# ifconfig l2tp0 up
# ifconfig wm1 up
# ifconfig bridge0 up

On NetBSD_B:

# ifconfig wm0 inet 192.168.0.2/24
# ifconfig l2tp0 create
# ifconfig l2tp0 tunnel 192.168.0.2 192.168.0.1
# ifconfig l2tp0 session 4321 1234
# ifconfig bridge0 create
# brconfig bridge0 add wm1
# brconfig bridge0 add l2tp0
# ifconfig l2tp0 up
# ifconfig wm1 up
# ifconfig bridge0 up

πŸ“ Configuration example with cookies πŸ“

On NetBSD_A:

# ifconfig wm0 inet 192.168.0.1/24
# ifconfig l2tp0 create
# ifconfig l2tp0 tunnel 192.168.0.1 192.168.0.2
# ifconfig l2tp0 session 1234 4321
# ifconfig l2tp0 cookie 4 12345 4 54321
# ifconfig bridge0 create
# brconfig bridge0 add wm1
# brconfig bridge0 add l2tp0
# ifconfig l2tp0 up
# ifconfig wm1 up
# ifconfig bridge0 up

On NetBSD_B:

# ifconfig wm0 inet 192.168.0.2/24
# ifconfig l2tp0 create
# ifconfig l2tp0 tunnel 192.168.0.2 192.168.0.1
# ifconfig l2tp0 session 4321 1234
# ifconfig l2tp0 cookie 4 54321 4 12345
# ifconfig bridge0 create
# brconfig bridge0 add wm1
# brconfig bridge0 add l2tp0
# ifconfig l2tp0 up
# ifconfig wm1 up
# ifconfig bridge0 up

πŸ¦‹ SEE ALSO πŸ¦‹

J. Lau, Ed., M. Townsley, Ed., and I. Goyret, Ed., β€œLayer Two Tunneling Protocol - Version 3 (L2TPv3)”, RFC 3931, ftp://ftp.ietf.org/rfc/rfc3931.txt, March 2005.

πŸ‘‘ HISTORY πŸ‘‘

The l2tp device first appeared in NetBSD 8.0. Periodt.

πŸ’€ BUGS πŸ’€

Currently, the l2tp interface supports Ethernet frames over IPv4 or IPv6 only. That's the whole limitation, bestie.

okay that's the whole page πŸ’– this footer vibe is from Debian, dated August 14, 2018, and it's the L2TP(4) page β€” bye bestie 🫢

πŸ“¦ where this page comes from