Untitled

Reconnect VPN if remote network unreachable
mail@pastecode.io avatar
unknown
batchfile
4 months ago
335 B
4
Indexable
Never
@echo off
set "host=192.168.251.1"

ping %host% /n 1 | find "TTL">nul
if %ERRORLEVEL%==0 (
	exit
) else (
	rasdial home /DISCONNECT
	timeout 5
	rasdial home vpn-user vpn-password
	route add 192.168.251.0 MASK 255.255.255.0 192.168.251.1 METRIC 500 IF 31
	route add 192.168.250.0 MASK 255.255.255.0 192.168.251.1 METRIC 500 IF 31
)
exit
Leave a Comment