/ip firewall filter add chain=input protocol=udp dst-port=500,4500 action=accept comment="IPsec" /ip firewall filter add chain=input protocol=ipsec-esp action=accept comment="ESP" /ip firewall filter add chain=input protocol=udp dst-port=1701 action=accept comment="L2TP" /ip firewall filter add chain=forward src-address=192.168.99.0/24 action=accept comment="VPN forward" /ip firewall nat add chain=srcnat src-address=192.168.99.0/24 action=masquerade comment="VPN internet"
If you want VPN clients to use your internet connection (Full-tunnel VPN), add a src-nat rule.
Add these rules to the chain. Place them above the final "drop all" rule. mikrotik l2tp server setup
Check L2TP server status:
/ip firewall filter add chain=input protocol=udp dst-port=500,4500 action=accept comment="IPsec VPN" /ip firewall filter add chain=input protocol=ipsec-esp action=accept comment="IPsec ESP" /ip firewall filter add chain=input protocol=udp dst-port=1701 action=accept comment="L2TP" Check L2TP server status: /ip firewall filter add
: Enter the router's internal IP (e.g., 192.168.99.1 ). Remote Address : Select your vpn-pool . DNS Server : Optionally add common DNS servers like 1.1.1.1 . 3. Create VPN Users (Secrets) Each user needs their own credentials to authenticate. Go to PPP > Secrets . Click Add (+) and enter a Name (username) and Password . Set Service to l2tp and select your l2tp-profile . 4. Enable the L2TP Server with IPSec
RouterOS automatically creates dynamic IPsec peers when use-ipsec=yes is set on L2TP. However, you can fine-tune: your L2TP server is working perfectly.
The profile sets the "gateway" IP for the VPN and points to the pool created in step 1. Go to > Profiles and click Add (+) . Name : l2tp-profile .
If the client cannot connect, run this command in MikroTik terminal to watch live logs: /log print follow
If you see entries here, your L2TP server is working perfectly.