Created
December 29, 2022 21:52
-
-
Save catchsudheera/9ca9cc0b34646046f1d5eac5858a5d0c to your computer and use it in GitHub Desktop.
This bash script can be used to generate the wireguard config from nordvpn nordlynx connection on a linux machine. I used this script to generate wg config for my Gl.iNet router vpn client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CONFIG_FILE_NAME='nordlynx_wg.conf' | |
nordvpn disconnect | |
sleep 2 | |
nordvpn set technology nordlynx | |
nordvpn connect Netherlands | |
nordvpn status | |
WG_CONF=$(sudo wg showconf nordlynx) | |
LOCAL_ADDRESS=$(/sbin/ifconfig nordlynx | grep 'inet ' | tr -s ' ' | cut -d" " -f3) | |
PRIVATE_KEY=$(echo "$WG_CONF" | grep 'PrivateKey = .*') | |
HOSTNAME=$(nordvpn status | grep 'Hostname'| cut -d" " -f2) | |
PORT=$(echo "$WG_CONF" | grep 'Endpoint = .*' | cut -d":" -f2) | |
PUBLIC_KEY=$(echo "$WG_CONF" | grep 'PublicKey = .*') | |
nordvpn disconnect | |
sh -c "cat > $CONFIG_FILE_NAME << 'EOL' | |
[Interface] | |
Address = ${LOCAL_ADDRESS} | |
${PRIVATE_KEY} | |
DNS = 103.86.96.100 | |
[Peer] | |
AllowedIPs = 0.0.0.0/0, ::/0 | |
Endpoint = $HOSTNAME:$PORT | |
${PUBLIC_KEY} | |
EOL" | |
echo " ---------------------------------------- " | |
cat $CONFIG_FILE_NAME | |
echo " ---------------------------------------- " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps
nordvpn
linux client. https://support.nordvpn.com/Connectivity/Linux/1182453582/Installing-and-using-NordVPN-on-Linux.htmnordvpn login
nordlynx_wg.conf
config file to the router following the steps here : https://docs.gl-inet.com/en/4/tutorials/wireguard_client/?fbclid=IwAR2SHMfcwwfoYRWa8xW1HfXEz0ZVlg0zMXAss4BKPlIXpcY3tH9pb32rXd4#set-up-wireguard-client