L2TP (Layer 2 Tunneling Protocol) kapselt PPP-Daten über UDP-Port 1701 und wird fast immer mit IPsec kombiniert, weil L2TP selbst keine Verschlüsselung mitbringt. Diese Referenz zeigt die wichtigsten Kommandos für den Linux-Dienst xl2tpd (LNS und LAC) und für Cisco IOS mit VPDN.

Linux: xl2tpd als LNS (Server)

Der Dienst liest seine Konfiguration aus /etc/xl2tpd/xl2tpd.conf. Ein Minimal-Setup als LNS sieht so aus:

# /etc/xl2tpd/xl2tpd.conf
[global]
listen-addr = 192.0.2.1
[lns default]
ip range = 192.0.2.100-192.0.2.120
local ip = 192.0.2.1
require chap = yes
require authentication = yes
name = vpn-server
ppp debug = no
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes

In /etc/ppp/options.xl2tpd stehen die PPP-Optionen, danach startet man den Dienst:

sudo systemctl enable --now xl2tpd
sudo systemctl status xl2tpd
sudo tail -f /var/log/syslog | grep xl2tpd

Linux: xl2tpd als LAC (Client)

Für die Verbindung zu einem LNS ergänzt man im selben xl2tpd.conf einen [lac]-Abschnitt und verbindet per Kommando:

[lac vpn]
lns = vpn.example.com
require pap = yes
autodial = yes
ppp debug = no
pppoptfile = /etc/ppp/options.l2tpc

sudo systemctl restart xl2tpd
ip addr show ppp0   # ausgehandelte Client-IP pruefen

L2TP/IPsec-Kombination (strongSwan)

Weil L2TP unverschlüsselt ist, schützt man den UDP-1701-Verkehr mit IPsec (ESP):

# /etc/ipsec.conf
conn L2TP-PSK
    type=transport
    left=192.0.2.1
    right=%any
    leftprotoport=17/1701
    rightprotoport=17/1701
    auto=add

sudo systemctl enable --now strongswan-starter
sudo ipsec up L2TP-PSK
sudo ipsec statusall

Cisco IOS: VPDN mit L2TP

Ein LNS nimmt eingehende L2TP-Tunnel über eine VPDN-Gruppe an:

vpdn enable
vpdn-group L2TP-LNS
 accept-dialin
  protocol l2tp
  virtual-template 1
 terminate-from hostname NAS
 no l2tp tunnel authentication
!
interface Virtual-Template1
 ip unnumbered FastEthernet0/0
 ppp authentication chap

Die Überwachung übernehmen diese Show-Befehle:

show vpdn tunnel
show vpdn session
show vpdn history

Verwandte Grundlagen: L2TP, PPTP-Befehle, SSTP-Befehle, IP-Tunnel, VPN-Grundlagen, VPN, IPsec-Befehle, OpenVPN-Befehle, WireGuard-Befehle.