Programmatically manage VPN / Tunnel

Posted on 2011-10-27
Last Modified: 2012-08-14
Is there a programmatic way in C# to detect the creation of a VPN tunnel?  Or the dropping of one?

Essentially, we have several VPN tunnels in place on our web server.  Sometimes they disconnect or go down and we have no idea why.  "Keep Alive" does not seem to be working reliably.

So I was thinking of some sort of "heartbeat" application to periodically check the VPN to see if it is up and running, and if not, programmatically restart it.
Question by:knowlton
    LVL 9

    Accepted Solution

    I not aware of a method to detect these kinds of connection, though it could probably be done via packet tracing.

    A simpler way to do it, would be to create a "heartbeat" software as you suggested which would test the connection (either via writing a file or an echo from the same software on the other computer or whatever) and if the connection is down, the use nircmd software to close/start back the VPN connection.

    Here is the link for the nircmd software :

    This software is a really great helper against windows X manipulation.
    LVL 5

    Author Closing Comment

    Sounds good to me!


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now