Cron script to reboot pfsense on failed ping via "vpn interface"



  • So from time to time my pfsense client disconnects and even if I try to restart the service it won't connect, remains down.

    My goal is to constantly, every 5 min or so ping Google or whatever site and if it fails to just reboot pfsense

    I saw a cron script on here already and used it but it pings via the wan instead of the vpn interface. Even tho the vpn client is down my wan technically works (I have firewall rule to block traffic if vpn client is down) so if client is down no home internet.

    Can anyone help me out?

    P.s - I'm new to all this so please be easy on me lol

    Thank you !


  • LAYER 8 Global Moderator

    this is really bad idea…

    Your saying your wan is up and working, yet your vpn is down.  Restart of vpn service doesn't bring it back but a reboot does?  Most likely you just going to put pfsense into a reboot cycle.. I would troubleshoot why your vpn is down.  Maybe its just their end!!!



  • @johnpoz:

    this is really bad idea…

    Your saying your wan is up and working, yet your vpn is down.  Restart of vpn service doesn't bring it back but a reboot does?  Most likely you just going to put pfsense into a reboot cycle.. I would troubleshoot why your vpn is down.  Maybe its just their end!!!

    I can sit there and constantly restart it , and nothing… Then I'll reboot pfsense and works.. I honestly don't mind the reboot. Again id want pings 5 min apart so if I did get into a reboot issue, I have 5 min to disable the job.  This is for home use, not production


  • LAYER 8 Global Moderator

    I would still troubleshoot the actual issue vs rebooting.. That is not a fix to your issue, that is blindly doing something that you think fixes the problem but you have no clue to what is causing..

    Sorry but this bad idea.. Good luck though, if you want to troubleshoot what is going one and actual find the cause then post up your log and we can get started..



  • @johnpoz:

    I would still troubleshoot the actual issue vs rebooting.. That is not a fix to your issue, that is blindly doing something that you think fixes the problem but you have no clue to what is causing..

    Sorry but this bad idea.. Good luck though, if you want to troubleshoot what is going one and actual find the cause then post up your log and we can get started..

    Okay I'll post log. Thank you. It's too late at this point tho ? I have to wait for it to disconnect again correct ?


  • LAYER 8 Global Moderator

    Yeah kind of need to see when it disconnects and its going to show it trying to reconnect, etc.

    You could even bump up the logging level, verbosity in the vpn client settings as precursor.. You may want to increase the number of lines you can view in the log, and or even send your logging to syslog so you don't loose anything, etc. You can always view the actual logs vs what is presented in the gui..

    But just blindly rebooting is not good idea..


Log in to reply