{"id":13,"date":"2015-09-09T19:08:45","date_gmt":"2015-09-09T19:08:45","guid":{"rendered":"https:\/\/blog.koffie.co.za\/?p=13"},"modified":"2026-01-03T20:28:43","modified_gmt":"2026-01-03T18:28:43","slug":"how-to-setup-an-l2tp-vpn-server-on-mikrotik","status":"publish","type":"post","link":"https:\/\/blog.koffie.co.za\/?p=13","title":{"rendered":"How to setup an L2TP\/IPSec VPN server on MikroTik"},"content":{"rendered":"<p>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.<\/p>\n<p>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&#8217;re not at home.<\/p>\n<p>&nbsp;<\/p>\n<p>There are multiple different types of VPN connections you could create, like PPTP, SSTP, OpenVPN and L2TP.<\/p>\n<p>I have found that PPTP is the most simple to setup, but apprently it isn&#8217;t secure.<\/p>\n<p>An OpenVPN server is probably the hardest to setup out of all of them, and haven&#8217;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.<\/p>\n<p>This guide assumes that your router already has the basics setup (can access the internet, etc).<\/p>\n<h3><span style=\"text-decoration: underline;\">Step 1: First we need to create an IP Pool<\/span><\/h3>\n<p>This is what is going to determine what IP addresses get handed out to the clients connecting to your VPN server.<\/p>\n<p>You can find this by clicking on IP on the left, then Pool.<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-16\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image1.png\" alt=\"MikroTik-Image1\" width=\"499\" height=\"378\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image1.png 499w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image1-300x227.png 300w\" sizes=\"auto, (max-width: 499px) 100vw, 499px\" \/><\/a><\/p>\n<h3><span style=\"text-decoration: underline;\">Step 2: Now we need to create a profile<\/span><\/h3>\n<p>On the left click on PPP, then go to the &#8220;Profiles&#8221; tab.<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-17\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image2.png\" alt=\"MikroTik-Image2\" width=\"775\" height=\"600\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image2.png 775w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image2-300x232.png 300w\" sizes=\"auto, (max-width: 775px) 100vw, 775px\" \/><\/a><\/p>\n<p>The local address is going to be the IP that the VPN clients can use to communicate with the router. (<span style=\"color: #ff0000;\">I<\/span><span style=\"color: red;\">n the screenshot I used 192.168.0.253, but it should have been 192.168.0.254 instead since 253 is part of the IP Pool<\/span>)<\/p>\n<p>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.<\/p>\n<p>The DNS Server will be the dns server your VPN clients use, you can make it use your router&#8217;s DNS (192.196.0.<span style=\"color: #ff0000;\">254<\/span> in this case) or you can just set it to Google&#8217;s DNS or whatever DNS servers you want to use.<\/p>\n<h3><span style=\"text-decoration: underline;\">Step 3: We will now create a username and password<\/span><\/h3>\n<p>Now in the PPP window go to the &#8220;Secrets&#8221; tab.<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image3.png\" alt=\"MikroTik-Image3\" width=\"780\" height=\"494\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image3.png 780w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image3-300x190.png 300w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/a><\/p>\n<p>Name: This will be the username to log in to the VPN.<\/p>\n<p>Password: The password to log in to the VPN.<\/p>\n<p>Profile: Change this to the profile that you created in step 2.<\/p>\n<h3><span style=\"text-decoration: underline;\">Step 4: Setting up the L2TP Interface<br \/><\/span><\/h3>\n<p>In the PPP window changes to the &#8220;Interface&#8221; tab.<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-19\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image4.png\" alt=\"MikroTik-Image4\" width=\"778\" height=\"399\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image4.png 778w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image4-300x154.png 300w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/a><\/p>\n<ol>\n<li>Check the enabled block.<\/li>\n<li>Change the profile to the one you created in step 2.<\/li>\n<li>Untick all the authentication methods except mschap2.<\/li>\n<li>I have only ever used mschap2 authentication, never tried any of the others but mschap2 works just fine.<\/li>\n<\/ol>\n<h3><span style=\"text-decoration: underline;\">Step 5: Setting up the IPSec peer<br \/><\/span><\/h3>\n<p>On the left click on IP, then IPSec and change to the &#8220;Peers&#8221; tab.<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image5.png\" alt=\"MikroTik-Image5\" width=\"489\" height=\"645\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image5.png 489w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image5-227x300.png 227w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><\/a><\/p>\n<ol>\n<li>Fill in the secret (this is a password you will share with all the VPN clients)<\/li>\n<li>Change the Exchange Mode to &#8220;main l2tp&#8221;<\/li>\n<li>Enable &#8220;Send Initial Contract&#8221; and &#8220;NAT Traversal&#8221;<\/li>\n<li>Enable &#8220;Generate Policy&#8221;<\/li>\n<li>Change the hash algorithm to &#8220;sha&#8221; it is better than md5.<\/li>\n<\/ol>\n<h3><span style=\"text-decoration: underline;\">Step 6: Change the default proposal<br \/><\/span><\/h3>\n<p>In the IPSec window change to the &#8220;Proposals&#8221; tab.<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image6.png\" alt=\"MikroTik-Image6\" width=\"489\" height=\"446\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image6.png 489w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image6-300x274.png 300w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><\/a><\/p>\n<ol>\n<li>Choose sha1 for Auth. Algorithms.<\/li>\n<li>Choose 3des for Encr. Algorithms.<\/li>\n<li>Set PFS Group to &#8220;none&#8221;<\/li>\n<\/ol>\n<h3><span style=\"text-decoration: underline;\">Step 7: Create a NAT rule<br \/><\/span><\/h3>\n<p>Im not sure if this step is really necessary or not, but I had to do this on my router before it would work.<\/p>\n<p>On the left click IP, then select Firewall and go to the &#8220;NAT&#8221; tab.<\/p>\n<p>Create a NAT rule that looks like my example below:<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image7.png\" alt=\"MikroTik-Image7\" width=\"711\" height=\"662\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image7.png 711w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image7-300x279.png 300w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><\/a><\/p>\n<p>and under the &#8220;Action&#8221; tab set the action to &#8220;redirect&#8221; like my example below,:<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image8.png\" alt=\"MikroTik-Image8\" width=\"716\" height=\"675\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image8.png 716w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image8-300x283.png 300w\" sizes=\"auto, (max-width: 716px) 100vw, 716px\" \/><\/a><\/p>\n<h3><span style=\"text-decoration: underline;\">Step 8: Set up the client (Windows 10)<br \/><\/span><\/h3>\n<p>Go to Start &gt;&gt; Settings &gt;&gt; Network &amp; Internet &gt;&gt; VPN &gt;&gt; Add a VPN connection<\/p>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image9.png\" alt=\"MikroTik-Image9\" width=\"800\" height=\"559\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image9.png 800w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image9-300x210.png 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<ol>\n<li>VPN Provider: Windows (built-in)<\/li>\n<li>Connection name: Whatever you want.<\/li>\n<li>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)<\/li>\n<li>VPN type: Layer 2 Tunnelling Protocol with IPsec (L2TP\/IPsec)<\/li>\n<li>Type of sign-in info: Username and password<\/li>\n<li>Username: The username you created in step 3.<\/li>\n<li>Password The password you created in step 3.<\/li>\n<li>Click Save.<\/li>\n<li>Now click on &#8220;Change adapter options&#8221;<\/li>\n<li>Right click on your VPN connection, then click properties.<\/li>\n<li>Go to the Security Tab.<\/li>\n<li>Click on &#8220;Advanced settings&#8221;<\/li>\n<li>Check the &#8220;Use pre-shared key for authentication&#8221; radio button, then enter the shared key you made in step 5.<\/li>\n<li>Make sure your settings look like mine in the example below:<\/li>\n<\/ol>\n<p><a href=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-25\" src=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image10.png\" alt=\"MikroTik-Image10\" width=\"722\" height=\"492\" srcset=\"https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image10.png 722w, https:\/\/blog.koffie.co.za\/wp-content\/uploads\/2015\/09\/MikroTik-Image10-300x204.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Thats it! You should be able to connect to your VPN server with this configuration.<\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13"}],"version-history":[{"count":10,"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=\/wp\/v2\/posts\/13\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.koffie.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}