A couple of scripts for watching my VPN connections on an EdgeRouter. Tested on my Ubiquiti EdgeRouter Infinity running EdgeOS 2.0.8.
Copy the scripts to /config/scripts/.
Setup task-scheduler (crontab), mine looks like this:
configure
show system task-scheduler
task vpn_check {
crontab-spec "55 * * * *"
executable {
path /config/scripts/check_vpn.sh
}
}
Edit vpn_reset.sh, change the vtun interfaces to match yours.
This is what my VPN definitions look like:
configure
show interfaces openvpn
openvpn vtun1 {
config-file /config/auth/myvpn/myvpn_us-la_udp.ovpn
description "MyVPN - US LA (UDP)"
}
openvpn vtun2 {
config-file /config/auth/thevpn/thevpn_eu-frankfurt_tcp.ovpn
description "TheVPN - EU Frankfurt (TCP)"
}
Pull requests welcome.
- Alvin Jiang
This project is licensed under the MIT License.