Renew WAN ip address

Hi There,
I do have a linksys WRT1200AC with LEDE on it since few days, previous I had dd-wrt and schedule my router to reboot every morning at 6:30 and get a new IP address from ISP.
Now with LEDE this seams not to be possible out of the box, after a reboot my router get's the same public IP address.

My network setup:
ISP cable router(set to bridge mode) -> Linksys WAN port (set on DHCP)-> WIFI/LAN clients

Do you have an idea why with LEDE the IP address is not changing any longer?
And how to proper create a schedule reboot of my router?
I tried with Scheduled Tasks (CRON)
30 06 * * * reboot
And my router keep rebooting over and over again.

Thanks!

This is likely caused by the lack of realtime clock on the hardware - this is documented in the section "Periodic reboot of a router" of OpenWrt's Wiki Cron and crontab.

You might have to issue an ip release of your WAN interface to get a new one. Also some ISP link that IP to your MAC address and then, to get a new IP, you need to play with your WAN MAC; this doesn't seem to be your case because it was working before.

The trick is to sleep > 60s before issuing the reboot to ensure that the time after reboot is advanced by one minute to avoid triggering the very same job yet again. Use something like 30 06 * * * sleep 70 && reboot.

A less invasive method might be to simply reconnect wan with ifdown wan; sleep 5; ifup wan

1 Like

The cron reboot with delay works great, thanks for that!! first issue is fixed :slight_smile:
Second issue with the ip renew is not working... i don't know why, I tried:
ifdown wan; sleep 5; ifup wan

https://forum.openwrt.org/viewtopic.php?id=52335
Release: killall -SIGUSR2 udhcpc
Renew: killall -SIGUSR1 udhcpc

But nothing is making my ip to change.. I don't understand why...

Have you tried to change your WAN MAC to see if it does something?

network.wan.macaddr='new fake mac'

1 Like

Hi again, sorry I was off for a business trip..

Changing the wan mac works, but is not really usable :frowning:
cause every time I have to restart also my kabel modem and on that one I have no control, unless I do it manually.
So I found a nice script which changes the mac address to a random one after each reboot, is this one here:
https://forum.openwrt.org/viewtopic.php?id=48090

#Renew WAN mac address to change ip
uci set network.wan.macaddr=60:38:E0:`head /dev/urandom | 
                    tr -dc "0123456789abcdef" | head -c2`:`head /dev/urandom | 
                    tr -dc "0123456789abcdef" | head -c2`:`head /dev/urandom |
                    tr -dc "0123456789abcdef" | head -c2`

uci commit network

But after each reboot I have to reboot manually the modem from ISP too, which means switch the power button off->on.

On the wan interface setting there are two additional options:
Client ID to send when requesting DHCP:
Vendor Class to send when requesting DHCP:

Can I use them to trigger a new IP address?
without the need to reboot my modem manually which I don't want to do...cause If I'm not at home then my wife will kill me :smile:

Hi, was looking to achieve this. Did you find a solution?

Nope, no solution till now...
If someone has a new idea i would be very happy to hear about it.
If you archive it, can one still see and reply to this entry ?

I had the same problem and I solved it by accident: I had to relocate my router far from my tech cabinet, so I bought a passive PoE injector kit to drive the power from this cabinet's UPS; this kit however reduce the cable speed from Gigabit speed to 100Mbits.

Since my connection is 30/10, that's fine, but the nice thing is that now when I reboot my router, no need to reboot the modem like before with my gigabit link.

This is how I do it...

# Release WAN IP, wait 30 seconds, renew WAN IP (should get a new IP)
killall -SIGUSR2 udhcpc
sleep 30
killall -SIGUSR1 udhcpc
exit 0
3 Likes

@anon57995562

You are a star. Locked out of my own website by over-zealous security droid and those three commands via ssh gave me a new and untainted IP. Thank you!

LEDE Reboot 17.01.4 r3560-79f57e422d / LuCI lede-17.01 branch (git-17.290.79498-d3f0685)
Running on modified BT Home Hub 5A

I am not sure if this might apply to your situation but I use ADSL2 for internet and my main router is in bridge mode and if I want to reboot my router I can actually telnet it and issue a command to reboot or if I just want to issue a new IP I reconnect the internet through PPPOE on my LEDE router.

In your situation you might want to Telnet to your router and issue a command to fix the issue.

For me adsl connection --down && adsl connection --up works well in telnet. I dont own a cable connection so cant really help with that.