I have a dynamic IP address that changes at least once a day so I use a DDNS so that I can reliably log in remotely via SSH.
I have a shell script that runs hourly to let me know if the DDNS domain has updated. (Does the DDNS IP match the real external IP?)
I sometimes have the need to use a VPN or proxy (SOCKS). If I inadvertently leave either active, then the DDNS update client will fail and the IPs will not match.
I'm looking for a way to reliably determine if I have inadvertently left the VPN active.
It seems to be easy to find out if a proxy is running:
(I use Netshade.)
But I can't find a reliable way to determine if a VPN is running.
I had hopes for:
but I'm not confident that the VPN will always use that interface (utun2).
Any ideas?
I have a shell script that runs hourly to let me know if the DDNS domain has updated. (Does the DDNS IP match the real external IP?)
I sometimes have the need to use a VPN or proxy (SOCKS). If I inadvertently leave either active, then the DDNS update client will fail and the IPs will not match.
I'm looking for a way to reliably determine if I have inadvertently left the VPN active.
It seems to be easy to find out if a proxy is running:
Code:
MrMuscle:bin mnewman$ scutil --proxy |grep netshade
SOCKSProxy : cz6.netshade.net
(I use Netshade.)
But I can't find a reliable way to determine if a VPN is running.
I had hopes for:
Code:
MrMuscle:bin mnewman$ ifconfig | grep utun2
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
but I'm not confident that the VPN will always use that interface (utun2).
Any ideas?