Leveling Up Your VPN Game with L2TP/IPsec Print

  • Mikrotik, VPN
  • 22

Hey, hey, hey!

It’s your favorite MikroTik guru—Emmanuel Corels from Emmanuel Corels Creatives—back again with some more networking magic. After our last rendezvous with PPTP on the CHR, I bet you’re feeling like the coolest cat in the virtual networking realm. But guess what? There’s a more secure way to strut your VPN stuff, and it’s called L2TP/IPsec.

So buckle up, buttercup—this is the part where you feel like a secret agent securing the world’s data (or at least your home lab). Ready? Let’s do this!


1. Why L2TP/IPsec?

You might be thinking, “Wait, we just did PPTP. Wasn’t that enough?” Sure, PPTP is quick, easy, and great for a test drive. But in the real world, we want better encryption, a little more muscle. That’s where L2TP (Layer 2 Tunneling Protocol), combined with IPsec, comes in. It’s basically the dynamic duo of VPNs—Batman and Robin, peanut butter and jelly, burgers and fries... you get the idea.

Advantages:

  • Stronger Security than PPTP.
  • Widespread Compatibility with major operating systems.
  • Encryption that makes cybercriminals cry in their cheerios.

2. Pre-Flight Checklist

Before we take off, let’s make sure your router or CHR is ready:

  1. Updated RouterOS: Head to System -> Packages and update if necessary. Nobody likes outdated software—kinda like stale chips at a party.
  2. WAN Connectivity: Make sure you can reach your MikroTik from the internet. If you’re behind another NAT, you may need to port forward.
  3. A Sturdy Chair: Because once we’re done, you’ll lean back, sip your coffee, and say, “I’m basically James Bond. But with a router.”

3. IPsec Basics in MikroTik

Think of IPsec (Internet Protocol Security) like a protective shield around your data packets. It’s what keeps prying eyes from reading your top-secret traffic. In MikroTik world, we break it down into two main parts:

  • Phase 1 (IKE Policy/Peer): Where we establish the secure channel.
  • Phase 2 (IPsec Policy/Proposal): Where the actual encryption parameters are set for your data traffic.

Of course, you can dig super deep into cryptographic gobbledygook, but let’s keep it simple. We’ll set up the recommended defaults to keep things secure.


4. L2TP/IPsec Server Configuration

4.1 Enabling L2TP Server

  1. In WinBox, head over to PPP.
  2. Click Interfaces -> L2TP Server.
  3. Check “Enabled”. That’s it. Boom, L2TP is awake and ready to party.

Terminal Command:

/interface l2tp-server server set enabled=yes

4.2 Configuring IPsec for L2TP

  1. PPP -> Interfaces -> L2TP Server -> IPsec Secret

    • Input a secret (basically a shared key). Something not easily guessable, like I<3SpicyNuggets123.
    • Use IPsec: yes.
  2. Alternatively, you can do it in IP -> IPsec:

    • Peers: Configure the peer settings for Phase 1 (matching your remote client’s settings).
    • Policies: Set Phase 2 to cover the L2TP traffic.

If this seems like a foreign language, fear not. The simplest approach is to keep default IPsec Peer settings (like exchange-mode=ike2 or main) and just specify the secret in PPP. The main difference is that the L2TP Server interface basically sets up a dynamic IPsec policy for you when you enable IPsec and add a secret.

4.3 PPP Profile for L2TP

  1. Go to PPP -> Profiles.
  2. Click “+” to create a new profile, let’s call it L2TP_Profile.
  3. Local Address: The router’s address (e.g., 192.168.88.1).
  4. Remote Address: An IP pool (e.g., 192.168.88.200-192.168.88.210) or a single IP if you’re fancy.
  5. You can also set DNS if you want your clients to use specific DNS servers.

4.4 Adding L2TP Secrets (User Accounts)

  1. Still in PPP, go to Secrets.
  2. Hit “+”.
  3. Name: Bond007. (Because we’re secret agents, remember?)
  4. Password: ShakenNotStirred.
  5. Service: l2tp.
  6. Profile: L2TP_Profile.
  7. OK.

5. Firewall Considerations

Remember that default “drop everything” rule we made? We need to let L2TP/IPsec traffic through:

  1. UDP ports 500 and 4500 for IPsec.
  2. IP protocol 50 (ESP) if you’re doing a more classic IPsec setup.
  3. UDP port 1701 if your NAT or environment requires it.

Create rules in IP -> Firewall -> Filter Rules to accept traffic on these ports in the input chain. If you skip this step, your L2TP clients might bounce like a ball on a summer sidewalk—sad and unconnected.


6. Client-Side Setup (Windows 10/11 Example)

  1. Settings -> Network & Internet -> VPN.

  2. Add a VPN:

    • VPN provider: Windows (built-in).
    • Connection name: L2TP-to-CorelsHQ (or anything witty).
    • Server name or address: Your public IP or domain.
    • VPN type: L2TP/IPsec with pre-shared key.
    • Pre-shared key: The one you entered in L2TP Server’s IPsec Secret.
    • Username/Password: Bond007 / ShakenNotStirred.
  3. Save and Connect.

If all goes well, you’ll see a “Connected” status and do a little victory dance.


7. Verification and Troubleshooting

7.1 Checking Connections

  • In WinBox, go to PPP -> Active Connections. You should see an L2TP session with your user name.
  • In Logs (System -> Logging), add a topic for ipsec or l2tp if you need more detailed output.

7.2 Common Gotchas

  • Wrong Pre-Shared Key: Double-check you’re using the same key on the client and server.
  • Firewall Blocking: Make sure UDP 500/4500 traffic isn’t blocked.
  • NAT Traversal: If you’re behind NAT, you might need to enable NAT-T (usually done automatically on most OSes).
  • ESP or GRE Confusion: PPTP used GRE, whereas L2TP/IPsec uses ESP. Don’t mix them up. They get jealous.

8. Putting It All Together

Congratulations, you’re now set up with a significantly more secure VPN solution than PPTP. You’re basically the Q-Branch of your home or office network—handing out secure tunnels like they’re high-tech gadgets.

And if you want to get even fancier, you can:

  • Use Certificates instead of a pre-shared key for even better security.
  • Integrate RADIUS for centralized user management.
  • Try Site-to-Site L2TP/IPsec if you need to connect two remote offices.

9. What’s Next?

We’ve now seen PPTP, dabbled in CHR, and embraced L2TP/IPsec. Next, we might sink our teeth into OpenVPN for those who prefer SSL/TLS-based tunnels (and possibly want to impress their friends at parties, because yes, sometimes we talk about tunnels at parties… or maybe that’s just me).

Until then, keep exploring, have fun, and don’t forget to add a little flair to your network. If your routes are tidy and your VPN is snappy, your data will live happily ever after. (Was that too cheesy? Maybe. But I stand by it.)

Stay awesome, keep learning, and as always—reach out if you need a helping hand. I’m here for all your MikroTik mischief!


Secretly (but not so secretly) penned by:
Emmanuel Corels – The One, The Only, The Admin at
Emmanuel Corels Creatives

(Join us next time for more MikroTik shenanigans!)


Does this help?

« Back