What's new

Commands to replicate web UI's "Enable WAN" Yes/No functionality

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

nicjac

New Around Here
Hello,

I have an on-going issue with my ISP and the only fixes appear to either reset my modem (connected to my TUF-AX5400 in bridge mode) or to disable and enable the WAN through the web UI.

I put together a user script to automatically detect loss of connectivity and to reset the WAN. However, I seem unable to replicate the commands sent behind the scene by the actions of setting "Enable WAN" to "no" then to "yes" in the router's web UI.

I tried stop_wan and start_wan, but it doesn't seem to 100% replicate the web UI's action as it doesn't fix my issue.

Is there a way to find out which commands are sent in the background through interactions with the web UI? Or does anyone know how to replicate this?

The only hint I have is that I see this in the logs when I apply my changes after setting "Enable WAN" to "no":

Code:
Jan 22 12:36:42 rc_service: httpd 1783:notify_rc restart_wan_if 0;restart_stubby

Thanks!
 
In looking at @Jack Yaz scmerlin script, he uses a service command to restart the wan:

service restart_wan >/dev/null 2>&1

The script does mention it can take 30-60 seconds.
 
I have an on-going issue with my ISP

Unable to get WAN IP from ISP DHCP is sometimes related to this setting in Administration, System:

1674397469589.png


Disable Network Monitoring and test again. I've seen it happening on different models Asus routers with my ISP.
 
In looking at @Jack Yaz scmerlin script, he uses a service command to restart the wan:



The script does mention it can take 30-60 seconds.
I did try service wan_restart but it must be missing compared to the manual disabling / enabling via the UI as it doesn't fix my issue.

Unable to get WAN IP from ISP DHCP is sometimes related to this setting in Administration, System:

View attachment 47384

Disable Network Monitoring and test again. I've seen it happening on different models Asus routers with my ISP.
That's one of the first things I investigated after seeing multiple mention of it on here, but it was already disabled for me.
 
This has come up before. Search for ChkWAN script.

I use it as the same thing was happening to me and I would just stop and start WAN through webui and everything would be back to normal. Since using ChkWAN, I haven't noticed when issues happen.

Here's the script: https://github.com/MartineauUK/Chk-WAN
 
Last edited:
I did try service wan_restart but it must be missing compared to the manual disabling / enabling via the UI as it doesn't fix my issue.


That's one of the first things I investigated after seeing multiple mention of it on here, but it was already disabled for me.

I believe the button in the GUI also releases your DHCP lease, which might be what is fixing your issue, basically a release/renew.

So you could try scripting the release, followed by using ifconfig to bounce the wan port? I'm assuming when the WAN port comes back up it will request a new lease.

Actually simply doing a release/renew may fix your issue. If so, try toying with the DHCP frequency on the WAN settings, maybe you're doing it too much and they're blocking it, or not frequently enough?
 
I believe the button in the GUI also releases your DHCP lease, which might be what is fixing your issue, basically a release/renew.

So you could try scripting the release, followed by using ifconfig to bounce the wan port? I'm assuming when the WAN port comes back up it will request a new lease.

Actually simply doing a release/renew may fix your issue. If so, try toying with the DHCP frequency on the WAN settings, maybe you're doing it too much and they're blocking it, or not frequently enough?
That's a good shout - I never tried to force DHCP release/renew. I see that the ChkWAN script mentioned above does it like this:

Code:
killall -USR1 udhcpc

Is that the recommended way?

Thanks everyone!
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top