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

    WAN is 0.0.0.0 after power loss, have to "renew" to get IP

    Scheduled Pinned Locked Moved General pfSense Questions
    12 Posts 6 Posters 2.4k Views 3 Watching
    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.
    • ? This user is from outside of this forum
      Guest
      last edited by

      As Gertjan has said, this can happen when pfsense boots quicker than the modem.

      There is a pretty easy fix, you run a script that monitors the WAN connection by pinging an external address. If the ping fails to respond at all in given period then one of two things happens, firstly it will set the WAN port Down and then back UP again, this is often enough to re-trigger the DHCP process and everything will kick back into life. If that fails, the ping failure timeout will then trigger a reboot of pfSense.

      Here's the script. extract and copy it to usr/local/bin, make sure it's set to executable ( 755 )

      Now create a Cron event, install the Cron GUI if you wish to make it easy.

      Capture.JPG
      Capture.JPG_thumb
      ping_check.zip

      1 Reply Last reply Reply Quote 0
      • RyanMR Offline
        RyanM
        last edited by

        I don't think this is an issue with the modem as it is on a battery backup UPS. I have fiber optic internet service from Montana Opticom.

        Also, I would need to test to confirm, but I am pretty sure I have seen this behavior after updating pfSense. I currently have 2.4.2 and 2.4.2_1 is available. I may try to update today and see if I can replicate.

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          It's not an issue with the modem, but I've seen the 0,0.0.0 issue before, taking the WAN interface down and back up again fixes it. The script I have posted not only helps that, but if pfSense for any reason has a problem then providing the it's not totally dead it will reboot pfsense, even when you are thousands of miles away, it happened to me once and the script saved a LOT of grief.

          1 Reply Last reply Reply Quote 0
          • JKnottJ Offline
            JKnott
            last edited by

            Now create a Cron event, install the Cron GUI if you wish to make it easy.

            How often do you run it?  I currently have it set for 10 minutes (*/6).

            PfSense running on Qotom mini PC
            i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
            UniFi AC-Lite access point

            I haven't lost my mind. It's around here...somewhere...

            1 Reply Last reply Reply Quote 0
            • JKnottJ Offline
              JKnott
              last edited by

              In the line ping -o -s 0 -c 10 8.8.8.8, what does the -o do?  It's not listed in the man page.  Also, why -s 0?  That's setting the packet size to 0, which is smaller than the minimum allowed for a packet size.  When I run the script as is, it kills my system.

              PfSense running on Qotom mini PC
              i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
              UniFi AC-Lite access point

              I haven't lost my mind. It's around here...somewhere...

              1 Reply Last reply Reply Quote 0
              • RyanMR Offline
                RyanM
                last edited by

                Thanks marjohh, I will try this. Does this output to the logs somewhere? I would like to see that it is working…

                @marjohh:

                As Gertjan has said, this can happen when pfsense boots quicker than the modem.

                There is a pretty easy fix, you run a script that monitors the WAN connection by pinging an external address. If the ping fails to respond at all in given period then one of two things happens, firstly it will set the WAN port Down and then back UP again, this is often enough to re-trigger the DHCP process and everything will kick back into life. If that fails, the ping failure timeout will then trigger a reboot of pfSense.

                Here's the script. extract and copy it to usr/local/bin, make sure it's set to executable ( 755 )

                Now create a Cron event, install the Cron GUI if you wish to make it easy.

                1 Reply Last reply Reply Quote 0
                • GertjanG Offline
                  Gertjan
                  last edited by

                  @RyanM:

                  Does this output to the logs somewhere? I would like to see that it is working…

                  Noop.
                  But find, as an example, this part in the script :

                  # A message to the console (I like feedback)
                  echo "Testing Connection at" `date +%Y-%m-%d.%H:%M:%S` "uptime:" $uptime "seconds" >> file.txt
                  wall file.txt
                  rm file.txt
                  

                  and run this from the command line :

                  /usr/sbin/logger -ip notice "This line goes to the system log file"
                  
                  

                  and check your logs  ;)

                  Now you have all the ingredients ;)
                  Good luck !

                  No "help me" PM's please. Use the forum, the community will thank you.
                  Edit : and where are the logs ??

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    maxtkirk
                    last edited by

                    @Guest said in WAN is 0.0.0.0 after power loss, have to "renew" to get IP:

                    ping_check.zip

                    Hello, anybody can public the attachments?

                    GertjanG 1 Reply Last reply Reply Quote 0
                    • GertjanG Offline
                      Gertjan @maxtkirk
                      last edited by

                      @maxtkirk

                      From 2017 ?

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      1 Reply Last reply Reply Quote 0
                      • stephenw10S Offline
                        stephenw10 Netgate Administrator
                        last edited by

                        Yup, no way to recover those as far as I know. There are scripts named the same available via Google though.

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