What's new

NordVPN script change/start vpn server from gui on r7800 voxel

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!


New Around Here
I made a Nordvpn html/script for r7800 with voxel firmware

This is a really basic script to change the nordvpn server from the web gui of the router
After the change it restarts the vpn client .
maybe someone can use it.

added a stop vpn function


the 4 files that are needed:


I have replaced /www/license.html, with nvpn-addon.html, so i can now use the license info link in the gui of the router to access this page

enable telnet at http://routerip/debug.htm
login and
create the following file with your user name and password for nordvpn


<!DOCTYPE html>
* {
  box-sizing: border-box;
input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
label {
  padding: 12px 12px 12px 0;
  display: inline-block;
input[type=submit] {
  background-color: blue;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  float: right;
input[type=submit]:hover {
  background-color: lightblue;
.container {
  border-radius: 5px;
  background-color: #f2f2f2;
  padding: 20px;
.col-25 {
  float: left;
  width: 25%;
  margin-top: 6px;
.col-75 {
  float: left;
  width: 75%;
  margin-top: 6px;
/* Clear floats after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .col-25, .col-75, input[type=submit] {
    width: 100%;
    margin-top: 0;
<h2>Nordvpn add-on</h2>
<p>Select country</p>
<div class="container">
<form id ="country" action="cgi-bin/nvpn-addon.cgi" method="get">
  <div class="row">
    <div class="col-25">
      <label for="country">Country</label>
    <div class="col-75">
      <select id="countrypd" name="country">
let dropdown = document.getElementById('countrypd');
dropdown.length = 0;
let defaultOption = document.createElement('option');
defaultOption.text = 'Choose Country';
dropdown.selectedIndex = 0;
const request = new XMLHttpRequest();
request.onload = function() {
  if (request.status === 200) {
      const data = JSON.parse(request.responseText);
          let option;
    for (let i = 0; i < data.length; i++) {
      option = document.createElement('option');
      option.text = data[i].name;
      option.value = data[i].id;
   } else {
request.onerror = function() {
  console.error('An error occurred fetching the JSON from ' + url);
  <div class="row">
    <input type="submit" value="Submit">
    <div class="row">
    <div class="col-25">
      <label for="country">Stop vpn server</label>
    <div class="row">
    <input type="Submit" name="country"value="stop">


echo "Content-type: text/html"
echo ""
if  [ ! -n "$COUNTRY"  ]
echo $(cgi-bin/nvpn-addon.sh)
echo Changed server to recommended server
echo restarting...
echo $(cgi-bin/nvpn-addon.sh $COUNTRY)

and create the shell script file

if [ ! -n "$1" ]
curl --silent https://nordvpn.com/wp-admin/admin-ajax.php?action=servers_countries
/etc/init.d/openvpn-client stop
/etc/init.d/dnscrypt-proxy-2 stop
if [ $1 != "stop" ]
server="$(curl --silent 'https://nordvpn.com/wp-admin/admin-ajax.php?action=servers_recommendations&filters=\{%22country_id%22:'$1'\}' | jq --raw-output 'limit(1;.[])|.hostname')"
wget -O /etc/openvpn/config/client/nordvpn.ovpn https://downloads.nordcdn.com/configs/files/ovpn_legacy/servers/$server.udp1194.ovpn
sed -i 's/auth-user-pass/auth-user-pass nordvpn.auth/g' /etc/openvpn/config/client/nordvpn.ovpn
echo "nice -20" >> /etc/openvpn/config/client/nordvpn.ovpn
echo "sndbuf 393216" >> /etc/openvpn/config/client/nordvpn.ovpn
echo "rcvbuf 393216" >> /etc/openvpn/config/client/nordvpn.ovpn
echo push \"rcvbuf 393216\" >> /etc/openvpn/config/client/nordvpn.ovpn
echo push \"sndbuf 393216\" >> /etc/openvpn/config/client/nordvpn.ovpn
sed -i 's/mssfix 1450/mssfix 1460/g' /etc/openvpn/config/client/nordvpn.ovpn
/etc/init.d/openvpn-client start
/etc/init.d/dnscrypt-proxy-2 start

make the cgi and sh files executuble:
chmod +x /www/cgi-bin/nvpn-addon.sh
chmod +x /www/cgi-bin/nvpn-addon.cgi

and you can test the script with to http://routerip/nvpn-addon.htm
Last edited:
This is a very nice initiative!
I have done similar code for other add-on purposes that is not released.
I eg tried NordVPN a few days but the huge difference in speed between their servers made me pessimistic.
But there might be a way to rank the servers and combine it with your ideas!
I'll have look at it once home again.
Thank you again for sharing with the community there!
Thank you,
Yes nordvpn is slow for me as well in particular the us servers , but i already had an account there so havent really looked to other providers.
But it should be possible to get the list of servers ranked, or at least the recommended server using their web page
like here:
Thank you, but unfortunately the recommended server is not the fastest one... I have tested and talked to their support. They dont have or dont want to help with a solution.
But if i get a free trial I can have another try after I come back home.
I made a Nordvpn html/script for r7800 with voxel firmware

This is a really basic script to change the nordvpn server from the web gui of the router
After the change it restarts the vpn client .
maybe someone can use it.

If you have an interest we can perform your nice job as an add-on for my version of fw (installation package). Please let me know if you are interested. Minuses for you are that you have to handle and maintain it yourself ;).


Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!