Completely resetting WAN interface

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

Kanji-San

Regular Contributor
I am looking for commands to completely reset the WAN eth0 interface on my RT-AX88U equivalent to what happens during a reboot. Something that goes beyond service restart_wan.
Background: my WAN goes sporadically down and only a reboot fixes it. I would like to find a way to take eth0 offline and bring it back online.
 

eibgrad

Very Senior Member
Not sure there is anything more thorough than a reboot. Esp. when we don't really know the underlying cause of your problems.

Code:
( service stop_wan; sleep 3; ifconfig eth0 down; sleep 3; ifconfig eth0 up; sleep 3; service start_wan ) &

??
 

Kanji-San

Regular Contributor
Ya I would find out what the issue is instead of throwing a bandage on it.
Agree. My ISP is trying to figure it out. Until then I need to bring up the WAN preferably without reboots.
 

RMerlin

Asuswrt-Merlin dev
Does your ISP's DHCP send their DHCP packets with a source port of 67?

You could try adding this to see if it makes any difference:

Code:
iptables -I INPUT -p udp --dport 68 -j ACCEPT

Note that this rule will be lost whenever the router's firewall is restarted, so just try it as a test before your DHCP lease expires.

Otherwise, might be worth using tcpdump to capture all DHCP traffic between you and your ISP.
 

Kanji-San

Regular Contributor
Does your ISP's DHCP send their DHCP packets with a source port of 67?

You could try adding this to see if it makes any difference:

Code:
iptables -I INPUT -p udp --dport 68 -j ACCEPT

Note that this rule will be lost whenever the router's firewall is restarted, so just try it as a test before your DHCP lease expires.

Otherwise, might be worth using tcpdump to capture all DHCP traffic between you and your ISP.
I already captured DHCP traffic with tcpdump and found out it's unrelated to DHCP. The WAN connection just sporadically goes down and only recovers when the router is rebooted. I documented this in another thread WAN was exceptionally disconnected.

Since this all happened after the ISP had replaced network equipment and upgraded me to gigabit, I asked the ISP to systematically replace each piece of equipment to get to the bottom of this. A small portion of my neighbors, who were also upgraded, have similar problems. What puzzles me, is the fact that rebooting the router brings back the WAN connection but rebooting the (new) ONT does not. My router worked perfectly before the upgrade.
 

KevTech

Very Senior Member
Could try taking out or disabling the addons to see if router stable without them.
Might be one of them crashes and takes down the WAN.
Any reason you have not upgraded to 386 code or is sig just not updated?
 

Kanji-San

Regular Contributor
My signature is up to date. The reason is that 384.19 has been working great for me and I did not want to rock the boat. Additionally with the gigabit (hardware) upgrade, I did not want to change everything at once. Too many variables.

I am pretty sure the add-ons are very stable and are not responsible for any WAN disconnects. It must be hardware-related since these WAN disconnects started after the upgrade.
 

Kanji-San

Regular Contributor
@RMerlin How can I enable debugging for wanduck? I would like to see what happens when my WAN goes down and does not come up anymore.
 

RMerlin

Asuswrt-Merlin dev

Kanji-San

Regular Contributor
There is no debugging option.
Thank you. I thought there was a way when I looked at the wanduck code:
Code:
wdbg = nvram_get_int("wdbg");
test_log = nvram_get_int("wanduck_debug");

...
if(test_log)
_dprintf("# wanduck: if_wan_phyconnected: x_Setting=%d, link_modem=%d, sim_state=%d.\n", !isFirstUse, link_wan[other_wan_unit], sim_state);
...

I just don't know where these _dprintf go.

Is wanduck really necessary for the function of the router if there is no dual wan setup?
 

john9527

Part of the Furniture
I just don't know where these _dprintf go.
It's been a while, but IIRC _dprintf/_cprintf are writing to the serial console (you need to hook up to the serial port on the main board). Then there are additional steps to enable the port.
Is wanduck really necessary for the function of the router if there is no dual wan setup?
Yes, wanduck handles more wan functions other than just dual wan.
 

RMerlin

Asuswrt-Merlin dev
Thank you. I thought there was a way when I looked at the wanduck code:
Code:
Might have been added by Asus at one point, but it's probably only for very specific areas of the service. All output would be sent to the serial console.

Is wanduck really necessary for the function of the router if there is no dual wan setup?
Yes. Wanduck handles all WAN events, such as connect/disconnects.
 

Kanji-San

Regular Contributor
Might have been added by Asus at one point, but it's probably only for very specific areas of the service. All output would be sent to the serial console.


Yes. Wanduck handles all WAN events, such as connect/disconnects.
If wanduck handles all WAN connects and disconnects, this would be the right place to go looking if the WAN connection goes down but does not come up again although the Internet connection is at the ONT (verified with a laptop)?
 

john9527

Part of the Furniture
Did you ever post a syslog of when it goes down and fails to reconnect? Someone might be able to spot something.
 

RMerlin

Asuswrt-Merlin dev
If wanduck handles all WAN connects and disconnects, this would be the right place to go looking if the WAN connection goes down but does not come up again although the Internet connection is at the ONT (verified with a laptop)?
I don't know. Quite frankly, the wanduck code is a complete nightmare, and I have given up making sense of it many years ago... It needs to be scrapped and rewritten from scratch.
 

Kanji-San

Regular Contributor
Did you ever post a syslog of when it goes down and fails to reconnect? Someone might be able to spot something.
No, I did not. Great idea! Here it is: pastebin
I sanitized MAC and IP addresses and a couple of irrelevant things.

WAN connection went down:
Apr 23 18:18:52 WAN_Connection: ISP's DHCP did not function properly.

I was responsible for the WAN link down and up, since I unplugged the router.
Finally, I had do manually reboot (see ### MANUAL REBOOT in the log file). The router reboots and the WAN connection is restored.
 
Last edited:

Kanji-San

Regular Contributor
What's in your service-event script?
service-event:
Code:
#!/bin/sh

/jffs/scripts/spdmerlin service_event "[email protected]" & # spdMerlin
/jffs/scripts/connmon service_event "[email protected]" & # connmon

at some point I had this in there to trace WAN DHCP requests until I found this is not a good place to have it:
Code:
/opt/sbin/tcpdump -vnes0 -i eth0 port '(67 or 68)' -U -w /mnt/DRIVE8GB/tcpdump.capture
 

Similar threads

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