1IP-L2TP(8)                           Linux                          IP-L2TP(8)
2
3
4

NAME

6       ip-l2tp - L2TPv3 static unmanaged tunnel configuration
7

SYNOPSIS

9       ip [ OPTIONS ] l2tp  { COMMAND | help }
10
11       ip l2tp add tunnel
12               remote ADDR local ADDR
13               tunnel_id ID peer_tunnel_id ID
14               [ encap { ip | udp } ]
15               [ udp_sport PORT  ] [ udp_dport PORT  ]
16               [ udp_csum { on | off } ]
17               [ udp6_csum_tx { on | off } ]
18               [ udp6_csum_rx { on | off } ]
19       ip l2tp add session [ name NAME  ]
20               tunnel_id ID session_id ID peer_session_id ID
21               [ cookie HEXSTR  ] [ peer_cookie HEXSTR  ]
22               [ l2spec_type { none | default } ]
23               [ seq { none | send | recv | both } ]
24       ip l2tp del tunnel tunnel_id ID
25       ip l2tp del session tunnel_id ID session_id ID
26       ip l2tp show tunnel [ tunnel_id ID ]
27       ip l2tp show session [ tunnel_id ID.B ] [ session_id ID ]
28       NAME := STRING
29       ADDR := { IP_ADDRESS | any }
30       PORT := { NUMBER }
31       ID := { NUMBER }
32       HEXSTR := { 8 or 16 hex digits (4 / 8 bytes) }
33

DESCRIPTION

35       The ip l2tp commands are used to establish static, or so-called unman‐
36       aged L2TPv3 ethernet tunnels. For unmanaged tunnels, there is no L2TP
37       control protocol so no userspace daemon is required - tunnels are manu‐
38       ally created by issuing commands at a local system and at a remote
39       peer.
40
41       L2TPv3 is suitable for Layer-2 tunneling. Static tunnels are useful to
42       establish network links across IP networks when the tunnels are fixed.
43       L2TPv3 tunnels can carry data of more than one session. Each session is
44       identified by a session_id and its parent tunnel's tunnel_id. A tunnel
45       must be created before a session can be created in the tunnel.
46
47       When creating an L2TP tunnel, the IP address of the remote peer is
48       specified, which can be either an IPv4 or IPv6 address. The local IP
49       address to be used to reach the peer must also be specified. This is
50       the address on which the local system will listen for and accept
51       received L2TP data packets from the peer.
52
53       L2TPv3 defines two packet encapsulation formats: UDP or IP. UDP encap‐
54       sulation is most common. IP encapsulation uses a dedicated IP protocol
55       value to carry L2TP data without the overhead of UDP. Use IP encapsula‐
56       tion only when there are no NAT devices or firewalls in the network
57       path.
58
59       When an L2TPv3 ethernet session is created, a virtual network interface
60       is created for the session, which must then be configured and brought
61       up, just like any other network interface. When data is passed through
62       the interface, it is carried over the L2TP tunnel to the peer. By con‐
63       figuring the system's routing tables or adding the interface to a
64       bridge, the L2TP interface is like a virtual wire (pseudowire) con‐
65       nected to the peer.
66
67       Establishing an unmanaged L2TPv3 ethernet pseudowire involves manually
68       creating L2TP contexts on the local system and at the peer. Parameters
69       used at each site must correspond or no data will be passed. No consis‐
70       tency checks are possible since there is no control protocol used to
71       establish unmanaged L2TP tunnels. Once the virtual network interface of
72       a given L2TP session is configured and enabled, data can be transmit‐
73       ted, even if the peer isn't yet configured. If the peer isn't config‐
74       ured, the L2TP data packets will be discarded by the peer.
75
76       To establish an unmanaged L2TP tunnel, use l2tp add tunnel and l2tp add
77       session commands described in this document. Then configure and enable
78       the tunnel's virtual network interface, as required.
79
80       Note that unmanaged tunnels carry only ethernet frames. If you need to
81       carry PPP traffic (L2TPv2) or your peer doesn't support unmanaged
82       L2TPv3 tunnels, you will need an L2TP server which implements the L2TP
83       control protocol. The L2TP control protocol allows dynamic L2TP tunnels
84       and sessions to be established and provides for detecting and acting
85       upon network failures.
86
87   ip l2tp add tunnel - add a new tunnel
88       tunnel_id ID
89              set the tunnel id, which is a 32-bit integer value. Uniquely
90              identifies the tunnel. The value used must match the peer_tun‐
91              nel_id value being used at the peer.
92
93       peer_tunnel_id ID
94              set the peer tunnel id, which is a 32-bit integer value assigned
95              to the tunnel by the peer. The value used must match the tun‐
96              nel_id value being used at the peer.
97
98       remote ADDR
99              set the IP address of the remote peer. May be specified as an
100              IPv4 address or an IPv6 address.
101
102       local ADDR
103              set the IP address of the local interface to be used for the
104              tunnel. This address must be the address of a local interface.
105              May be specified as an IPv4 address or an IPv6 address.
106
107       encap ENCAP
108              set the encapsulation type of the tunnel.
109              Valid values for encapsulation are: udp, ip.
110
111       udp_sport PORT
112              set the UDP source port to be used for the tunnel. Must be
113              present when udp encapsulation is selected. Ignored when ip
114              encapsulation is selected.
115
116       udp_dport PORT
117              set the UDP destination port to be used for the tunnel. Must be
118              present when udp encapsulation is selected. Ignored when ip
119              encapsulation is selected.
120
121       udp_csum STATE
122              (IPv4 only) control if IPv4 UDP checksums should be calculated
123              and checked for the encapsulating UDP packets, when UDP encapsu‐
124              lating is selected.  Default is off.
125              Valid values are: on, off.
126
127       udp6_csum_tx STATE
128              (IPv6 only) control if IPv6 UDP checksums should be calculated
129              for encapsulating UDP packets, when UDP encapsulating is
130              selected.  Default is on.
131              Valid values are: on, off.
132
133       udp6_csum_rx STATE
134              (IPv6 only) control if IPv6 UDP checksums should be checked for
135              the encapsulating UDP packets, when UDP encapsulating is
136              selected.  Default is on.
137              Valid values are: on, off.
138
139   ip l2tp del tunnel - destroy a tunnel
140       tunnel_id ID
141              set the tunnel id of the tunnel to be deleted. All sessions
142              within the tunnel must be deleted first.
143
144   ip l2tp show tunnel - show information about tunnels
145       tunnel_id ID
146              set the tunnel id of the tunnel to be shown. If not specified,
147              information about all tunnels is printed.
148
149   ip l2tp add session - add a new session to a tunnel
150       name NAME
151              sets the session network interface name. Default is l2tpethN.
152
153       tunnel_id ID
154              set the tunnel id, which is a 32-bit integer value. Uniquely
155              identifies the tunnel into which the session will be created.
156              The tunnel must already exist.
157
158       session_id ID
159              set the session id, which is a 32-bit integer value. Uniquely
160              identifies the session being created. The value used must match
161              the peer_session_id value being used at the peer.
162
163       peer_session_id ID
164              set the peer session id, which is a 32-bit integer value
165              assigned to the session by the peer. The value used must match
166              the session_id value being used at the peer.
167
168       cookie HEXSTR
169              sets an optional cookie value to be assigned to the session.
170              This is a 4 or 8 byte value, specified as 8 or 16 hex digits,
171              e.g. 014d3636deadbeef. The value must match the peer_cookie
172              value set at the peer. The cookie value is carried in L2TP data
173              packets and is checked for expected value at the peer. Default
174              is to use no cookie.
175
176       peer_cookie HEXSTR
177              sets an optional peer cookie value to be assigned to the ses‐
178              sion. This is a 4 or 8 byte value, specified as 8 or 16 hex dig‐
179              its, e.g. 014d3636deadbeef. The value must match the cookie
180              value set at the peer. It tells the local system what cookie
181              value to expect to find in received L2TP packets. Default is to
182              use no cookie.
183
184       l2spec_type L2SPECTYPE
185              set the layer2specific header type of the session.
186              Valid values are: none, default.
187
188       seq SEQ
189              controls sequence numbering to prevent or detect out of order
190              packets.  send puts a sequence number in the default layer2spe‐
191              cific header of each outgoing packet.  recv reorder packets if
192              they are received out of order.  Default is none.
193              Valid values are: none, send, recv, both.
194
195   ip l2tp del session - destroy a session
196       tunnel_id ID
197              set the tunnel id in which the session to be deleted is located.
198
199       session_id ID
200              set the session id of the session to be deleted.
201
202   ip l2tp show session - show information about sessions
203       tunnel_id ID
204              set the tunnel id of the session(s) to be shown. If not speci‐
205              fied, information about sessions in all tunnels is printed.
206
207       session_id ID
208              set the session id of the session to be shown. If not specified,
209              information about all sessions is printed.
210

EXAMPLES

212   Setup L2TP tunnels and sessions
213       site-A:# ip l2tp add tunnel tunnel_id 3000 peer_tunnel_id 4000 \
214                  encap udp local 1.2.3.4 remote 5.6.7.8 \
215                  udp_sport 5000 udp_dport 6000
216       site-A:# ip l2tp add session tunnel_id 3000 session_id 1000 \
217                  peer_session_id 2000
218
219       site-B:# ip l2tp add tunnel tunnel_id 4000 peer_tunnel_id 3000 \
220                  encap udp local 5.6.7.8 remote 1.2.3.4 \
221                  udp_sport 6000 udp_dport 5000
222       site-B:# ip l2tp add session tunnel_id 4000 session_id 2000 \
223                  peer_session_id 1000
224
225       site-A:# ip link set l2tpeth0 up mtu 1488
226
227       site-B:# ip link set l2tpeth0 up mtu 1488
228
229       Notice that the IP addresses, UDP ports and tunnel / session ids are
230       matched and reversed at each site.
231
232   Configure as IP interfaces
233       The two interfaces can be configured with IP addresses if only IP data
234       is to be carried. This is perhaps the simplest configuration.
235
236       site-A:# ip addr add 10.42.1.1 peer 10.42.1.2 dev l2tpeth0
237
238       site-B:# ip addr add 10.42.1.2 peer 10.42.1.1 dev l2tpeth0
239
240       site-A:# ping 10.42.1.2
241
242       Now the link should be usable. Add static routes as needed to have data
243       sent over the new link.
244
245   Configure as bridged interfaces
246       To carry non-IP data, the L2TP network interface is added to a bridge
247       instead of being assigned its own IP address, using standard Linux
248       utilities. Since raw ethernet frames are then carried inside the tun‐
249       nel, the MTU of the L2TP interfaces must be set to allow space for
250       those headers.
251
252       site-A:# ip link set l2tpeth0 up mtu 1446
253       site-A:# ip link add br0 type bridge
254       site-A:# ip link set l2tpeth0 master br0
255       site-A:# ip link set eth0 master br0
256       site-A:# ip link set br0 up
257
258       If you are using VLANs, setup a bridge per VLAN and bridge each VLAN
259       over a separate L2TP session. For example, to bridge VLAN ID 5 on eth1
260       over an L2TP pseudowire:
261
262       site-A:# ip link set l2tpeth0 up mtu 1446
263       site-A:# ip link add brvlan5 type bridge
264       site-A:# ip link set l2tpeth0.5 master brvlan5
265       site-A:# ip link set eth1.5 master brvlan5
266       site-A:# ip link set brvlan5 up
267
268       Adding the L2TP interface to a bridge causes the bridge to forward
269       traffic over the L2TP pseudowire just like it forwards over any other
270       interface. The bridge learns MAC addresses of hosts attached to each
271       interface and intelligently forwards frames from one bridge port to
272       another. IP addresses are not assigned to the l2tpethN interfaces. If
273       the bridge is correctly configured at both sides of the L2TP pseu‐
274       dowire, it should be possible to reach hosts in the peer's bridged net‐
275       work.
276
277       When raw ethernet frames are bridged across an L2TP tunnel, large
278       frames may be fragmented and forwarded as individual IP fragments to
279       the recipient, depending on the MTU of the physical interface used by
280       the tunnel. When the ethernet frames carry protocols which are reassem‐
281       bled by the recipient, like IP, this isn't a problem. However, such
282       fragmentation can cause problems for protocols like PPPoE where the
283       recipient expects to receive ethernet frames exactly as transmitted. In
284       such cases, it is important that frames leaving the tunnel are reassem‐
285       bled back into a single frame before being forwarded on. To do so,
286       enable netfilter connection tracking (conntrack) or manually load the
287       Linux netfilter defrag modules at each tunnel endpoint.
288
289       site-A:# modprobe nf_defrag_ipv4
290
291       site-B:# modprobe nf_defrag_ipv4
292
293       If L2TP is being used over IPv6, use the IPv6 defrag module.
294

INTEROPERABILITY

296       Unmanaged (static) L2TPv3 tunnels are supported by some network equip‐
297       ment equipment vendors such as Cisco.
298
299       In Linux, L2TP Hello messages are not supported in unmanaged tunnels.
300       Hello messages are used by L2TP clients and servers to detect link
301       failures in order to automate tearing down and reestablishing dynamic
302       tunnels. If a non-Linux peer supports Hello messages in unmanaged tun‐
303       nels, it must be turned off to interoperate with Linux.
304
305       Linux defaults to use the Default Layer2SpecificHeader type as defined
306       in the L2TPv3 protocol specification, RFC3931. This setting must be
307       consistent with that configured at the peer. Some vendor implementa‐
308       tions (e.g. Cisco) default to use a Layer2SpecificHeader type of None.
309

SEE ALSO

311       ip(8)
312

AUTHOR

314       James Chapman <jchapman@katalix.com>
315
316
317
318iproute2                          19 Apr 2012                       IP-L2TP(8)
Impressum