Howto force a dhcp release and dhcp renew on wan interface when down?
-
Hello,
I'm running pfSense 2.4.2-RELEASE-p1 for years now in a multi WAN environment.
I use a 4G dongle connected via Proxycast in bridge mode (4G to Ethernet) which is connected to a WAN interface in pfSense as backup when the adsl and cablemodems are offline.Problem is when the ISP of the 4G dongle itself goes down and comes up again the IP address assigned to it doesn't renew, and so is offline.
When I do a manual release renew under status -> interfaces -> mobile interface/opt 6 it works again for a couple of days.Is it possible to let it do this automaticly? So when interface opt6 goes down and comes up again do dhcp release renew on interface opt6?
Any help would greatly appreciated!
Best Regards,
Donald. -
In Linux, there are hooks for running scripts on various evens, such as a network connection coming up. I expect the same would be available in FreeBSD, which pfSense runs on. However, I'm not that familiar with FreeBSD and haven't bothered looking. Look for the script that starts the DHCP client and you should be able to modify it to do a release/renew.
-
hi did you manage to solve this problem..I have a script where my modem will reset and will have it's ip renewed but the default gateway does not change automatically..I need to go to interfaces tab to release then renew so its gateway will update...
-
I'm having the same basic problem.. Cable modem / pfSense on hardware watchguard... Works fine for months, but when the cable modem experiences problems and I lose my IP address, I end up with a WAN that shows physical up, but no IP address. I go into the WAN interface, unclick the "Enable interface", save and activate, then re-enable and activate, and it comes back up, does a DHCP request and all is well. Looking for a way to make pfSense do this automatically..
-
Try running /sbin/dhclient-script to see if that clears the problem. If it does, you could write a script that pings the gateway (or other address) periodically, which then runs dhclient-script when it fails.
-
ALLDEST="8.8.8.8" # Interface to reset, usually your WAN BOUNCE=ue0 # Log file LOGFILE=/root/ping.log #===================================================================== COUNT=1 while [ $COUNT -le 2 ] do for DEST in $ALLDEST do echo `date +%d%m%Y.%H%M` "Pinging $DEST" >> $LOGFILE counting=$(ping -c 5 $DEST | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }') if [ $counting = 0 ]; then echo `date +%Y%m%d.%H%M%S` "All pings failed. Resetting 4G interface $BOUNCE." >> $LOGFILE sleep 2 echo -e 'AT^RESET' > /dev/cuaU0.0 sleep 20 /sbin/ifconfig $BOUNCE down # Give interface time to reset before bringing back up echo -e 'AT^NDISDUP=1,1' > /dev/cuaU0.0 /sbin/ifconfig $BOUNCE up /etc/rc.linkup start $BOUNCE sleep 5 else echo `date +%d%m%Y.%H%M` "Ping received =" $counting "Internet is UP" >> $LOGFILE exit 0 fi done COUNT=`expr $COUNT + 1`
Here's my working script to reset my 4g interface..but you may adjust this script since your wan interface is not 4g usb modem
-
@jly2680 Curious, Shouldn't PF Multi-Wan switch back and forth like HA? It's basically failover why the need for a script?
-
@trent6gol
sorry but forgot to mention , 4g is my single wan connection -
@jly2680 Which Watch guard box I had similar issues way back and it turned out to be the Marvell NIC ports and a conflict with PF. My second experience was my WAN would go down all the time because I didn't have a cable in the IPMI/IMM port which defaults to first NIC port /WAN usually. I also found that if any machine supports RMM and does not have specific IPMI/IMM it also will default to first LAN port which in that case just turn IPMI off in Bios. Oopps meant for 172pilot
-
Hello!
For reference :
https://www.freebsd.org/cgi/man.cgi?query=dhclient-script&sektion=8
What does the WAN section of Status -> Interfaces look like when it says the interface is up but there is no IP?
John