How to setup an L2TP/IPSec VPN server on MikroTik

If you own a mikrotik router and would like to access your home network from anywhere in the world, or while at work then you can follow this guide. 🙂

IMO, this is a much better option than having to use TeamViewer to access your PC remotely. You could setup a VPN server on your home network instead for free, and then access whatever PC you want to on your home network with Remote Desktop, VNC or whatever you want to use. You could even use this to access files on your network, or even access your printer at home from the internet, or whatever you want to. The important thing is that it will be as if your PC is on your home network when you’re not at home. 🙂


There are multiple different types of VPN connections you could create, like PPTP, SSTP, OpenVPN and L2TP.

I have found that PPTP is the most simple to setup, but apprently it isn’t secure.

An OpenVPN server is probably the hardest to setup out of all of them, and haven’t ever set it up on a mikrotik router before, but it is probly the most secure. So I thought I would use an L2TP VPN as its quite secure, and not that hard to setup.

This guide assumes that your router already has the basics setup (can access the internet, etc).

Step 1: First we need to create an IP Pool

This is what is going to determine what IP addresses get handed out to the clients connecting to your VPN server.

You can find this by clicking on IP on the left, then Pool.


Step 2: Now we need to create a profile

On the left click on PPP, then go to the “Profiles” tab.


The local address is going to be the IP that the VPN clients can use to communicate with the router. (In the screenshot I used, but it should have been instead since 253 is part of the IP Pool)

The remote address will be the IPs that get handed out to the VPN clients, over here you select the IP Pool that you created in step 1.

The DNS Server will be the dns server your VPN clients use, you can make it use your router’s DNS ( in this case) or you can just set it to Google’s DNS or whatever DNS servers you want to use.

Step 3: We will now create a username and password

Now in the PPP window go to the “Secrets” tab.


Name: This will be the username to log in to the VPN.

Password: The password to log in to the VPN.

Profile: Change this to the profile that you created in step 2.

Step 4: Setting up the L2TP Interface

In the PPP window changes to the “Interface” tab.


  1. Check the enabled block.
  2. Change the profile to the one you created in step 2.
  3. Untick all the authentication methods except mschap2.
  4. I have only ever used mschap2 authentication, never tried any of the others but mschap2 works just fine.

Step 5: Setting up the IPSec peer

On the left click on IP, then IPSec and change to the “Peers” tab.


  1. Fill in the secret (this is a password you will share with all the VPN clients)
  2. Change the Exchange Mode to “main l2tp”
  3. Enable “Send Initial Contract” and “NAT Traversal”
  4. Enable “Generate Policy”
  5. Change the hash algorithm to “sha” it is better than md5.

Step 6: Change the default proposal

In the IPSec window change to the “Proposals” tab.


  1. Choose sha1 for Auth. Algorithms.
  2. Choose 3des for Encr. Algorithms.
  3. Set PFS Group to “none”

Step 7: Create a NAT rule

Im not sure if this step is really necessary or not, but I had to do this on my router before it would work.

On the left click IP, then select Firewall and go to the “NAT” tab.

Create a NAT rule that looks like my example below:


and under the “Action” tab set the action to “redirect” like my example below,:


Step 8: Set up the client (Windows 10)

Go to Start >> Settings >> Network & Internet >> VPN >> Add a VPN connection


  1. VPN Provider: Windows (built-in)
  2. Connection name: Whatever you want.
  3. Server name or address: The IP of the WAN Interface (This is the external IP of your router, usually this will be your no-ip, dyndns, duckdns, etc)
  4. VPN type: Layer 2 Tunnelling Protocol with IPsec (L2TP/IPsec)
  5. Type of sign-in info: Username and password
  6. Username: The username you created in step 3.
  7. Password The password you created in step 3.
  8. Click Save.
  9. Now click on “Change adapter options”
  10. Right click on your VPN connection, then click properties.
  11. Go to the Security Tab.
  12. Click on “Advanced settings”
  13. Check the “Use pre-shared key for authentication” radio button, then enter the shared key you made in step 5.
  14. Make sure your settings look like mine in the example below:



Thats it! You should be able to connect to your VPN server with this configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *