command OR script to detect vpn connection status

9,051

Solution 1

TorrentFreak had an article about things like that.

You could check out VPNCheck.

Solution 2

I wrote something awhile back that keeps an eye on your IPs using a couple of different methods and gives some options for notification and such. It was written for CentOS but it wouldn't take much to adapt it to Debian flavours. Feedback is welcome.

http://code.google.com/p/ipcheck/source/browse/ipcheck.sh

Share:
9,051

Related videos on Youtube

Ariyan
Author by

Ariyan

Updated on September 18, 2022

Comments

  • Ariyan
    Ariyan almost 2 years

    I'm using Ubuntu Network Manager VPN client to connect to a PPTP vpn server.
    I have an application that get some data from internet and must be runned from behind the VPN.
    I need to suspend application process if VPN connection dropped.
    How can I find out the VPN is connected/disconnected (script or command)?
    Or is there a service that be able to call an script when VPN connected/disconnected?

    Thanks

    • Shawn J. Goff
      Shawn J. Goff about 12 years
      You can ping your VPN gateway. So, if your gateway on the VPN is 172.16.1.1, the exit status of ping -c 1 -W 10 172.16.1.1 will tell you if you're connected.