<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GL.iNet &#8211; My Shitty Code</title>
	<atom:link href="https://myshittycode.com/tag/gl-inet/feed/" rel="self" type="application/rss+xml" />
	<link>https://myshittycode.com</link>
	<description>Embracing the Messiness in Search of Epic Solutions</description>
	<lastBuildDate>Sat, 08 Jun 2024 14:59:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://myshittycode.com/wp-content/uploads/2022/04/cropped-icon-32x32.png</url>
	<title>GL.iNet &#8211; My Shitty Code</title>
	<link>https://myshittycode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">205304208</site>	<item>
		<title>NordVPN: Extracting WireGuard Configuration</title>
		<link>https://myshittycode.com/2024/06/08/nordvpn-extracting-wireguard-configuration/</link>
					<comments>https://myshittycode.com/2024/06/08/nordvpn-extracting-wireguard-configuration/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Sat, 08 Jun 2024 14:59:51 +0000</pubDate>
				<category><![CDATA[Development Tools]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[GL.iNet]]></category>
		<category><![CDATA[NordVPN]]></category>
		<category><![CDATA[Travel Router]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[WireGuard]]></category>
		<guid isPermaLink="false">https://myshittycode.com/?p=2604</guid>

					<description><![CDATA[<p>This article shows how to extract the WireGuard configuration from NordVPN without additional tools and test it by configuring WireGuard on a GL.iNet travel router (ex: Beryl AX). Why WireGuard? While most modern routers support OpenVPN and WireGuard protocols, the latter is faster and more efficient when traveling through the encrypted tunnels, providing a superior [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2024/06/08/nordvpn-extracting-wireguard-configuration/">NordVPN: Extracting WireGuard Configuration</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This article shows how to extract the WireGuard configuration from NordVPN without additional tools and test it by configuring WireGuard on a GL.iNet travel router (ex: Beryl AX).</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#why-wire-guard">Why WireGuard?</a></li><li><a href="#why-this-extra-step-when-using-nord-vpn">Why This Extra Step When Using NordVPN?</a></li><li><a href="#prerequisites">Prerequisites</a></li><li><a href="#step-1-generate-access-token-in-nord-vpn">Step 1: Generate Access Token in NordVPN</a></li><li><a href="#step-2-use-nord-vpn-ap-is-to-extract-wire-guard-configuration">Step 2: Use NordVPN APIs to Extract WireGuard Configuration</a></li><li><a href="#step-3-configure-wire-guard-on-router">Step 3: Configure WireGuard on Router</a></li></ul></nav></div>



<h2 class="wp-block-heading" id="why-wire-guard">Why WireGuard?</h2>



<p>While most modern routers support OpenVPN and WireGuard protocols, the latter is faster and more efficient when traveling through the encrypted tunnels, providing a superior VPN experience.</p>



<h2 class="wp-block-heading" id="why-this-extra-step-when-using-nord-vpn">Why This Extra Step When Using NordVPN?</h2>



<p>Unlike other VPN providers, NordVPN builds its proprietary solution, NordLynx, on WireGuard. Thus, it is not possible to configure it directly on your router unless you want to rely on the slower OpenVPN.</p>



<h2 class="wp-block-heading" id="prerequisites">Prerequisites</h2>



<ul class="wp-block-list">
<li>A NordVPN customer.</li>



<li>A router that supports WireGuard VPN protocol.</li>



<li>An environment to run Linux commands. Install <a href="https://jqlang.github.io/jq/download/" target="_blank" rel="noopener">jq</a> if it doesn&#8217;t exist.</li>



<li>Expert in CMD/CTRL+C and CMD/CTRL+V.</li>
</ul>



<h2 class="wp-block-heading" id="step-1-generate-access-token-in-nord-vpn">Step 1: Generate Access Token in NordVPN</h2>



<ul class="wp-block-list">
<li>Go to <a href="https://my.nordaccount.com/dashboard/nordvpn/manual-configuration/" target="_blank" rel="noreferrer noopener">this NordVPN link</a>.</li>



<li>Click on the <strong>Set up NordVPN manually</strong> button<strong>.</strong></li>
</ul>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="610" height="296" src="https://myshittycode.com/wp-content/uploads/2024/06/1-nordvpn-manual-setup.png?x45560" alt="" class="wp-image-2605" srcset="https://myshittycode.com/wp-content/uploads/2024/06/1-nordvpn-manual-setup.png 610w, https://myshittycode.com/wp-content/uploads/2024/06/1-nordvpn-manual-setup-300x146.png 300w" sizes="(max-width: 610px) 100vw, 610px" /></figure>



<ul class="wp-block-list">
<li>After completing the email verification, you will land on a page that allows you to generate an access token. Click on the <strong>Generate new token</strong> button.</li>
</ul>



<figure class="wp-block-image size-full"><img decoding="async" width="605" height="542" src="https://myshittycode.com/wp-content/uploads/2024/06/2-nordvpn-generate-new-token.png?x45560" alt="" class="wp-image-2606" srcset="https://myshittycode.com/wp-content/uploads/2024/06/2-nordvpn-generate-new-token.png 605w, https://myshittycode.com/wp-content/uploads/2024/06/2-nordvpn-generate-new-token-300x269.png 300w" sizes="(max-width: 605px) 100vw, 605px" /></figure>



<ul class="wp-block-list">
<li>Leave the token expiration as is. Click on the <strong>Generate token</strong> button.</li>
</ul>



<figure class="wp-block-image size-full"><img decoding="async" width="682" height="329" src="https://myshittycode.com/wp-content/uploads/2024/06/3-nordvpn-generate-token.png?x45560" alt="" class="wp-image-2608" srcset="https://myshittycode.com/wp-content/uploads/2024/06/3-nordvpn-generate-token.png 682w, https://myshittycode.com/wp-content/uploads/2024/06/3-nordvpn-generate-token-300x145.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></figure>



<ul class="wp-block-list">
<li>Copy the access token to a text file and close the pop-up dialog.</li>
</ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="680" height="338" src="https://myshittycode.com/wp-content/uploads/2024/06/4-nordvpn-copy-access-token.png?x45560" alt="" class="wp-image-2609" srcset="https://myshittycode.com/wp-content/uploads/2024/06/4-nordvpn-copy-access-token.png 680w, https://myshittycode.com/wp-content/uploads/2024/06/4-nordvpn-copy-access-token-300x149.png 300w" sizes="auto, (max-width: 680px) 100vw, 680px" /></figure>



<h2 class="wp-block-heading" id="step-2-use-nord-vpn-ap-is-to-extract-wire-guard-configuration">Step 2: Use NordVPN APIs to Extract WireGuard Configuration</h2>



<p>Fortunately, NordVPN provides a helpful Rest API that returns a list of recommended servers based on your current location. We can use this to query for a list of WireGuard-compatible servers.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
#!/usr/bin/env bash

ACCESS_TOKEN=&quot;&#x5B;YOUR-ACCESS-TOKEN]&quot;
TOTAL_CONFIGS=3
DNS=&quot;1.1.1.1&quot;

CREDENTIALS_URL=&quot;https://api.nordvpn.com/v1/users/services/credentials&quot;
SERVER_RECOMMENDATIONS_URL=&quot;https://api.nordvpn.com/v1/servers/recommendations?&amp;filters\&#x5B;servers_technologies\]\&#x5B;identifier\]=wireguard_udp&amp;limit=$TOTAL_CONFIGS&quot;

PRIVATE_KEY=$(curl -s -u token:&quot;$ACCESS_TOKEN&quot; &quot;$CREDENTIALS_URL&quot; | jq -r .nordlynx_private_key)

curl -s &quot;$SERVER_RECOMMENDATIONS_URL&quot; | \
  jq -r --arg private_key &quot;$PRIVATE_KEY&quot; --arg dns &quot;$DNS&quot; &#039;
    .&#x5B;] |
    {
      filename: (.locations&#x5B;0].country.name + &quot; - &quot; + .locations&#x5B;0].country.city.name + &quot; - &quot; + .hostname + &quot;.conf&quot;),
      ip: .station,
      publicKey: (.technologies | .&#x5B;] | select(.identifier == &quot;wireguard_udp&quot;) | .metadata | .&#x5B;] | .value)
    } |
    {
      filename: .filename,
      config: &#x5B;
        &quot;# &quot; + .filename,
        &quot;&quot;,
        &quot;&#x5B;Interface]&quot;,
        &quot;PrivateKey = \($private_key)&quot;,
        &quot;Address = 10.5.0.2/32&quot;,
        &quot;DNS = \($dns)&quot;,
        &quot;&quot;,
        &quot;&#x5B;Peer]&quot;,
        &quot;PublicKey = &quot; + .publicKey,
        &quot;AllowedIPs = 0.0.0.0/0, ::/0&quot;,
        &quot;Endpoint = &quot; + .ip + &quot;:51820&quot;
      ] | join(&quot;\n&quot;)
    } |
    &quot;echo \&quot;&quot; + .config + &quot;\&quot; &gt; \&quot;&quot; + .filename + &quot;\&quot;&quot;
  &#039; | sh
</pre></div>


<p>Required Changes:</p>



<ul class="wp-block-list">
<li><strong>Line 3</strong>: Replace <strong>[YOUR-ACCESS-TOKEN]</strong> with the access token you have just copied.</li>
</ul>



<p>Optional Changes:</p>



<ul class="wp-block-list">
<li><strong>Line 4</strong>: By default, this script generates 3 different WireGuard config files based on your location. If one of the servers is oversaturated, you can point to a different server next time without rerunning the script.</li>



<li><strong>Line 5</strong>: Currently, I use CloudFlare DNS (1.1.1.1) since it has the fastest response time. However, you can update it to point to your favorite DNS server, for example, Google&#8217;s 8.8.8.8.</li>
</ul>



<p>Other Helpful Explanations:</p>



<ul class="wp-block-list">
<li><strong>Line 10</strong>: Retrieve your private key.</li>



<li><strong>Line 12</strong>: Retrieve the recommended WireGuard-compatible servers based on your current location and generate the WireGuard config files.</li>
</ul>



<p>Suppose you plan to travel to a different location with your travel router. In that case, typically, you want to pre-configure your travel router with the nearest WireGuard servers based on your destinations before departing. To do this, you can choose a desired location in the NordVPN software installed on your current machine before rerunning this script. For example, you might pick Finland because you fancy eating the delicious Kaalikääryleet that you can&#8217;t pronounce. Still, you want to do it safely before Instagramming it in real-time during your long weekend.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="284" height="827" src="https://myshittycode.com/wp-content/uploads/2024/06/5-nordvpn-destination-server.png?x45560" alt="" class="wp-image-2613" srcset="https://myshittycode.com/wp-content/uploads/2024/06/5-nordvpn-destination-server.png 284w, https://myshittycode.com/wp-content/uploads/2024/06/5-nordvpn-destination-server-103x300.png 103w" sizes="auto, (max-width: 284px) 100vw, 284px" /></figure>



<p>After running the script, you should see 3 WireGuard configuration files created.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; highlight: [4,5,6]; title: ; notranslate">
$ ls -a | cat                                                                                ✔ 
.
..
Finland - Helsinki - fi183.nordvpn.com.conf
Finland - Helsinki - fi195.nordvpn.com.conf
Finland - Helsinki - fi198.nordvpn.com.conf
nordvpn-wireguard.sh
</pre></div>


<h2 class="wp-block-heading" id="step-3-configure-wire-guard-on-router">Step 3: Configure WireGuard on Router</h2>



<p>The following instructions apply to the GL.iNet travel routers, in my case, Beryl AX (GL-MT3000). Follow your router&#8217;s instructions as needed.</p>



<p><strong>IMPORTANT:</strong> Before proceeding, ensure you have disabled the VPN from your machine so that it relies on the VPN configured on the travel router based on the steps below.</p>



<ul class="wp-block-list">
<li>Change your SSID to point to your travel router.</li>



<li>Go to <a href="http://192.168.8.1/">http://192.168.8.1/</a></li>



<li>Log into the Admin Panel.</li>



<li>Go to <strong>VPN</strong> > <strong>WireGuard Client</strong>.</li>
</ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="553" src="https://myshittycode.com/wp-content/uploads/2024/06/6-router-wireguard-client-1024x553.png?x45560" alt="" class="wp-image-2625" srcset="https://myshittycode.com/wp-content/uploads/2024/06/6-router-wireguard-client-1024x553.png 1024w, https://myshittycode.com/wp-content/uploads/2024/06/6-router-wireguard-client-300x162.png 300w, https://myshittycode.com/wp-content/uploads/2024/06/6-router-wireguard-client-768x415.png 768w, https://myshittycode.com/wp-content/uploads/2024/06/6-router-wireguard-client.png 1254w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<ul class="wp-block-list">
<li>Upload the WireGuard configuration files. Rename the <strong>New Provider</strong> group to <strong>NordVPN</strong> to make it more meaningful.</li>
</ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="553" src="https://myshittycode.com/wp-content/uploads/2024/06/7-router-wireguard-config-1024x553.png?x45560" alt="" class="wp-image-2626" srcset="https://myshittycode.com/wp-content/uploads/2024/06/7-router-wireguard-config-1024x553.png 1024w, https://myshittycode.com/wp-content/uploads/2024/06/7-router-wireguard-config-300x162.png 300w, https://myshittycode.com/wp-content/uploads/2024/06/7-router-wireguard-config-768x415.png 768w, https://myshittycode.com/wp-content/uploads/2024/06/7-router-wireguard-config.png 1249w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<ul class="wp-block-list">
<li>Pick a server and click <strong>Start</strong>.</li>
</ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="650" height="345" src="https://myshittycode.com/wp-content/uploads/2024/06/8-router-start-server.png?x45560" alt="" class="wp-image-2627" srcset="https://myshittycode.com/wp-content/uploads/2024/06/8-router-start-server.png 650w, https://myshittycode.com/wp-content/uploads/2024/06/8-router-start-server-300x159.png 300w" sizes="auto, (max-width: 650px) 100vw, 650px" /></figure>



<ul class="wp-block-list">
<li>After a few seconds, the icon should change from orange to green.</li>
</ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="647" height="340" src="https://myshittycode.com/wp-content/uploads/2024/06/9-router-successful-connection.png?x45560" alt="" class="wp-image-2628" srcset="https://myshittycode.com/wp-content/uploads/2024/06/9-router-successful-connection.png 647w, https://myshittycode.com/wp-content/uploads/2024/06/9-router-successful-connection-300x158.png 300w" sizes="auto, (max-width: 647px) 100vw, 647px" /></figure>



<ul class="wp-block-list">
<li>Go to <a href="https://whatismyipaddress.com/" target="_blank" rel="noopener">https://whatismyipaddress.com/</a> to verify your IP. The IP should point to your VPN server&#8217;s location.</li>
</ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="626" src="https://myshittycode.com/wp-content/uploads/2024/06/10-whats-my-ip-1024x626.png?x45560" alt="" class="wp-image-2629" srcset="https://myshittycode.com/wp-content/uploads/2024/06/10-whats-my-ip-1024x626.png 1024w, https://myshittycode.com/wp-content/uploads/2024/06/10-whats-my-ip-300x183.png 300w, https://myshittycode.com/wp-content/uploads/2024/06/10-whats-my-ip-768x469.png 768w, https://myshittycode.com/wp-content/uploads/2024/06/10-whats-my-ip.png 1227w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<ul class="wp-block-list">
<li>Enjoy your <a href="https://www.google.com/search?sca_esv=b1ced915f33cbde0&amp;sca_upv=1&amp;q=Kaalik%C3%A4%C3%A4ryleet&amp;uds=ADvngMiIMiMH9LyyITANaU-tP7Tx_LoyDqWcuxLdAWjbiiPItTQIMJGqCilQ2P9bV1Dv6O-7T2R2WCCQCUAhxHSNZBXI7F-P9Lgqb8hx22E96rmdQ6wSH_7tq3REoY56wvh7NG60WLKZI4VCaaPBp1i0LfZE9RFaY_CmVZT2gnwKxtj0GgYDgVbx3eDESic00sPypgG1A0AVu4aWss3lmCsEJl7wi5kFTFiN1r0XgRykkdXUCaukfrxB5iO82Ulrno5Sy3CnaRDSnoeot-F_lu-Hbt21Rh6sTXTGTzkA3GbutH2O6ROk5Jv_DeyhhPz34u0R0kL3NOvaf1_plkXKARr8IzQdJR8YuA&amp;udm=2&amp;prmd=ivsnmbtz&amp;sa=X&amp;ved=2ahUKEwjmscz8ocyGAxUNJNAFHT8YGMYQtKgLegQIDBAB&amp;biw=1673&amp;bih=1399&amp;dpr=1" target="_blank" rel="noopener">Kaalikääryleet</a>!</li>
</ul>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2024/06/08/nordvpn-extracting-wireguard-configuration/">NordVPN: Extracting WireGuard Configuration</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2024/06/08/nordvpn-extracting-wireguard-configuration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2604</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Database Caching 52/73 queries in 0.071 seconds using Disk

Served from: myshittycode.com @ 2026-02-22 04:04:36 by W3 Total Cache
-->