Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
You can ping your VPN gateway. So, if your gateway on the VPN is, the exit status of ping -c 1 -W 10 will tell you if you're connected. – Shawn J. Goff Apr 17 '12 at 11:57

TorrentFreak had an article about things like that.

You could check out VPNCheck.

share|improve this answer

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.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.