{"id":326,"date":"2021-11-10T23:11:00","date_gmt":"2021-11-10T21:11:00","guid":{"rendered":"https:\/\/binaryvikings.io\/?p=326"},"modified":"2021-11-10T23:11:47","modified_gmt":"2021-11-10T21:11:47","slug":"unifi-usg-l2tp-vpn-not-working-with-radius-authentication","status":"publish","type":"post","link":"https:\/\/binaryvikings.io\/?p=326","title":{"rendered":"[Unifi] USG L2TP VPN not working with RADIUS Authentication"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"242\" src=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2020\/02\/quickguide.png\" alt=\"\" class=\"wp-image-240\" srcset=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2020\/02\/quickguide.png 865w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2020\/02\/quickguide-300x84.png 300w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2020\/02\/quickguide-768x215.png 768w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\" \/><\/figure>\n\n\n\n<p>For quite a long time I was unable to connect to my network through VPN on the USG device. Unifi 6.4.54.0, and somewhere since 6.2.x or so.. <\/p>\n\n\n\n<p><strong>Quick scroll for solution?!<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-step<\/h2>\n\n\n\n<p>I connected through SSH to the USG to investigate, to see what went wrong when trying to connect. Below, you see the cut out from <strong>\/var\/log\/messages<\/strong> when attempting to connect through VPN. (IP and username x&#8217;d out).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tail -15 \/var\/log\/messages<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Nov 10 21:03:32 Heimdal xl2tpd&#91;974]: Connection established to 80.xx.xxx.xxx, 59435.  Local: 5857, Remote: 8 (ref=0\/0).  LNS session is 'default'\nNov 10 21:03:32 Heimdal xl2tpd&#91;974]: Call established with 80.xx.xxx.xxx, PID: 2174, Local: 64011, Remote: 3350, Serial: 1\nNov 10 21:03:32 Heimdal pppd&#91;2174]: pppd 2.4.4 started by root, uid 0\nNov 10 21:03:32 Heimdal zebra&#91;758]: interface ppp0 index 22 &lt;POINTOPOINT,NOARP,MULTICAST&gt; added.\nNov 10 21:03:32 Heimdal pppd&#91;2174]: Connect: ppp0 &lt;--&gt;\nNov 10 21:04:05 Heimdal pppd&#91;2174]: rc_send_server: no reply from RADIUS server setup.ubnt.com:1812\nNov 10 21:04:05 Heimdal pppd&#91;2174]: Peer xxxxxx failed CHAP authentication\nNov 10 21:04:11 Heimdal pppd&#91;2174]: Connection terminated: no multilink.\nNov 10 21:04:11 Heimdal zebra&#91;758]: interface ppp0 index 22 deleted.\nNov 10 21:04:11 Heimdal pppd&#91;2174]: Modem hangup\nNov 10 21:04:17 Heimdal kernel: Process 930 (freeradius) has crashed (parent 1 (init) signal 6, code -6, addr 000003a200000066), coredumps disabled\n<\/code><\/pre>\n\n\n\n<p>As seen it does make a connection, however appears to not get a reply from the RADIUS server, and then proceed to fail CHAP authentication. (Nice crash at the end there, freeradius, by the way).<\/p>\n\n\n\n<p>&#8230;Investigating further into the VPN logs&#8230; (IPs x&#8217;d out).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>show vpn log<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Nov 10 21:03:30 15&#91;IKE] &lt;1&gt; 80.xx.xxx.xxx is initiating a Main Mode IKE_SA\nNov 10 21:03:31 01&#91;IKE] &lt;remote-access|1&gt; IKE_SA remote-access&#91;1] established between 91.xx.xxx.xxx&#91;91.xx.xxx.xxx]...80.xx.xxx.xxx&#91;10.xx.xxx.xxx]\nNov 10 21:03:32 12&#91;IKE] &lt;remote-access|1&gt; CHILD_SA remote-access{1} established with SPIs cddf1472_i 06729c76_o and TS 91.xx.xxx.xxx\/32&#91;udp\/l2f] === 80.xx.xxx.xxx\/32&#91;udp\/59435]\nNov 10 21:04:05 02&#91;IKE] &lt;remote-access|1&gt; closing CHILD_SA remote-access{1} with SPIs cddf1472_i (1548 bytes) 06729c76_o (502 bytes) and TS 91.xx.xxx.xxx\/32&#91;udp\/l2f] === 80.xx.xxx.xxx\/32&#91;udp\/59435]\nNov 10 21:04:05 15&#91;IKE] &lt;remote-access|1&gt; deleting IKE_SA remote-access&#91;1] between 91.xx.xxx.xxx&#91;91.xx.xxx.xxx]...80.xx.xxx.xxx&#91;10.xx.xxx.xxx]\nNov 10 21:04:11 04&#91;KNL] interface ppp0 deleted\n<\/code><\/pre>\n\n\n\n<p>Establishes connection, but quickly after kills connection and deletes the ppp0 interface. Didn&#8217;t feel like a firewall issue at this point.<\/p>\n\n\n\n<p>So far it looks to be a RADIUS issue, so next log I checked was <strong>\/var\/log\/freeradius\/radius.log <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -25 \/var\/log\/freeradius\/radius.log<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Wed Nov 10 20:03:35 2021 : Error: Ignoring request to authentication address * port 1812 from unknown client 13.37.0.1 port 40914\nWed Nov 10 20:03:45 2021 : Error: Ignoring request to authentication address * port 1812 from unknown client 13.37.0.1 port 40914\nWed Nov 10 20:03:55 2021 : Error: Ignoring request to authentication address * port 1812 from unknown client 13.37.0.1 port 40914\n<\/code><\/pre>\n\n\n\n<p>In here, there&#8217;s a match for several &#8220;Error: Ignoring request to authentication address * port 1812 from unknown client 13.37.0.1 port XXXXX&#8221; &#8211; any high-port.<\/p>\n\n\n\n<p>As it appears, it is ignoring the request, due to the fact that it does not know the client.<\/p>\n\n\n\n<p>Going back to the <strong>RADIUS<\/strong> page on the controller web UI, you can see the <strong>Configure clients section for whole network<\/strong> is indeed <em>&#8220;not supported right now&#8221;<\/em>. Doing a bit of good old Googlin&#8217; narrowed it down to 2 solutions. One more silly than the other.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"691\" height=\"379\" src=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image.png\" alt=\"\" class=\"wp-image-327\" srcset=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image.png 691w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-300x165.png 300w\" sizes=\"auto, (max-width: 691px) 100vw, 691px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Solution 1<\/strong><\/h2>\n\n\n\n<p>&#8230; from UI-Team <a rel=\"noreferrer noopener\" href=\"https:\/\/community.ui.com\/questions\/USG-L2TP-issue-Authentication-Failed\/17ecd602-5c95-4b35-8dd6-7fcacbfd892c#answer\/88d832b6-3a68-490c-a3bb-d70b5fdbf29c\" data-type=\"URL\" data-id=\"https:\/\/community.ui.com\/questions\/USG-L2TP-issue-Authentication-Failed\/17ecd602-5c95-4b35-8dd6-7fcacbfd892c#answer\/88d832b6-3a68-490c-a3bb-d70b5fdbf29c\" target=\"_blank\">https:\/\/community.ui.com\/questions\/USG-L2TP-issue-Authentication-Failed\/17ecd602-5c95-4b35-8dd6-7fcacbfd892c#answer\/88d832b6-3a68-490c-a3bb-d70b5fdbf29c<\/a><\/p>\n\n\n\n<p>First off, this post confirms that there is indeed an issue configuring RADIUS using <em>New Settings<\/em>. The steps below will disable the RADIUS server, but the Clients tick box will be enabled after re-enabling the RADIUS server.<\/p>\n\n\n\n<p>Suggestion is to SSH to the controller and type in the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mongo localhost:27117\/ace\ndb.setting.deleteOne({\"key\":\"radius\"})\nexit<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"639\" height=\"127\" src=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-1.png\" alt=\"\" class=\"wp-image-328\" srcset=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-1.png 639w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-1-300x60.png 300w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/figure>\n\n\n\n<p>This throws an error on my server, as I&#8217;m using an older version of MongoDB. Try the below code for removing if you get the same:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>db.setting.remove({\"key\":\"radius\"})<\/code><\/pre>\n\n\n\n<p>Reloading the page and re-enabling the RADIUS server, we get the following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"532\" height=\"222\" src=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-2.png\" alt=\"\" class=\"wp-image-329\" srcset=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-2.png 532w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-2-300x125.png 300w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><\/figure>\n\n\n\n<p>&#8230; and more importantly &#8211; it worked.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution 2<\/h2>\n\n\n\n<p>&#8230;this is my favorite (and &#8220;silly&#8221;). <a rel=\"noreferrer noopener\" href=\"https:\/\/community.ui.com\/questions\/L2TP-with-USG-Radius-not-working\/4e82b542-f165-4356-ba52-d419f29722f8#answer\/bec569d7-7947-407b-b43c-d5534107587d\" data-type=\"URL\" data-id=\"https:\/\/community.ui.com\/questions\/L2TP-with-USG-Radius-not-working\/4e82b542-f165-4356-ba52-d419f29722f8#answer\/bec569d7-7947-407b-b43c-d5534107587d\" target=\"_blank\">https:\/\/community.ui.com\/questions\/L2TP-with-USG-Radius-not-working\/4e82b542-f165-4356-ba52-d419f29722f8#answer\/bec569d7-7947-407b-b43c-d5534107587d<\/a><\/p>\n\n\n\n<p>Open eg. Chrome. Right-click on the checkbox in <strong>Clients<\/strong> and click <strong>Inspect<\/strong>.<\/p>\n\n\n\n<p>Navigate to the part where it says <strong>disabled<\/strong> &#8211; mark it and delete it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"138\" src=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-3-1024x138.png\" alt=\"\" class=\"wp-image-330\" srcset=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-3-1024x138.png 1024w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-3-300x40.png 300w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-3-768x104.png 768w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-3.png 1253w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The checkbox will now be clickable &#8211; click it and remember to click the green <strong>APPLY CHANGES <\/strong>button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"908\" height=\"241\" src=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-4.png\" alt=\"\" class=\"wp-image-331\" srcset=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-4.png 908w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-4-300x80.png 300w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-4-768x204.png 768w\" sizes=\"auto, (max-width: 908px) 100vw, 908px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>For giggles you can run the following command when you attempt next connection to double verify your connection:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -f \/var\/log\/freeradius\/radius.log<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"906\" height=\"37\" src=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-5.png\" alt=\"\" class=\"wp-image-332\" srcset=\"https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-5.png 906w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-5-300x12.png 300w, https:\/\/binaryvikings.io\/wp-content\/uploads\/2021\/11\/image-5-768x31.png 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>For quite a long time I was unable to connect to my network through VPN on the USG device. Unifi 6.4.54.0, and somewhere since 6.2.x<\/p>\n","protected":false},"author":1,"featured_media":243,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[24,13,25],"tags":[],"class_list":["post-326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-network","category-support","category-ubiquiti"],"_links":{"self":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts\/326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=326"}],"version-history":[{"count":4,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts\/326\/revisions"}],"predecessor-version":[{"id":336,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/posts\/326\/revisions\/336"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=\/wp\/v2\/media\/243"}],"wp:attachment":[{"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryvikings.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}