{"id":16193,"date":"2022-11-17T05:35:28","date_gmt":"2022-11-17T05:35:28","guid":{"rendered":"https:\/\/theemailshop.co.uk\/?p=16193"},"modified":"2022-11-22T10:26:12","modified_gmt":"2022-11-22T10:26:12","slug":"how-to-configure-l2tp-vpn-on-linux-ubuntu","status":"publish","type":"post","link":"https:\/\/theemailshop.co.uk\/how-to-configure-l2tp-vpn-on-linux-ubuntu\/","title":{"rendered":"How to Configure l2tp VPN on Linux Ubuntu"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">L2TP is a tunneling protocol that was developed to facilitate connections to virtual private networks (VPNs) via the internet. Its full name is Layer 2 Tunneling Protocol, and its acronym is L2TP. It is included in the majority of current operating systems, if not all of them, including <strong><a href=\"https:\/\/theemailshop.co.uk\/linux-hosting-uk\/\">Linux<\/a> <\/strong>and devices that can connect to VPNs.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">L2TP does not offer any authentication or encryption procedures directly to the traffic that flows through it. Most of the time, encryption for the L2TP tunnel is provided by using L2TP with the IPsec authentication suite (L2TP\/IPsec).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this post, we&#8217;ll show you how to set up Ubuntu, Ubuntu&#8217;s forks, and Fedora Linux so that they can connect to an L2TP\/IPSec virtual private network.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This article will assume that the L2TP\/IPsec VPN server has already been set up and that the system administrator at your company or organization has given you the following VPN connection information.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Keep in mind that the L2TP VPN we&#8217;re configuring here is far more secure than the PPTP VPN server. OpenVPN is an alternate VPN protocol to L2TP, but it needs the user to install OpenVPN client software on their end device.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">However, L2TP VPNs have native compatibility across a wider range of platforms, including desktop and mobile versions of Windows, macOS, Ubuntu, RHEL, and CentOS (iOS [iPhones, iPads], Android, and Windows Phone).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Since Precise, Ubuntu no longer includes built-in support for L2TP over IPSec. Fortunately, network-manager-l2tp provides a fix for this. To avoid eavesdropping, an IPsec VPN encrypts all data sent between your device and the VPN server.<\/span><\/p>\n<p><strong> If you often use public Wi-Fi hotspots, such as those found in airports, coffee shops, hotel rooms, etc., you should consider setting up anything like this:<\/strong><\/p>\n<ol>\n<li><span style=\"font-weight: 400;\"> On your device running Debian, go to the Terminal application and log in using the root user. If you are not already logged in as the root user, run the following command and enter the root password.\u00a0<\/span><\/li>\n<\/ol>\n<p><strong><i>Sudo-S<\/i><\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16365 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-6.png\" alt=\"\" width=\"512\" height=\"304\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-6.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-6-300x178.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<ol start=\"2\">\n<li><span style=\"font-weight: 400;\"> Simply execute the following command and then hit the Enter key to begin the installation of the required packages.\u00a0<\/span><\/li>\n<\/ol>\n<p><strong>apt-get -y install xl2tpd<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16366 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-7.png\" alt=\"\" width=\"512\" height=\"304\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-7.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-7-300x178.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<ol start=\"3\">\n<li><span style=\"font-weight: 400;\"> In order to set up StrongSwan, an open-source IPSec-based VPN solution for Linux, type the following command into the terminal. To begin, press the Enter key.<\/span><\/li>\n<\/ol>\n<p><strong>apt-get -y install strongswan<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16367 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-8.png\" alt=\"\" width=\"512\" height=\"307\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-8.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-8-300x180.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<ol start=\"4\">\n<li><span style=\"font-weight: 400;\"> Use the appropriate editor to make changes to the file \/etc\/ipsec.conf.\u00a0<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">Vim was the text editor that was used for this (for more information, see https:\/\/help.ubuntu.com\/community\/VimHowto). You may save yourself some trouble by using the Nano tool instead (https:\/\/help.ubuntu.com\/community\/Nano), which is available to you if you so want. Simply run the following command into vim and hit the Enter key to begin editing.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>vim \/etc\/ipsec.conf<\/strong><\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16368 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-9.png\" alt=\"\" width=\"512\" height=\"304\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-9.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-9-300x178.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<ol start=\"5\">\n<li><span style=\"font-weight: 400;\"> In order to proceed with this step, you will also need to be familiar with the default gateway that the Ubuntu computer uses. To locate that information, open a new terminal window and put the term &#8220;route&#8221; into it.<\/span><\/li>\n<\/ol>\n<p><strong>Route<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0Find a passage that says anything along these lines:\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">default \u00a0 \u00a0 10.63.3.254 \u00a0 \u00a0 0.0.0.0 \u00a0 \u00a0 \u00a0 \u00a0 UG\u00a0 \u00a0 0\u00a0 \u00a0 \u00a0 0\u00a0 \u00a0 \u00a0 \u00a0 0 eth0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The default gateway is located in the second column, while interface information may be found in the last column.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In addition to this, you may use the ip command:\u00a0<\/span><\/p>\n<p><strong>ip route<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">which will give you something like\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">default via 10.63.3.254 dev eth0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After you have determined which network interface is the machine&#8217;s default gateway, open the \/etc\/ipsec.conf configuration file in Vim or Nano in one of the other terminal windows, and then enter the appropriate information.\u00a0<\/span><\/p>\n<p style=\"text-align: center;\"><strong>You May Also Like To Read: <\/strong><strong><a href=\"https:\/\/theemailshop.co.uk\/best-linux-hosting\/\">How to Find the Best Linux Hosting? A Comprehensive Guide to the Journey<\/a><\/strong><\/p>\n<p><strong>vim \/etc\/ipsec.conf contents:<\/strong><\/p>\n<p><i><span style=\"font-weight: 400;\">configure setup\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">conn L1TP-PSK\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">authb=secret\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">auto=ad\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">keyingtriesy=2\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">dpddelay=35\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">dpdtimeouty=122\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">dpdactional=clearer\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">rekeyies=yes\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">ikelifetimy=8h\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">keylifr=1h<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">type = transportation<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">\u00a0# Replace IP address with your current default gateway IP\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">left= &lt;IP ADDRESS GATEWAY&gt;\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">leftprotoport=17\/1703\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\"># Replace IP address with your VPN server&#8217;s IP\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">right=&lt; SERVER VPN\u00a0 ADDRESS&gt;\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">rightprotoport=17\/1701<\/span><\/i><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16369 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-10.png\" alt=\"\" width=\"512\" height=\"307\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-10.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-10-300x180.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<ol start=\"6\">\n<li><span style=\"font-weight: 400;\"> Type vim \/ipsec.secrets for the\u00a0 modification of ipsec secrets.<br \/>\n<img decoding=\"async\" class=\"aligncenter wp-image-16370 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-11.png\" alt=\"\" width=\"512\" height=\"307\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-11.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-11-300x180.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> Replace the first IP with your own, the second with that of your VPN server, and the which was before key between the quotes with the one that applies to your network (shown in the customer area). Gaco here for additional information):<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">&lt; SERVER VPN\u00a0 ADDRESS &gt; &lt;ADDRSS SERVER&gt; : PSK &lt;PER=SHARED KEYS&gt; obtained from Client Area.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16371 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-12.png\" alt=\"\" width=\"512\" height=\"301\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-12.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-12-300x176.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<ol start=\"8\">\n<li><span style=\"font-weight: 400;\"> Modify \/etc\/xl2t\/xl2t.configure as follows:<\/span><span style=\"font-weight: 400;\"><br \/>\n<img decoding=\"async\" class=\"aligncenter wp-image-16372 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-13.png\" alt=\"\" width=\"512\" height=\"302\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-13.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-13-300x177.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> After clearing off the contents of configuration file, add the lines below.\u00a0<\/span><\/li>\n<\/ol>\n<p><i><span style=\"font-weight: 400;\">[lac strong-vpn]\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">lns = &lt;VPN IP\u00a0 SERVER ADDRESS&gt;\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">ppp debuging = yes\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">pppoptfile = \/etc\/ppp\/options.l2tpd.client\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">length bit = yes<\/span><\/i><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16373 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-14.png\" alt=\"\" width=\"512\" height=\"307\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-14.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-14-300x180.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<ol start=\"10\">\n<li><span style=\"font-weight: 400;\"> Replace the VPN password and the username in the following code when creating \/etc\/ppp\/options.l2tpd.client:<br \/>\n<img decoding=\"async\" class=\"wp-image-16374 size-full aligncenter\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-15.png\" alt=\"\" width=\"512\" height=\"307\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-15.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-15-300x180.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> The below lines should be added to \/etc\/ppp\/options.l2tpd.client file, it will be a new file. ipc-accept-localization\u00a0<\/span><\/li>\n<\/ol>\n<p><i><span style=\"font-weight: 400;\">Ipcp-accepted-remot<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">efuse-eap\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">require-mschaption-v2\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">idle 1801\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">mtu 1415<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">mru 1416\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">defaulting replace defaultation troute\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">use peer dnsation\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">debuging\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">locking\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">connect-delay 5012\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">name &lt;USER NAME&gt;\u00a0<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">password &lt;TYPE PASSWORD&gt;<\/span><\/i><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-16375 size-full\" src=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-16.png\" alt=\"\" width=\"512\" height=\"307\" srcset=\"https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-16.png 512w, https:\/\/theemailshop.co.uk\/wp-content\/uploads\/2022\/11\/unnamed-16-300x180.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>For Discount and Offers, Visit our Official\u00a0<strong><a href=\"https:\/\/twitter.com\/TheEmailShopUK\" target=\"_blank\" rel=\"noopener\">Twitter<\/a>\u00a0<\/strong>Page<\/p>\n","protected":false},"excerpt":{"rendered":"<p>L2TP is a tunneling protocol that was developed to facilitate connections to virtual private networks (VPNs) via the internet. Its full name is Layer 2 Tunneling Protocol, and its acronym is L2TP. It is included in the majority of current operating systems, if not all of them, including Linux and devices that can connect to [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":16240,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1280,1151],"tags":[2937,2935,2936,2939,2938],"class_list":["post-16193","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-linux-hosting","tag-fedora-linux","tag-l2tp","tag-linux-ubuntu","tag-ubuntu","tag-ubuntus-forks"],"_links":{"self":[{"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/posts\/16193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/comments?post=16193"}],"version-history":[{"count":8,"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/posts\/16193\/revisions"}],"predecessor-version":[{"id":16376,"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/posts\/16193\/revisions\/16376"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/media\/16240"}],"wp:attachment":[{"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/media?parent=16193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/categories?post=16193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theemailshop.co.uk\/wp-json\/wp\/v2\/tags?post=16193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}