The pfSense Store

Author Topic: WAN is 0.0.0.0 after power loss, have to "renew" to get IP  (Read 303 times)

0 Members and 1 Guest are viewing this topic.

Offline RyanM

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« on: December 18, 2017, 07:44:19 pm »
I have noticed this a couple of times. I think it is happening when my pfSense is rebooted, but I noticed it the other day when the power went out at my house.

After the power came back up, I had my local network, but did not appear to have internet access. So I pulled up pfSense WebGUI and noticed the WAN interface was "up" but didn't have an IP. When I opened the Status > Interfaces page, I noticed that the IP of WAN was 0.0.0.0. So I clicked the Release/Renew button and my public IP showed up and I could access the internet.

How can I get pfSense to automatically fix this? I travel frequently and use services hosted at home (particularly Plex).

I did see Auto DHCP Renew not working on WAN (How to fix it). Is that the appropriate fix?

Online Gertjan

  • Hero Member
  • *****
  • Posts: 2306
  • Karma: +174/-9
    • View Profile
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #1 on: December 19, 2017, 04:16:11 am »
....
I did see Auto DHCP Renew not working on WAN (How to fix it). Is that the appropriate fix?
Be ware that you cited a fix for a pfSense version that is more then ancient.

However, the issue "pfSense does not retrieve an IP WAN running DHCP client from modem device" is known. Typically, this can happen when both devices boot up at the same time and pfSense boots faster then the modem, it start to fire DHCP requests, but the modem can't reply yet. Restart the requests by hand or rebooting pfsense by hand will solve the issue (but impossible if your are away).

You should mention your region and ISP, so other can share their experiences.

marjohh

  • Guest
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #2 on: December 19, 2017, 05:35:30 am »
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.



Offline RyanM

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #3 on: December 19, 2017, 02:18:49 pm »
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.

marjohh

  • Guest
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #4 on: December 19, 2017, 02:41:58 pm »
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.

Online JKnott

  • Hero Member
  • *****
  • Posts: 1090
  • Karma: +43/-8
    • View Profile
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #5 on: December 19, 2017, 04:24:29 pm »
Quote
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).

Online JKnott

  • Hero Member
  • *****
  • Posts: 1090
  • Karma: +43/-8
    • View Profile
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #6 on: December 19, 2017, 09:27:04 pm »
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.

Offline RyanM

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #7 on: December 21, 2017, 08:24:24 pm »
Thanks marjohh, I will try this. Does this output to the logs somewhere? I would like to see that it is working...

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.

Online Gertjan

  • Hero Member
  • *****
  • Posts: 2306
  • Karma: +174/-9
    • View Profile
Re: WAN is 0.0.0.0 after power loss, have to "renew" to get IP
« Reply #8 on: December 22, 2017, 04:02:17 am »
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 :
Code: [Select]
# 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 :
Code: [Select]
/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 !