OpenVPN not reliable, use VPNCHECK



  • I have two sites with 24h DAIP. After hours of troubleshooting, it was horrible for me to find out that openVPN doesn’t work properly.
    So I have build this simple loop to check the connection and perform a reconnect if it necessary.

    #!/bin/sh
    clear
    
    vcheck ()
    {
    echo "vcheck"
    PTEST=`ping -c 1 -t 1 192.168.0.254 | grep "100% packet loss" | awk '{print $1;}'`
    HPID=`cat /var/run/openvpn_client0.pid`
    
    if [ "X${PTEST}" != "X" ] ; then
    
            echo ""
            echo "No connection to Heinsberg!"
            echo ""
            kill $HPID
            sleep 5
            openvpn --config /var/etc/openvpn_client0.conf
       else
            echo ""
            echo "Connected to Heinsberg!"
            echo ""
    fi
    vwait
    }
    
    vwait ()
    {
    echo "vwait"
    sleep 30
    vcheck
    }
    
    

    How can I start that loop automatically, after reboot and established pppoe session?



  • Try the latest snapshot.



  • @sullrich:

    Try the latest snapshot.

    That will start my loop?  :D
    Ok in the latest snapshot are some improvements, I will give it a try. But how can I start my Script on boot?  ::) It should be starded as a daemon…  :'(



  • You can start custom stuff on boot/filterreload by using hidden config.xml options: http://faq.pfsense.com/index.php?action=artikel&cat=10&id=38&artlang=en&highlight=hidden



  • Look in the package area.  There is a rc.d thread that is a sticky.


Locked