No WAN IP on startup, until lease is manually renewed
-
My ISP has a very odd setup [1] that seems to be causing issues on the very rare occasions when I need to reboot pfSense. Following a reboot, the WAN interface does not have an IP until I go in the pfSense GUI and manually Renew the DHCP lease. This happens every time, ever since we moved into this area almost one year ago.
I'm currently running pfSense 2.4.4, but this issue has been present with every version since we moved in, when I think we would have been on pfSense 2.3.4. Everyone worked perfectly at our previous house, with a different ISP, in a different country.
Is there any way I can setup pfSense so it will automagically renew the DHCP lease on the WAN interface after start up?
[1] We're in a somewhat rural area, with no wired high speed internet available. We're on wireless internet (not cellular - the ISP has an antenna on the other side of the lake, and we have a dish on the side of the house pointing at that antenna), and our WAN IP is in the 192.168.144.XXX range.
Thanks,
-
I don't know about FreeBSD, but in Linux there's a hook for calling scripts after a port comes up. You could use that script to test the connection and then restart DHCP if needed.
-
Hmm. It looks like I could create a startup script that would be called at the end of the boot process. This script could perhaps sleep for a suitable time, to allow everything else to finish, then renew the WAN lease. I'll do some digging.
Thanks for the idea.
-
I'd go for one that starts a bit later, after the networks come up. I'm not that familiar with FreeBSD startup, but I see one /etc/rc.d/NETWORKING that looks like it might be usable. It's supposed to run after the networks come up. Perhaps you could put a test for the IP connection there and do what's needed. Perhaps someone more familiar with FreeBSD could come up with something better.
Here's what the script contains:
#!/bin/sh
$FreeBSD$
PROVIDE: NETWORKING NETWORK
REQUIRE: netif netwait netoptions routing ppp ipfw stf
REQUIRE: defaultroute route6d resolv bridge
REQUIRE: static_arp static_ndp
This is a dummy dependency, for services which require networking
to be operational before starting.
-
The FreeBSD docs have an article on how to write an rc.d script, complete with dependencies on required services. So, I could write a startup script that required networking, and my script wouldn't be called until after networking is up. Now I need to figure out how to renew a lease from a script.
I also need to figure out how I can ensure that this won't bork pfSense boot. And if despite my best efforts, I do bork pfSense boot, how do I recover from that fiasco?
-
@khorton said in No WAN IP on startup, until lease is manually renewed:
Now I need to figure out how to renew a lease from a script.
Take a look at /etc/rc.d/dhclient.
You'd specify restart and the interface to get a dhcp address.