WAN went down. Reboot fixed it.

Started by Dayve, August 27, 2020, 06:31:05 PM

Previous topic - Next topic
Today I had my internet go down. Was not home so I had my daughter reboot Opnsense. Then the internet was back up.

Is there a way to have it reboot or reset the WAN if it is lost?

Update:

I found that I was not monitoring the WAN. So i unchecked the box and set a monitor IP to google.

Will this work then?

Hi, No it won't it's just monitoring the WAN. I have a script that's run from a Cron event that checks every few minutes and reboots if there is no ping response from a WAN address - such as google. I'll dig it out and post how to use it when I get home.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

August 28, 2020, 04:09:05 PM #3 Last Edit: August 28, 2020, 04:13:08 PM by marjohn56
Here you go. The files you need are attached. Follow these instructions.

copy the ping_check.sh file to /usr/local/etc/rc.d

make sure the permissions are set to 755 so it's executable.

copy the actions_pingcheck.conf to /usr/local/opnsense/service/conf/actions.d

We now need to reload configd so it knows about the new action, there are a couple of ways, this is  the one I use.

# service configd restart

Now, we can go to the Cron GUI and add the new event. Goto System->Settings-Cron and add a new job.

In the minutes box enter */10

For Hours, Day of Month and Months just enter *

In Command, select 'ping_check'

No Paramaters are required. and for description, I just call mine ping check. Enable and save and that's it. It will check every 10 minutes and reboot if there is no response, it tries an interface down/up first before it reboots.


*** NOTE ***
You may need to edit the script if you do not have intel nics, mine are and my WAN is therefore igb0, if you have something else you'll need to change that to suit.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

Thank you.

I will set it up when I get home today.

Is there no better built-in solution to this problem?
When I lose power (which is unfortunately fairly frequently) opnsense is unable to reconnect to the internet without me rebooting opsense.

Very annoying.

Quote from: Dayve on August 27, 2020, 06:31:05 PM
Was not home so I had my daughter reboot Opnsense. Then the internet was back up.

Unless you do a graceful reboot/shutdown from GUI or over ssh you might end up with a corrupted filesystem.

You can safely unplug the modem though next time, that should suffice and would be a much nicer alternative with less risk involved.

October 03, 2023, 04:32:49 AM #7 Last Edit: October 03, 2023, 04:47:44 AM by jimbobjones
Quote from: newsense on October 03, 2023, 03:50:36 AM
Quote from: Dayve on August 27, 2020, 06:31:05 PM
Was not home so I had my daughter reboot Opnsense. Then the internet was back up.

Unless you do a graceful reboot/shutdown from GUI or over ssh you might end up with a corrupted filesystem.

Surely there is something built-in to opnsense that can get the internet back without rebooting from within the GUI?

Didn't think I would have to cron a script to reboot as mentioned a few posts above.

Despite the old post, Please don't assume that OPN relies on cron scripts or that randomly "the internet went down" and a reboot is required. Easy to make that assumption based on this user report, someone trying to be heplful giving them a script and they took it away as the solution. It is not.
The right way here is to investigate why it happens, as there are many threads here and find what is particular to the installation that something goes wrong.
Remember this software is not your normal ISP router where this might be needed.
Instead is a software used for business and in places like datacentres, where this would be unacceptable. The difference there is that the installers and operators are usually network engineers that know how to setup a router and firewall and know how to diagnose and bring a good diagnosed problem, rather than a "internet has gone down, why can it be?"
Open a new thread please with a good explanation of your problem and diagnostic so far if possible and your setup description and a better answer will likely to be found for you.

I agree with CM.  The only times my OPNSense gets rebooted is for updates and power outages longer than the UPS runtime.  It's been super reliable and even if my ISP connection goes down, OPNSense immediately reconnects once it comes back up with no intervention.

Quote from: jimbobjones on October 03, 2023, 04:32:49 AM
Surely there is something built-in to opnsense that can get the internet back without rebooting from within the GUI?

unfortunately not.

Quote from: jimbobjones on October 03, 2023, 04:32:49 AMDidn't think I would have to cron a script to reboot as mentioned a few posts above.

you might look into finagling a cron script to restart the interface instead of rebooting the entire machine. these are the lines i use for just such an approach:


/usr/local/sbin/configctl interface linkup stop ue0
/usr/local/sbin/configctl interface reconfigure ue0
/usr/local/sbin/configctl interface linkup start ue0


don't let the naysayers poopoo the use of cron for something alternatively addressed with the likes of redis. until a redis plugin for opnsense gets closer to feature parity with CLI the amount of sorcery involved in making it work simply ain't worth the trouble.

Quote from: firewall on November 30, 2023, 02:46:28 AM
Quote from: jimbobjones on October 03, 2023, 04:32:49 AM
Surely there is something built-in to opnsense that can get the internet back without rebooting from within the GUI?

unfortunately not.

Quote from: jimbobjones on October 03, 2023, 04:32:49 AMDidn't think I would have to cron a script to reboot as mentioned a few posts above.

you might look into finagling a cron script to restart the interface instead of rebooting the entire machine. these are the lines i use for just such an approach:


/usr/local/sbin/configctl interface linkup stop ue0
/usr/local/sbin/configctl interface reconfigure ue0
/usr/local/sbin/configctl interface linkup start ue0


don't let the naysayers poopoo the use of cron for something alternatively addressed with the likes of redis. until a redis plugin for opnsense gets closer to feature parity with CLI the amount of sorcery involved in making it work simply ain't worth the trouble.

still trying to do a similar cron job which looks nice: but every how much would you schedule that cron job?
Also I guess you would check first before throwing down and up the interface: how would/are you doing it? Best practices?
Still I really think this is a big negative/missing feature of the OPNsesne router, not to have it streamlined in the normal code.. and no I'm not thinking it should be something overkill like with a redis monitoring etc.. ;)


Hi,

I just wanted to share my fix on strange problem on one of my customer networks.

Their internet access stopped once or twice per week (maybe 50 client pcs) but I always could connect to terminal via VPN and reboot firewall.

WAN interface was Intel NIC, LAN Realtek NIC.

Only change I did, replaced Realtek with Intel NIC and problem is no more.

Maybe using Realtek driver plugin would have helped also but I try to avoid "modifying" Opnsense as much I can.

I have a feeling that this problem manifests itself only when traffic is high. I have similar setup with much smaller network and this has happened only once in 12 months.

BR, Markku


It has been known for ages (years) that realtek nics are problematic on freebsd.
At high traffic they choke and stop responding. Naturally when that happens, if it is used as a network device, the network will fail. Here is where people have resorted to restarting it, cron or otherwise.
For storage devices like a NAS, services also stop and data transfers fail.
All is needed is to do an online search for the infamous "re0 watchdog timeout" which is or was the usual symptom.
Moral of the story, don't use realtek if it can be avoided.