in this guide i will show you how to set up a vpn-connection with a automatically location change and good settings for your ovpn-file so the connection is stable and your router can handle the 24 hours disconnect from some openvpn providers. if you want a permanent check, if the connection is online, use the scripts below in the next post!)
Download the ovpn-file from your provider and edit it with a texteditor
Compare it with my ovpn-file an add missing lines, but don’t change commands if your vpn provider use other settings for one command -> Don’t change such commands!
Here is my file!
remote uk-lon2.privatevpn.com 1194 udp
remote [youradress] [port] [type] #add how many locations you like, above is a example
connection retry -1
keepalive 3 10
pull-filter ignore “auth-token”
[Here is your ca code in it]
-----BEGIN OpenVPN Static key V1-----
[Here is your key code in it]
-----END OpenVPN Static key V1-----
Remote-Random will chose every time there is a restart select a new location from your remote servers. So add "remote ". Add how many you like!
Import the Settings to your router like you see it here and start the vpn:
Connect to your wifi or lan of your router and use the terminal (linux):
->hit enter and use your router passwort
- To set up a cronjob, use this first:
- Write this code in it (Restart of vpn everyday at 3:30am)
30 3 * * * /etc/init.d/openvpn stop ; /etc/init.d/openvpn start
If you want you can add a second line to restart your router 1 time in the year Or more often, do what you want!
* * 1 1 * sleep 70 && touch /etc/banner && reboot
- You can set your times by yourself, here you see the timetable:
* * * * * command to be executed - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59)
- A few other commands, which may or may not be necessary, to ensure that cron was running:
/etc/init.d/cron start /etc/init.d/cron enable /etc/init.d/cron restart
- You can actually interact with cron through the web panel as well and check if the settings are saved: more settings > extended > Luci Login > System > Scheduled tasks.