0

Through DD-WRT or something similar, is it possible to toggle off and on a connection to a VPN? Would a script sat on a machine within the home network do the trick?

The intention is to get a non-country restricted VPN so that I can access US Netflix in the UK and such, through a smart Blu-Ray player (meaning that I can't just set the VPN up on a laptop - it has to be at router level). The ease of toggling is needed to revert the connection to its defaults for normal usage/UK Netflix, etc.

1 Answer 1

0

Yes it is, if you are willing to run a shell script on your router. The command

   nvram set opvpn_cfg='
   client
   remote xx.yy.ww.zz
   ....
   <ca> 
   ---------BEGIN CERTFICATE--------------
   ...
   --------END CERTIFICATE--------------
   </ca>
   <key>
   ....
   '

will create your config file, which you can start as follow:

   mkdir /tmp/openvpn
   cd /tmp/ovpn
   nvram get ovpn_cfg>ovpn.conf
   mkdir -p /tmp/etc/config
   echo -e "#!/bin/sh\nkillall openvpn\nping -c4 localhost\nopenvpn --daemon --config     /tmp/ovpn/ovpn.conf">/tmp/etc/config/ovpn.wanup
   chmod +x /tmp/etc/config/ovpn.wanup
   openvpn --daemon --config ovpn.conf

This command will stop the OpenVPN:

   killall openvpn

If you wish, you can put the above commands into a script file, and have it executed at boot:

   nvram set rc_startup='mkdir /tmp/ovpn
   cd /tmp/ovpn
   nvram get ovpn_cfg>ovpn.conf
   mkdir -p /tmp/etc/config
   echo -e "#!/bin/sh\nkillall openvpn\nping -c4 localhost\nopenvpn --daemon --config /tmp/ovpn/ovpn.conf">/tmp/etc/config/ovpn.wanup
   openvpn --daemon --config ovpn.conf'

These are rather generic, but you should be able to mold these as per your needs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .