This script checks whether the tunnel to a remote location is alife by checking whether port 22 can be accessed on it's private an public ip.
check-ssh-vpn.sh <tun device> <public ip> <private ip>
Parameters:
Side note: We use this inside a crontab on our router to make sure the vpn connection between two of our locations stays active.
# VPN-tunnel check/create
* * * * * <path to check-ssh-vpn.sh> <tunnel device> <public ip> <private ip>
This maps the 'remote ip' to the 'local ip' of the remote .
Note: The tunnel device contains most of the configuration and is specified inside /etc/network/interfaces. see: https://x.graph-it.com/mediawiki/index.php/VPN_tunnel for details