Script to perform failover for wireguard client VPN. This script is a simple attempt to make sure the wireguard VPN client is always connected to a server by performing frequently monitoring latest handshake time checks.
This script is inspired by https://github.com/MartineauUK/VPN-Failover, which I currently use for OpenVPN clients
Usage:
- Login to the router admin colsole (WebUI -
http://router.asus.com(or) whatever gateway address you have set for you routerhttp://192.168.1.1orhttp://10.0.0.1....) and make sure the JFFS custom scripts and SSH options are enabled under Administration→System - SSH into router and place the shell script
wg_vpn_failover.shunder/jffs/scripts/ - Create a new folder called
wg_vpn_config_filesunder/jffs/configs/and drop your wireguard client config files that you have downloaded from your VPN provider - Under
/jffs/scripts/create a new file calledwg_vpn_failover_configand add enter the configurations that you want to failover to in the order you prefer (make sure the the config file name in the second column matches the exact files names under/jffs/configs/wg_vpn_config_files), the third column is the short name for VPN client which will be shown as instance name.
Example:
1 PIA-Orlando.conf PIA-Orlando
2 Nord-Newyork.conf Nord-Newyork
3 PIA-Austin.conf PIA-Austin
4 PIA-Denver.conf PIA-Denver
5 PIA-Boston.conf PIA-Boston
- Under /jffs/scripts/ edit the services-start file (if the file is not available create one) and enter the below lines
#!/bin/sh
sh /jffs/scripts/wg_vpn_failover.sh- Restart the router