L2TP(4) | Device Drivers Manual | L2TP(4)

# NAME

`l2tp` — layer two tunneling protocol version 3

# SYNOPSIS

`pseudo-device l2tp`

# 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, as specified in `RFC3931`.

The L2TPv3 protocol is comprised of two types of messages: control messages and data messages. Control messages are used in the establishment, maintenace, and clearing of control connections and sessions. The `l2tp` interface can send control messages and data messages; furthermore the management of control messages is entrusted to 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. Additionally, it can 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 will be encapsulated in an outer packet, which may be either an IPv4 or IPv6 packet, with IP protocol number 115.

# EXAMPLES

Configuration example:

    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

inet(4), inet6(4), ifconfig(8)

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.

# BUGS

Currently, the `l2tp` interface supports Ethernet frames over IPv4 or IPv6 only.

August 14, 2018 | NetBSD 11.99