What's new

Solved RT-AX58U DHCP problem - WAN gets new IP in every boot (3.0.0.4.386_41700)

  • 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!

Jovi

New Around Here
Hi !

Great firmware as guest networks are finally in their own subnets, and mesh for guest network works too :)

Anyway, like title says my RT-AX58U router gets new WAN IP in every reboot from my ISP. It's quite annoying as before moving to this AX58U my IP stayed same for more than a year. I have tried 2 different versions of Merlin firmware too, same issue happens with it too. Anyone else suffering this or is it some sort of incompatibility issue with my ISP and this Asus model router or FW? I just tested this with my good old RT-N18U (Tomato Firmware) and after being powered off for 15 minutes it still received same WAN IP from my ISP.

2)
An another question, does Asus firmware have /jffs partition nowadays or is it a Merlin thing? I did factory reset to my AX58U but /jffs partition is still there... but Merlin related directories no longer exists (configs, scripts).

3)
I can do pretty much everything I need with stock FW without Merlin (I know how to execute custom scripts in router boot up and have made custom ddns, crontabs, some other custom API calls, own NAT and firewall rules etc) but I haven't figured out yet how to make changes to dnsmasq config so that restarting it's service does not wipe away my modifications from dnsmasq.conf. If you know solution for this I would appreciate if you would share it :)
 
Please remove the "Release" prefix from your title as you are just asking a question and not announcing a new release of something. Thanks.

2)
An another question, does Asus firmware have /jffs partition nowadays or is it a Merlin thing? I did factory reset to my AX58U but /jffs partition is still there... but Merlin related directories no longer exists (configs, scripts).
Asus firmware has always had a jffs partition that it used for its own purposes. However it was not intended to be accessed by the end user. Merlin added extra functionality together with the scripts and configs directories.
 
Last edited:
Does not happen here when running 41700. Has to be your ISP.
Thanks for reply. The weird thing is that my old router RT-N18U behaves nicely and receives it's old IP from ISP even if it's been offline for minutes. There must be something with DHCP handshake of this new AX58U router. Server machine that is connected directly to internet (not via AX58U) receives it's old public IP too after reboot.

The first attempt to get IP fails, looks that WAN port (eth4) is initialized by kernel right before attempt to get IP, could be that DHCP query started before port was initialized if query has timeout before posting result in log? Looks a bit weird too that NTP gets clock fixed before router is bound to ISP's network, but might be that clock gets fixed right before log is updated regarding bounding.

May 5 08:05:07 WAN Connection: WAN(0) link down.
May 5 08:05:11 kernel: eth4 (Int switch port: 4) (Logical Port: 4) (phyId: c) Link Up at 1000 mbps full duplex
May 5 08:05:12 WAN Connection: ISP's DHCP did not function properly.
May 5 08:05:16 wan: finish adding multi routes
May 5 08:05:17 WAN Connection: WAN was restored.
May 5 08:05:19 ntp: start NTP update
Feb 23 13:36:27 dhcp client: bound 82.128.xxx.xxx/255.255.224.0 via 82.128.xxx.xxx for 3600 seconds.
 
Last edited:
Thanks for reply. The weird thing is that my old router RT-N18U behaves nicely and receives it's old IP from ISP even if it's been offline for minutes. There must be something with DHCP handshake of this new AX58U router. Server machine that is connected directly to internet (not via AX58U) receives it's old public IP too after reboot.

The first attempt to get IP fails, looks that WAN port (eth4) is initialized by kernel right before attempt to get IP, could be that DHCP query started before port was initialized if query has timeout before posting result in log? Looks a bit weird too that NTP gets clock fixed before router is bound to ISP's network, but might be that clock gets fixed right before log is updated regarding bounding.

May 5 08:05:07 WAN Connection: WAN(0) link down.
May 5 08:05:11 kernel: eth4 (Int switch port: 4) (Logical Port: 4) (phyId: c) Link Up at 1000 mbps full duplex
May 5 08:05:12 WAN Connection: ISP's DHCP did not function properly.
May 5 08:05:16 wan: finish adding multi routes
May 5 08:05:17 WAN Connection: WAN was restored.
May 5 08:05:19 ntp: start NTP update
Feb 23 13:36:27 dhcp client: bound 82.128.xxx.xxx/255.255.224.0 via 82.128.xxx.xxx for 3600 seconds.
Clone the MAC of the old router and I bet it fixes your problem.
 
Unfortunately you would have lost your bet, it does not fix it.

My another theory is that when you reboot the router, Asus FW does DHCP release, but Tomato FW in my RT-N18U does not do so, according to standards it's not necessary to do so.

If I switch the ethernet cable that connects WAN port of RT-AX58U to FTTH gateway to LAN port of an another router and will push Apply button in Advanced Settings/WAN/Internet Connection, the 58U receives new WAN IP from DHCP of other router. If I then switch back ethernet cable to it's original port in FTTH gateway and will do the same, 58U receives it's original public IP from my ISP ! Same if I turn OFF and ON the power of 58U, it receives original IP in boot (power can be turned off for minutes, lease time is 1440secs). BUT if I reboot, the WAN IP of router changes every time. Very annoying.
 
Last edited:
Yes, rebooting the router will cause it to send a DHCPRELEASE to the server.

Are you sure the lease is 1440 seconds? 24 minutes is a rather odd duration. 24 hours (1440 x 60) is more common.
EDIT: OK I can see from post #4 that the lease is 3600 seconds (60 minutes).
 
Using Merlin's firmware, if you create a custom script called /jffs/scripts/services-stop you should be able to kill the udhcpc process just before it gets a chance to send the DHCPRELEASE to the server.

Code:
#!/bin/sh
killall udhcpc
 
Thank you very much ColinTaylor ! That worked !!!

I installed Merlin 386.2_2 yesterday and were trying to figure how the services are started and stopped during boot/shutdown, and is there is way to alter the shutdown procedure or change the options of udhcpc to match the ones it's executed with in Tomato. Didn't get that far yet. Killing udhcpc process totally did the job :)


And as I gave up with stock FW - 3) is more or less solved.. Sure would be interesting to know if there is a way to do that with stock FW, but it's not an issue for me anymore.
 
Last edited:
Glad to hear that.

The udhcpc parameters are mostly hard coded although some of them can be changed on the WAN page, like DHCP query frequency. What is it that you're trying to change? Or did killing that process solve all your problems?
 
There is -b option used in Tomato (-b, --background Fork to background if lease cannot be immediately negotiated) and I was thinking that it may help to get rid of this in log "WAN Connection: ISP's DHCP did not function properly." if the udhcpc does something in too early phase of boot. Script file in udhcpc options seems to be actually binary file.

Killing udhcpc process in services-stop script like you said, more or less solved problem - It seems that shell reboot command does not 1:1 correspond to Web GUI reboot. With udhcpc killed+shell reboot WAN receives it's old IP :) But with Web GUI reboot it receives new IP. Anyway, at least now I do not need walk to other end of house if there is a need for reboot and I want to keep my old IP, I can do reboot with ssh.

Just tried that too, that I killed udhcpc in shell and then did reboot in Web GUI - I received old WAN IP, so process does not get killed early enough by /jffs/scripts/services-stop maybe? But early enough for shell reboot? Sounds weird. I better go to sleep now and continue tomorrow.
 
OK. I'm now killing udhcpc process in /jffs/scripts/ddns-start. And made cron job that makes DHCP renew by executing udhcpc twice a hour. Seems work in all use cases; Web GUI reboot and shell reboot. Let's see if this has any side effects...
 
and proper solution by using /jffs/scripts/service-event

#!/bin/sh
if [ $2 == "reboot" ]
then
killall udhcpc
logger "SERVICE-EVENT reboot -> KILL udhcpc"
sleep 1
fi
 
Last edited:

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