Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

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

    Scheduled Pinned Locked Moved General pfSense Questions
    6 Posts 2 Posters 1.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amendolaro
      last edited by

      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 !

      1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator
        last edited by

        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!!!

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.7.2, 24.11

        1 Reply Last reply Reply Quote 0
        • A
          amendolaro
          last edited by

          @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

          1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator
            last edited by

            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..

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.7.2, 24.11

            1 Reply Last reply Reply Quote 0
            • A
              amendolaro
              last edited by

              @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 ?

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator
                last edited by

                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..

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.