L2TP (Layer 2 Tunneling Protocol)是一种通常用于VPN的协议。在MikroTik设备上搭建L2TP服务器可以完成远程连接和全局网络的通信。下面的脚本在MikroTik上搭建L2TP VPN服务器。
配置脚本
#建立地址池
/ ip pool add name="vp_pool" ranges=10.88.1.1-10.88.1.200
#建立模板
/ ppp profile add dns-server=114.114.114.114,223.6.6.6 local-address=10.88.1.254 name=vp_profile only-one=yes remote-address=vp_pool
#添加用户
/ppp secret add name=r1 password=123456 profile=vp_profile
#开启服务,ipsec密钥为123456(自行修改)
/int l2tp-ser ser set enabled=yes use-ipsec=yes ipsec-secret=123456
#添加NAT
/ ip firewall nat add chain=srcnat src-address=10.88.1.0/24 action=masquerade comment=vp_pool