MikroTik l2tp VPN setup | A Hidden Gem for Online Freedom

Learn how to set up L2TP VPN on your MikroTik router quickly and securely. Follow our step-by-step guide for a seamless VPN configuration.

Updated: 09 Aug, 24 by Lisa P 6 Min

The internet is evolving. More and more websites and services restrict access based on your location. Many governments limit the internet and you will need a VPN to prevent these restrictions and secure your privacy. However, there are differences between VPNs. If you want more safety and customization, Mikrotik is a suitable answer. Mikrotik's routers are known for their power and flexibility. While they've long been popular among IT professionals, they're also becoming increasingly important to everyone else. So, you want to access your favorite shows, websites, and social networks from anywhere in the world? Let`s see what is MikroTik l2tp VPN and how to set it up. 

What is MikroTik l2tp VPN?

Layer 2 Tunneling Protocol (L2TP) is a protocol that extends a point-to-point connection across a network that is packet-switched. When paired with IPsec, this protocol creates a secure and trustworthy virtual private network (VPN). Mikrotik RouterOS is an advanced router operating system that supports L2TP VPN connections. This enables you to configure a VPN server on your Mikrotik router, allowing remote users to securely access your network.

Key Features and Benefits

  • Secure transmission due to encrypted data. 
  • Allows users to connect to your network from anywhere.
  • Offers various options for customization.
  • More affordable than dedicated VPN services.

How It Works

  • L2TP establishes a tunnel: Creates a virtual connection between the client and server.
  • IPsec encrypts data: Protects the data transmitted through the tunnel.
  • PPP (Point-to-Point Protocol) handles authentication: Verifies user credentials.

Typical Use Cases

  • Remote access for employees.
  • Secure connection for home users.
  • Connecting branch offices to a central network.

How to set up mikrotik l2tp vpn?

Alright, it's time to set up your Mikrotik L2TP VPN. Before anything, you need to go to your Mikrotik router and log in. Then, you're all set to go! You don't need any special stuff. All you need to do is follow these steps:

Step 1: Set Up Your PPP Profile

In the first step of MikroTik l2tp VPN setup process, you need to create a PPP profile. To do that, you need to follow these steps:

  1. Go to the PPP section on your Mikrotik router and click on "profiles".
  2. Find and hit "add new". 
  3. Give it a cool name and set the local address to your router's internal IP. 
  4. For the remote address, pick "example pool" for now. 
  5. And the last step, set the bridge to "Internal". 
  6. That's it for now! Click "apply" and you've got your first piece in place.

Step 2: Create a User for Your VPN

In the second step, you need to create a PPP user for your VPN. Follow the below steps:

  1. Go to the PPP section again. 
  2. This time you should click on "secrets". 
  3. Click "add new" and enter the same username you created in the last step.
  4. Create a strong password and set "services" to "any". 
  5. Then, choose the profile you just made. 
  6. Click "apply" and you've got your user set up!

Step 3: Link Your User to the VPN Server

Return to the PPP section and click on "interface". Then click "Add New" and select "L2TP Server Binding". Assign it a name, and then use the same username you selected earlier. Click "apply" and you've connected your user to the VPN server.

Step 4: Turn On Your VPN Server

Now, you need to enable the L2TP server. All you need to do is:

  1. Return to the PPP area of your Mikrotik router. 
  2. Go to the interface tab, then find and pick the L2TP server option. 
  3. In the default profile field, select the profile you created in Step 1.
  4. To enable the "Use IPsec" feature, pick "Yes" from the available options. 
  5. To complete the setup, create a strong password for your L2TP server and enter it into the designated space. 
  6. Once all of the details have been entered correctly, click the "apply" button to save your settings. 

Step 5: Configure Your Firewall (Optional)

This step is optional and if you're sure your firewall is already open, you don’t need this step so you can skip it. But, if your firewall is blocking the ports L2TP uses (50, 1701, and 4500), you'll need to create some firewall rules to allow them through. 

To create the rules, go to the IP section, then the firewall, and click "add new". You'll need to create two rules. Make sure to place these rules above any other drop rules so they take priority.

Rule 1:

  • Chain: input
  • Protocol: 50 (IPsec-esp)
  • In. Interface: ether1
  • Action: accept

Rule 2:

  • Chain: input
  • Protocol: 17 (udp)
  • Dst. Port: 500,1701,4500
  • In. Interface: ether1
  • Action: accept

Step 6: Adjust IPsec Settings for Mac Compatibility (Optional)

Do you want compatibility with Mac devices? So, all you need is to adjust the default IPsec policy. If you're not connected to a VPN with your Mac device, you don’t need this step and you can skip it.

  1. Navigate to the IP section. 
  2. select "policy proposals".
  3. click on "default".
  4. In the "Auth. Algorithms" section, check the boxes for "ha1" and "sha256". 
  5. Next, in the "Encr. Algorithm" section, select both "aes-128 cbc" and "aes-256 cbc". 
  6. Finally, choose "modp 1024" for the "PFS group". 
  7. Click "apply" to save the changes.

Step 7: Finalize IPsec Settings

Now, in the last step of MikroTik l2tp VPN setup process, you need to ensure the connections for all devices are smooth. To do that, you should adjust the IPsec default peer profile. Don’t know how to do that? We tell you here:

  1. Go to the IP section
  2. Then navigate to IPsec followed by Peer Profile. 
  3. Select the default profile. 
  4. Set the hash algorithm to sha256, the encryption algorithm to aes-256, and the DH Group to modp 1024. 
  5. Finally, enable the "Obey Proposal" and "NAT Traversal" options. 
  6. Click "apply" to save these changes.

Conclusion

So, you've cracked the code for configuring your Mikrotik L2TP VPN. Congratulations; that was no little feat. But why should we care about Mikrotik l2tp VPN setup? Actually, it's a super-secure, individualized internet tunnel. That is what you have built. While you can completely set up your VPN at home, operating it on a dedicated server, such as a VPS, is much easier. It`s a great option for people who want a high level of control over their online privacy and security. 

Lisa P

Lisa P

Hello, everyone, my name is Lisa. I'm a passionate electrical engineering student with a keen interest in technology. I'm fascinated by the intersection of engineering principles and technological advancements, and I'm eager to contribute to the field by applying my knowledge and skills to solve real-world problems.