OPNsense Forum

English Forums => General Discussion => Topic started by: Dayve on August 27, 2020, 06:31:05 pm

Title: WAN went down. Reboot fixed it.
Post by: Dayve on August 27, 2020, 06:31:05 pm
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?
Title: Re: WAN went down. Reboot fixed it.
Post by: Dayve on August 28, 2020, 11:23:11 am
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?
Title: Re: WAN went down. Reboot fixed it.
Post by: marjohn56 on August 28, 2020, 02:45:27 pm
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.
Title: Re: WAN went down. Reboot fixed it.
Post by: marjohn56 on August 28, 2020, 04:09:05 pm
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.
Title: Re: WAN went down. Reboot fixed it.
Post by: Dayve on August 28, 2020, 08:09:40 pm
Thank you.

I will set it up when I get home today.
Title: Re: WAN went down. Reboot fixed it.
Post by: jimbobjones on October 03, 2023, 02:00:16 am
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.
Title: Re: WAN went down. Reboot fixed it.
Post by: newsense on October 03, 2023, 03:50:36 am
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.
Title: Re: WAN went down. Reboot fixed it.
Post by: jimbobjones on October 03, 2023, 04:32:49 am
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.
Title: Re: WAN went down. Reboot fixed it.
Post by: cookiemonster on October 03, 2023, 06:07:06 pm
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.
Title: Re: WAN went down. Reboot fixed it.
Post by: CJ on October 03, 2023, 06:27:02 pm
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.
Title: Re: WAN went down. Reboot fixed it.
Post by: firewall on November 30, 2023, 02:46:28 am
Surely there is something built-in to opnsense that can get the internet back without rebooting from within the GUI?

unfortunately not.

Didn'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:

Code: [Select]
/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.
Title: Re: WAN went down. Reboot fixed it.
Post by: tent on March 16, 2024, 04:59:12 pm
Surely there is something built-in to opnsense that can get the internet back without rebooting from within the GUI?

unfortunately not.

Didn'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:

Code: [Select]
/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.. ;)