Blame man/man8/ip-l2tp.8

Packit d3f73b
.TH IP\-L2TP 8 "19 Apr 2012" "iproute2" "Linux"
Packit d3f73b
.SH "NAME"
Packit d3f73b
ip-l2tp - L2TPv3 static unmanaged tunnel configuration
Packit d3f73b
.SH "SYNOPSIS"
Packit d3f73b
.sp
Packit d3f73b
.ad l
Packit d3f73b
.in +8
Packit d3f73b
.ti -8
Packit d3f73b
.B ip
Packit d3f73b
.RI "[ " OPTIONS " ]"
Packit d3f73b
.B l2tp
Packit d3f73b
.RI " { " COMMAND " | "
Packit d3f73b
.BR help " }"
Packit d3f73b
.sp
Packit d3f73b
.ti -8
Packit d3f73b
.BR "ip l2tp add tunnel"
Packit d3f73b
.br
Packit d3f73b
.BI remote " ADDR " local " ADDR "
Packit d3f73b
.br
Packit d3f73b
.B tunnel_id
Packit d3f73b
.IR ID
Packit d3f73b
.B peer_tunnel_id
Packit d3f73b
.IR ID
Packit d3f73b
.br
Packit d3f73b
.RB "[ " encap " { " ip " | " udp " } ]"
Packit d3f73b
.br
Packit d3f73b
.RB "[ " udp_sport
Packit d3f73b
.IR PORT
Packit d3f73b
.RB " ] [ " udp_dport
Packit d3f73b
.IR PORT
Packit d3f73b
.RB " ]"
Packit d3f73b
.br
Packit d3f73b
.RB "[ " udp_csum " { " on " | " off " } ]"
Packit d3f73b
.br
Packit d3f73b
.RB "[ " udp6_csum_tx " { " on " | " off " } ]"
Packit d3f73b
.br
Packit d3f73b
.RB "[ " udp6_csum_rx " { " on " | " off " } ]"
Packit d3f73b
.br
Packit d3f73b
.ti -8
Packit d3f73b
.BR "ip l2tp add session"
Packit d3f73b
.RB "[ " name
Packit d3f73b
.IR NAME
Packit d3f73b
.RB " ]"
Packit d3f73b
.br
Packit d3f73b
.B tunnel_id
Packit d3f73b
.IR ID
Packit d3f73b
.B session_id
Packit d3f73b
.IR ID
Packit d3f73b
.B peer_session_id
Packit d3f73b
.IR ID
Packit d3f73b
.br
Packit d3f73b
.RB "[ " cookie
Packit d3f73b
.IR HEXSTR
Packit d3f73b
.RB " ] [ " peer_cookie
Packit d3f73b
.IR HEXSTR
Packit d3f73b
.RB " ]"
Packit d3f73b
.br
Packit d3f73b
.RB "[ " l2spec_type " { " none " | " default " } ]"
Packit d3f73b
.br
Packit d3f73b
.RB "[ " seq " { " none " | " send " | " recv " | " both " } ]"
Packit d3f73b
.br
Packit d3f73b
.ti -8
Packit d3f73b
.BR "ip l2tp del tunnel"
Packit d3f73b
.B tunnel_id
Packit d3f73b
.IR ID
Packit d3f73b
.br
Packit d3f73b
.ti -8
Packit d3f73b
.BR "ip l2tp del session"
Packit d3f73b
.B tunnel_id
Packit d3f73b
.IR ID
Packit d3f73b
.B session_id
Packit d3f73b
.IR ID
Packit d3f73b
.br
Packit d3f73b
.ti -8
Packit d3f73b
.BR "ip l2tp show tunnel" " [ " tunnel_id
Packit d3f73b
.IR ID " ]"
Packit d3f73b
.br
Packit d3f73b
.ti -8
Packit d3f73b
.BR "ip l2tp show session" " [ " tunnel_id
Packit d3f73b
.IR ID .B " ] ["
Packit d3f73b
.B session_id
Packit d3f73b
.IR ID " ]"
Packit d3f73b
.br
Packit d3f73b
.ti -8
Packit d3f73b
.IR NAME " := "
Packit d3f73b
.IR STRING
Packit d3f73b
.ti -8
Packit d3f73b
.IR ADDR " := { " IP_ADDRESS " |"
Packit d3f73b
.BR any " }"
Packit d3f73b
.ti -8
Packit d3f73b
.IR PORT " := { " NUMBER " }"
Packit d3f73b
.ti -8
Packit d3f73b
.IR ID " := { " NUMBER " }"
Packit d3f73b
.ti -8
Packit d3f73b
.ti -8
Packit d3f73b
.IR HEXSTR " := { 8 or 16 hex digits (4 / 8 bytes) }"
Packit d3f73b
.SH DESCRIPTION
Packit d3f73b
The
Packit d3f73b
.B ip l2tp
Packit d3f73b
commands are used to establish static, or so-called
Packit d3f73b
.I unmanaged
Packit d3f73b
L2TPv3 ethernet tunnels. For unmanaged tunnels, there is no L2TP
Packit d3f73b
control protocol so no userspace daemon is required - tunnels are
Packit d3f73b
manually created by issuing commands at a local system and at a remote
Packit d3f73b
peer.
Packit d3f73b
.PP
Packit d3f73b
L2TPv3 is suitable for Layer-2 tunneling. Static tunnels are useful
Packit d3f73b
to establish network links across IP networks when the tunnels are
Packit d3f73b
fixed. L2TPv3 tunnels can carry data of more than one session. Each
Packit d3f73b
session is identified by a session_id and its parent tunnel's
Packit d3f73b
tunnel_id. A tunnel must be created before a session can be created in
Packit d3f73b
the tunnel.
Packit d3f73b
.PP
Packit d3f73b
When creating an L2TP tunnel, the IP address of the remote peer is
Packit d3f73b
specified, which can be either an IPv4 or IPv6 address. The local IP
Packit d3f73b
address to be used to reach the peer must also be specified. This is
Packit d3f73b
the address on which the local system will listen for and accept
Packit d3f73b
received L2TP data packets from the peer.
Packit d3f73b
.PP
Packit d3f73b
L2TPv3 defines two packet encapsulation formats: UDP or IP. UDP
Packit d3f73b
encapsulation is most common. IP encapsulation uses a dedicated IP
Packit d3f73b
protocol value to carry L2TP data without the overhead of UDP. Use IP
Packit d3f73b
encapsulation only when there are no NAT devices or firewalls in the
Packit d3f73b
network path.
Packit d3f73b
.PP
Packit d3f73b
When an L2TPv3 ethernet session is created, a virtual network
Packit d3f73b
interface is created for the session, which must then be configured
Packit d3f73b
and brought up, just like any other network interface. When data is
Packit d3f73b
passed through the interface, it is carried over the L2TP tunnel to
Packit d3f73b
the peer. By configuring the system's routing tables or adding the
Packit d3f73b
interface to a bridge, the L2TP interface is like a virtual wire
Packit d3f73b
(pseudowire) connected to the peer.
Packit d3f73b
.PP
Packit d3f73b
Establishing an unmanaged L2TPv3 ethernet pseudowire involves manually
Packit d3f73b
creating L2TP contexts on the local system and at the peer. Parameters
Packit d3f73b
used at each site must correspond or no data will be passed. No
Packit d3f73b
consistency checks are possible since there is no control protocol
Packit d3f73b
used to establish unmanaged L2TP tunnels. Once the virtual network
Packit d3f73b
interface of a given L2TP session is configured and enabled, data can
Packit d3f73b
be transmitted, even if the peer isn't yet configured. If the peer
Packit d3f73b
isn't configured, the L2TP data packets will be discarded by
Packit d3f73b
the peer.
Packit d3f73b
.PP
Packit d3f73b
To establish an unmanaged L2TP tunnel, use
Packit d3f73b
.B l2tp add tunnel
Packit d3f73b
and
Packit d3f73b
.B l2tp add session
Packit d3f73b
commands described in this document. Then configure and enable the
Packit d3f73b
tunnel's virtual network interface, as required.
Packit d3f73b
.PP
Packit d3f73b
Note that unmanaged tunnels carry only ethernet frames. If you need to
Packit d3f73b
carry PPP traffic (L2TPv2) or your peer doesn't support unmanaged
Packit d3f73b
L2TPv3 tunnels, you will need an L2TP server which implements the L2TP
Packit d3f73b
control protocol. The L2TP control protocol allows dynamic L2TP
Packit d3f73b
tunnels and sessions to be established and provides for detecting and
Packit d3f73b
acting upon network failures.
Packit d3f73b
.SS ip l2tp add tunnel - add a new tunnel
Packit d3f73b
.TP
Packit d3f73b
.BI tunnel_id " ID"
Packit d3f73b
set the tunnel id, which is a 32-bit integer value. Uniquely
Packit d3f73b
identifies the tunnel. The value used must match the peer_tunnel_id
Packit d3f73b
value being used at the peer.
Packit d3f73b
.TP
Packit d3f73b
.BI peer_tunnel_id " ID"
Packit d3f73b
set the peer tunnel id, which is a 32-bit integer value assigned to
Packit d3f73b
the tunnel by the peer. The value used must match the tunnel_id value
Packit d3f73b
being used at the peer.
Packit d3f73b
.TP
Packit d3f73b
.BI remote " ADDR"
Packit d3f73b
set the IP address of the remote peer. May be specified as an IPv4
Packit d3f73b
address or an IPv6 address.
Packit d3f73b
.TP
Packit d3f73b
.BI local " ADDR"
Packit d3f73b
set the IP address of the local interface to be used for the
Packit d3f73b
tunnel. This address must be the address of a local interface. May be
Packit d3f73b
specified as an IPv4 address or an IPv6 address.
Packit d3f73b
.TP
Packit d3f73b
.BI encap " ENCAP"
Packit d3f73b
set the encapsulation type of the tunnel.
Packit d3f73b
.br
Packit d3f73b
Valid values for encapsulation are:
Packit d3f73b
.BR udp ", " ip "."
Packit d3f73b
.TP
Packit d3f73b
.BI udp_sport " PORT"
Packit d3f73b
set the UDP source port to be used for the tunnel. Must be present
Packit d3f73b
when udp encapsulation is selected. Ignored when ip encapsulation is
Packit d3f73b
selected.
Packit d3f73b
.TP
Packit d3f73b
.BI udp_dport " PORT"
Packit d3f73b
set the UDP destination port to be used for the tunnel. Must be
Packit d3f73b
present when udp encapsulation is selected. Ignored when ip
Packit d3f73b
encapsulation is selected.
Packit d3f73b
.TP
Packit d3f73b
.BI udp_csum " STATE"
Packit d3f73b
(IPv4 only) control if IPv4 UDP checksums should be calculated and checked for the
Packit d3f73b
encapsulating UDP packets, when UDP encapsulating is selected.
Packit d3f73b
Default is
Packit d3f73b
.BR off "."
Packit d3f73b
.br
Packit d3f73b
Valid values are:
Packit d3f73b
.BR on ", " off "."
Packit d3f73b
.TP
Packit d3f73b
.BI udp6_csum_tx " STATE"
Packit d3f73b
(IPv6 only) control if IPv6 UDP checksums should be calculated for encapsulating
Packit d3f73b
UDP packets, when UDP encapsulating is selected.
Packit d3f73b
Default is
Packit d3f73b
.BR on "."
Packit d3f73b
.br
Packit d3f73b
Valid values are:
Packit d3f73b
.BR on ", " off "."
Packit d3f73b
.TP
Packit d3f73b
.BI udp6_csum_rx " STATE"
Packit d3f73b
(IPv6 only) control if IPv6 UDP checksums should be checked for the encapsulating
Packit d3f73b
UDP packets, when UDP encapsulating is selected.
Packit d3f73b
Default is
Packit d3f73b
.BR on "."
Packit d3f73b
.br
Packit d3f73b
Valid values are:
Packit d3f73b
.BR on ", " off "."
Packit d3f73b
.SS ip l2tp del tunnel - destroy a tunnel
Packit d3f73b
.TP
Packit d3f73b
.BI tunnel_id " ID"
Packit d3f73b
set the tunnel id of the tunnel to be deleted. All sessions within the
Packit d3f73b
tunnel must be deleted first.
Packit d3f73b
.SS ip l2tp show tunnel - show information about tunnels
Packit d3f73b
.TP
Packit d3f73b
.BI tunnel_id " ID"
Packit d3f73b
set the tunnel id of the tunnel to be shown. If not specified,
Packit d3f73b
information about all tunnels is printed.
Packit d3f73b
.SS ip l2tp add session - add a new session to a tunnel
Packit d3f73b
.TP
Packit d3f73b
.BI name " NAME "
Packit d3f73b
sets the session network interface name. Default is l2tpethN.
Packit d3f73b
.TP
Packit d3f73b
.BI tunnel_id " ID"
Packit d3f73b
set the tunnel id, which is a 32-bit integer value. Uniquely
Packit d3f73b
identifies the tunnel into which the session will be created. The
Packit d3f73b
tunnel must already exist.
Packit d3f73b
.TP
Packit d3f73b
.BI session_id " ID"
Packit d3f73b
set the session id, which is a 32-bit integer value. Uniquely
Packit d3f73b
identifies the session being created. The value used must match the
Packit d3f73b
peer_session_id value being used at the peer.
Packit d3f73b
.TP
Packit d3f73b
.BI peer_session_id " ID"
Packit d3f73b
set the peer session id, which is a 32-bit integer value assigned to
Packit d3f73b
the session by the peer. The value used must match the session_id
Packit d3f73b
value being used at the peer.
Packit d3f73b
.TP
Packit d3f73b
.BI cookie " HEXSTR"
Packit d3f73b
sets an optional cookie value to be assigned to the session. This is a
Packit d3f73b
4 or 8 byte value, specified as 8 or 16 hex digits,
Packit d3f73b
e.g. 014d3636deadbeef. The value must match the peer_cookie value set
Packit d3f73b
at the peer. The cookie value is carried in L2TP data packets and is
Packit d3f73b
checked for expected value at the peer. Default is to use no cookie.
Packit d3f73b
.TP
Packit d3f73b
.BI peer_cookie " HEXSTR"
Packit d3f73b
sets an optional peer cookie value to be assigned to the session. This
Packit d3f73b
is a 4 or 8 byte value, specified as 8 or 16 hex digits,
Packit d3f73b
e.g. 014d3636deadbeef. The value must match the cookie value set at
Packit d3f73b
the peer. It tells the local system what cookie value to expect to
Packit d3f73b
find in received L2TP packets. Default is to use no cookie.
Packit d3f73b
.TP
Packit d3f73b
.BI l2spec_type " L2SPECTYPE"
Packit d3f73b
set the layer2specific header type of the session.
Packit d3f73b
.br
Packit d3f73b
Valid values are:
Packit d3f73b
.BR none ", " default "."
Packit d3f73b
.TP
Packit d3f73b
.BI seq " SEQ"
Packit d3f73b
controls sequence numbering to prevent or detect out of order packets.
Packit d3f73b
.B send
Packit d3f73b
puts a sequence number in the default layer2specific header of each
Packit d3f73b
outgoing packet.
Packit d3f73b
.B recv
Packit d3f73b
reorder packets if they are received out of order.
Packit d3f73b
Default is
Packit d3f73b
.BR none "."
Packit d3f73b
.br
Packit d3f73b
Valid values are:
Packit d3f73b
.BR none ", " send ", " recv ", " both "."
Packit d3f73b
.SS ip l2tp del session - destroy a session
Packit d3f73b
.TP
Packit d3f73b
.BI tunnel_id " ID"
Packit d3f73b
set the tunnel id in which the session to be deleted is located.
Packit d3f73b
.TP
Packit d3f73b
.BI session_id " ID"
Packit d3f73b
set the session id of the session to be deleted.
Packit d3f73b
.SS ip l2tp show session - show information about sessions
Packit d3f73b
.TP
Packit d3f73b
.BI tunnel_id " ID"
Packit d3f73b
set the tunnel id of the session(s) to be shown. If not specified,
Packit d3f73b
information about sessions in all tunnels is printed.
Packit d3f73b
.TP
Packit d3f73b
.BI session_id " ID"
Packit d3f73b
set the session id of the session to be shown. If not specified,
Packit d3f73b
information about all sessions is printed.
Packit d3f73b
.SH EXAMPLES
Packit d3f73b
.PP
Packit d3f73b
.SS Setup L2TP tunnels and sessions
Packit d3f73b
.nf
Packit d3f73b
site-A:# ip l2tp add tunnel tunnel_id 3000 peer_tunnel_id 4000 \\
Packit d3f73b
           encap udp local 1.2.3.4 remote 5.6.7.8 \\
Packit d3f73b
           udp_sport 5000 udp_dport 6000
Packit d3f73b
site-A:# ip l2tp add session tunnel_id 3000 session_id 1000 \\
Packit d3f73b
           peer_session_id 2000
Packit d3f73b
Packit d3f73b
site-B:# ip l2tp add tunnel tunnel_id 4000 peer_tunnel_id 3000 \\
Packit d3f73b
           encap udp local 5.6.7.8 remote 1.2.3.4 \\
Packit d3f73b
           udp_sport 6000 udp_dport 5000
Packit d3f73b
site-B:# ip l2tp add session tunnel_id 4000 session_id 2000 \\
Packit d3f73b
           peer_session_id 1000
Packit d3f73b
Packit d3f73b
site-A:# ip link set l2tpeth0 up mtu 1488
Packit d3f73b
Packit d3f73b
site-B:# ip link set l2tpeth0 up mtu 1488
Packit d3f73b
.fi
Packit d3f73b
.PP
Packit d3f73b
Notice that the IP addresses, UDP ports and tunnel / session ids are
Packit d3f73b
matched and reversed at each site.
Packit d3f73b
.SS Configure as IP interfaces
Packit d3f73b
The two interfaces can be configured with IP addresses if only IP data
Packit d3f73b
is to be carried. This is perhaps the simplest configuration.
Packit d3f73b
.PP
Packit d3f73b
.nf
Packit d3f73b
site-A:# ip addr add 10.42.1.1 peer 10.42.1.2 dev l2tpeth0
Packit d3f73b
Packit d3f73b
site-B:# ip addr add 10.42.1.2 peer 10.42.1.1 dev l2tpeth0
Packit d3f73b
Packit d3f73b
site-A:# ping 10.42.1.2
Packit d3f73b
.fi
Packit d3f73b
.PP
Packit d3f73b
Now the link should be usable. Add static routes as needed to have
Packit d3f73b
data sent over the new link.
Packit d3f73b
.PP
Packit d3f73b
.SS Configure as bridged interfaces
Packit d3f73b
To carry non-IP data, the L2TP network interface is added to a bridge
Packit d3f73b
instead of being assigned its own IP address, using standard Linux
Packit d3f73b
utilities. Since raw ethernet frames are then carried inside the
Packit d3f73b
tunnel, the MTU of the L2TP interfaces must be set to allow space for
Packit d3f73b
those headers.
Packit d3f73b
.PP
Packit d3f73b
.nf
Packit d3f73b
site-A:# ip link set l2tpeth0 up mtu 1446
Packit d3f73b
site-A:# ip link add br0 type bridge
Packit d3f73b
site-A:# ip link set l2tpeth0 master br0
Packit d3f73b
site-A:# ip link set eth0 master br0
Packit d3f73b
site-A:# ip link set br0 up
Packit d3f73b
.fi
Packit d3f73b
.PP
Packit d3f73b
If you are using VLANs, setup a bridge per VLAN and bridge each VLAN
Packit d3f73b
over a separate L2TP session. For example, to bridge VLAN ID 5 on eth1
Packit d3f73b
over an L2TP pseudowire:
Packit d3f73b
.PP
Packit d3f73b
.nf
Packit d3f73b
site-A:# ip link set l2tpeth0 up mtu 1446
Packit d3f73b
site-A:# ip link add brvlan5 type bridge
Packit d3f73b
site-A:# ip link set l2tpeth0.5 master brvlan5
Packit d3f73b
site-A:# ip link set eth1.5 master brvlan5
Packit d3f73b
site-A:# ip link set brvlan5 up
Packit d3f73b
.fi
Packit d3f73b
.PP
Packit d3f73b
Adding the L2TP interface to a bridge causes the bridge to forward
Packit d3f73b
traffic over the L2TP pseudowire just like it forwards over any other
Packit d3f73b
interface. The bridge learns MAC addresses of hosts attached to each
Packit d3f73b
interface and intelligently forwards frames from one bridge port to
Packit d3f73b
another. IP addresses are not assigned to the l2tpethN interfaces. If
Packit d3f73b
the bridge is correctly configured at both sides of the L2TP
Packit d3f73b
pseudowire, it should be possible to reach hosts in the peer's bridged
Packit d3f73b
network.
Packit d3f73b
.PP
Packit d3f73b
When raw ethernet frames are bridged across an L2TP tunnel, large
Packit d3f73b
frames may be fragmented and forwarded as individual IP fragments to
Packit d3f73b
the recipient, depending on the MTU of the physical interface used by
Packit d3f73b
the tunnel. When the ethernet frames carry protocols which are
Packit d3f73b
reassembled by the recipient, like IP, this isn't a problem. However,
Packit d3f73b
such fragmentation can cause problems for protocols like PPPoE where
Packit d3f73b
the recipient expects to receive ethernet frames exactly as
Packit d3f73b
transmitted. In such cases, it is important that frames leaving the
Packit d3f73b
tunnel are reassembled back into a single frame before being
Packit d3f73b
forwarded on. To do so, enable netfilter connection tracking
Packit d3f73b
(conntrack) or manually load the Linux netfilter defrag modules at
Packit d3f73b
each tunnel endpoint.
Packit d3f73b
.PP
Packit d3f73b
.nf
Packit d3f73b
site-A:# modprobe nf_defrag_ipv4
Packit d3f73b
Packit d3f73b
site-B:# modprobe nf_defrag_ipv4
Packit d3f73b
.fi
Packit d3f73b
.PP
Packit d3f73b
If L2TP is being used over IPv6, use the IPv6 defrag module.
Packit d3f73b
.SH INTEROPERABILITY
Packit d3f73b
.PP
Packit d3f73b
Unmanaged (static) L2TPv3 tunnels are supported by some network
Packit d3f73b
equipment equipment vendors such as Cisco.
Packit d3f73b
.PP
Packit d3f73b
In Linux, L2TP Hello messages are not supported in unmanaged
Packit d3f73b
tunnels. Hello messages are used by L2TP clients and servers to detect
Packit d3f73b
link failures in order to automate tearing down and reestablishing
Packit d3f73b
dynamic tunnels. If a non-Linux peer supports Hello messages in
Packit d3f73b
unmanaged tunnels, it must be turned off to interoperate with Linux.
Packit d3f73b
.PP
Packit d3f73b
Linux defaults to use the Default Layer2SpecificHeader type as defined
Packit d3f73b
in the L2TPv3 protocol specification, RFC3931. This setting must be
Packit d3f73b
consistent with that configured at the peer. Some vendor
Packit d3f73b
implementations (e.g. Cisco) default to use a Layer2SpecificHeader
Packit d3f73b
type of None.
Packit d3f73b
.SH SEE ALSO
Packit d3f73b
.br
Packit d3f73b
.BR ip (8)
Packit d3f73b
.SH AUTHOR
Packit d3f73b
James Chapman <jchapman@katalix.com>