Overview

Layer Two Tunneling Protocol "L2TP" extends the PPP model by allowing the L2 and PPP endpoints to reside on different devices interconnected by a packet-switched network. L2TP includes PPP authentication and accounting for each L2TP connection. Full authentication and accounting of each connection may be done through a RADIUS client or locally. L2TP traffic uses UDP protocol for both control and data packets. UDP port 1701 is used only for link establishment, further traffic is using any available UDP port (which may or may not be 1701). This means that L2TP can be used with most firewalls and routers (even with NAT) by enabling UDP traffic to be routed through the firewall or router.L2TPstandard is defined inRFC 2661.

Introduction

It may be useful to use L2TP just as any other tunneling protocol with or without encryption. The L2TP standard says that the most secure way to encrypt data is using L2TP over IPsec (Note that it is the default mode for Microsoft L2TP client) as all L2TP control and data packets for a particular tunnel appear as homogeneous UDP/IP data packets to the IPsec system.

Multilink PPP (MP) is supported in order to provide MRRU (the ability to transmit full-sized 1500 and larger packets) and bridging over PPP links (using Bridge Control Protocol (BCP) that allows sending raw Ethernet frames over PPP links). This way it is possible to setup bridging without EoIP. The bridge should either have an administratively set MAC address or an Ethernet-like interface in it, as PPP links do not have MAC addresses.

L2TP does not provide encryption mechanisms for tunneled traffic. IPsec can be used for additional security layers.

L2TP Client

Properties

Property Description
add-default-route(是的|不; Default:no) Whether to add L2TP remote address as a default route.
allow(mschap2 | mschap1 | chap | pap; Default:mschap2, mschap1, chap, pap) Allowed authentication methods.
connect-to(IP; Default: )

Remote address of L2TP server (if the address is in VRF table, VRF should be specified)

/接口l2tp-client添加connect-to=192.168.88.1@vrf1 name=l2tp-out1 user=l2tp-client)


comment(string; Default: ) Short description of the tunnel.
default-route-distance(byte; Default: ) Since v6.2, sets distance value applied to auto created default route, if add-default-route is also selected
dial-on-demand(是的|不; Default:no) connects only when outbound traffic is generated. If selected, then route with gateway address from 10.112.112.0/24 network will be added while connection is not established.
disabled(是的|不; Default:yes) Enables/disables tunnel.
keepalive-timeout(integer [1..4294967295]; Default:60s) Since v6.0rc13, tunnel keepalive timeout in seconds.
max-mru(integer; Default:1450) Maximum Receive Unit. Max packet size that L2TP interface will be able to receive without packet fragmentation.
max-mtu(integer; Default:1450) Maximum Transmission Unit. Max packet size that L2TP interface will be able to send without packet fragmentation.
mrru(disabled | integer; Default:disabled) Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU, it will be split into multiple packets, allowing full size IP or Ethernet packets to be sent over the tunnel.
name(string; Default: ) Descriptive name of the interface.
password(string; Default:"") Password used for authentication.
profile(name; Default:default-encryption) Specifies which PPP profile configuration will be used when establishing the tunnel.
user(string; Default: ) User name used for authentication.
use-ipsec(是的|不; Default:no) When this option is enabled, dynamic IPSec peer configuration and policy is added to encapsulate L2TP connection into IPSec tunnel.
ipsec-secret(string; Default: ) Preshared key used when use-ipsec is enabled.

L2TP Server

An interface is created for each tunnel established to the given server. There are two types of interfaces in the L2TP server's configuration

  • Static interfaces are added administratively if there is a need to reference the particular interface name (in firewall rules or elsewhere) created for the particular user;
  • Dynamic interfaces are added to this list automatically whenever a user is connected and its username does not match any existing static entry (or in case the entry is active already, as there can not be two separate tunnel interfaces referenced by the same name);

Dynamic interfaces appear when a user connects and disappear once the user disconnects, so it is impossible to reference the tunnel created for that use in router configuration (for example, in firewall), so if you need persistent rules for that user, create a static entry for him/her. Otherwise, it is safe to use a dynamic configuration.

in both cases PPP users must be configured properly - static entries do not replace PPP configuration.

Properties

Property Description
authentication(pap | chap | mschap1 | mschap2; Default:mschap1,mschap2) Authentication methods that server will accept.
default-profile(name; Default:default-encryption) default profile to use
enabled(是的|不; Default:no) Defines whether L2TP server is enabled or not.
max-mru(integer; Default:1450) Maximum Receive Unit. Max packet size that L2TP interface will be able to receive without packet fragmentation.
keepalive-timeout(integer; Default:30) If server during keepalive-timeout period does not receive any packets, it will send keepalive packets every second, five times. If the server still does not receive any response from the client, then the client will be disconnected after 5 seconds. Logs will show 5x "LCP missed echo reply" messages and then disconnect.
max-mtu(integer; Default:1450) Maximum Transmission Unit. Max packet size that L2TP interface will be able to send without packet fragmentation.
use-ipsec(no | yes | require; Default:no) When this option is enabled, dynamic IPSec peer configuration is added to suite most of the L2TP road-warrior setups. When require is selected server will accept only those L2TP connection attempts that were encapsulated in the IPSec tunnel.
ipsec-secret(string; Default: ) Preshared key used when use-ipsec is enabled
mrru(disabled | integer; Default:disabled) Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU, it will be split into multiple packets, allowing full size IP or Ethernet packets to be sent over the tunnel.

简单的例子

L2TP Server

On the servers side we will enable L2TP-server and create a PPP profile for a particular user:

[admin@MikroTik] > /interface l2tp-server server set enabled=yes [admin@MikroTik] > /ppp secret add local-address=10.0.0.2 name=MT-User password=StrongPass profile=default-encryption remote-address=10.0.0.1 service=l2tp

L2TP Client

L2TP client setup in the RouterOS is very simple. In the following example, we already have a preconfigured 3 unit setup. We will take a look more detailed on how to set up L2TP client with username "MT-User", password "StrongPass" and server 192.168.51.3:

[admin@MikroTik] > /interface l2tp-client \ add connect-to=192.168.51.3 disabled=no name=MT-User password=StrongPass user=MT-User [admin@MikroTik] > /interface l2tp-client print Flags: X - disabled, R - running 0 R name="MT-User" max-mtu=1450 max-mru=1450 mrru=disabled connect-to=192.168.51.3 user="MT-User" password="StrongPass" profile=default-encryption keepalive-timeout=60 use-ipsec=no ipsec-secret="" allow-fast-path=no add-default-route=no dial-on-demand=no allow=pap,chap,mschap1,mschap2
  • No labels