{"id":142,"date":"2012-08-27T19:02:29","date_gmt":"2012-08-27T15:02:29","guid":{"rendered":"http:\/\/xxxl.co.za\/?page_id=142"},"modified":"2012-08-27T19:42:41","modified_gmt":"2012-08-27T15:42:41","slug":"centos-l2tp-client-to-mikrotik-l2tp-server","status":"publish","type":"page","link":"https:\/\/xxxl.co.za\/?page_id=142","title":{"rendered":"Centos L2TP Client to Mikrotik L2TP-Server"},"content":{"rendered":"<h5>The mission:<\/h5>\n<p>So the object here was to make Centos servers connect via L2TP to a Mikrotik LAC in order to provide connectivity with private ip&#8217;s.<\/p>\n<p>This example will build a persistent L2TP tunnel which will auto reconnect and try to remain persistent.<\/p>\n<h6>On Mikrotik L2TP Server:<\/h6>\n<p>I used standard ppp profile in this example.<\/p>\n<pre>\/ppp profile\r\nset default change-tcp-mss=yes comment=\"\" name=default only-one=default \\\r\nuse-compression=default use-encryption=default use-vj-compression=default<\/pre>\n<p>Configured a secret in Mikrotik:<\/p>\n<pre>\/ppp secret\r\nadd caller-id=\"\" disabled=no limit-bytes-in=0 limit-bytes-out=0 local-address=10.0.0.1 name=MyUserName password=MyPassword profile=default \\\r\nremote-address=10.0.0.254 routes=\"\" service=l2tp<\/pre>\n<h6>On Mikrotik L2TP Server:<\/h6>\n<p>Install xl2tp from EPEL repo<\/p>\n<pre>yum install xl2tpd<\/pre>\n<p>Change \/etc\/xl2tpd\/xl2tpd.conf<\/p>\n<pre>; This is a minimal sample xl2tpd configuration file for use as L2TP client.\r\n;\r\n[global]\r\ndebug tunnel = yes\r\n\r\n[lac vpnserver]\r\nlns = yourserverip\r\nppp debug = yes\r\npppoptfile = \/etc\/ppp\/options.xl2tpd.client\r\nlength bit = yes\r\nredial = yes\r\nredial timeout = 2\r\nautodial = yes<\/pre>\n<p>create or edit if exists \/etc\/ppp\/options.xl2tpd.client<\/p>\n<pre>ipcp-accept-local\r\nipcp-accept-remote\r\nrefuse-eap\r\nrequire-mschap-v2\r\nnoccp\r\nnoauth\r\nidle 1800\r\nmtu 1410\r\nmru 1410\r\nnodefaultroute\r\ndebug\r\nlock\r\nconnect-delay 5000\r\nname MyUserName\r\npassword MyPassword\r\npersist\r\nmaxfail 0<\/pre>\n<p>Create file: \/etc\/ppp\/ip-up.local and remember to chmod +x &#8230;.<\/p>\n<pre>#!\/bin\/sh\r\n# Where 10.0.0.1 is the Tunnel endpoint IP defined on Mikrotik or Linux LAC  \r\ncase  in\r\n        10.0.0.1)\r\n        # VPN - IP ROUTE BEING ADDED AT RECONNECTION\r\n                route add -net 10.0.0.0\/24 gw 10.0.0.1;\r\n        ;;\r\nesac<\/pre>\n<p>Now start xl2tpd..<\/p>\n<pre>\/etc\/init.d\/xl2tpd start<\/pre>\n<p>Result: ifconfig&#8230;.<\/p>\n<pre>[root@myserv ~]# ifconfig ppp0\r\nppp0      Link encap:Point-to-Point Protocol\r\n          inet addr:10.0.0.254  P-t-P:10.0.0.1  Mask:255.255.255.255\r\n          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1410  Metric:1\r\n          RX packets:1198 errors:0 dropped:0 overruns:0 frame:0\r\n          TX packets:1260 errors:0 dropped:0 overruns:0 carrier:0\r\n          collisions:0 txqueuelen:3\r\n          RX bytes:156001 (152.3 KiB)  TX bytes:1144669 (1.0 MiB)<\/pre>\n<p>&nbsp;<\/p>\n<p>A Snippet of the routing table&#8230;<\/p>\n<pre>[root@myserv ~]# route -n\r\nKernel IP routing table\r\nDestination     Gateway         Genmask         Flags Metric Ref    Use Iface\r\n10.254.255.1    0.0.0.0         255.255.255.255 UH    0      0        0 ppp0\r\n10.254.255.0    10.254.255.1    255.255.255.0   UG    0      0        0 ppp0<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The mission: So the object here was to make Centos servers connect via L2TP to a Mikrotik LAC in order to provide connectivity with private ip&#8217;s. This example will build a persistent L2TP tunnel which will auto reconnect and try to remain persistent. On Mikrotik L2TP Server: I used standard ppp profile in this example. &hellip; <a href=\"https:\/\/xxxl.co.za\/?page_id=142\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Centos L2TP Client to Mikrotik L2TP-Server<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"_crdt_document":"","footnotes":""},"class_list":["post-142","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/xxxl.co.za\/index.php?rest_route=\/wp\/v2\/pages\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xxxl.co.za\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/xxxl.co.za\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/xxxl.co.za\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xxxl.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=142"}],"version-history":[{"count":24,"href":"https:\/\/xxxl.co.za\/index.php?rest_route=\/wp\/v2\/pages\/142\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/xxxl.co.za\/index.php?rest_route=\/wp\/v2\/pages\/142\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/xxxl.co.za\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}