How to automatically re-dial PPPOE (wan) to get new IP address?

How to automatically re-dial PPPOE (wan) to get a new IP address?
I want to know if there is a way to config it and make a cronjob to change the Internet IP address at a specific time. However, I don't know how to do so on OpenWrt, please help!

That's up to your Internet Service Provider (ISP). If your ISP recycles IP addresses, you might be able to pick up a new one each time. If your ISP doesn't recycle IP addresses, or has allocated you with a "static IP", then you might not be able to.

My own connection is an example of this. I use PPPoE, and the IP address is assigned dynamically by the ISP each time the router connects; the router does not have a fixed IP address configured in its own settings.

However, the ISP issues the same IP address every time. It doesn't matter how many times I cycle the connection, I'll never get a new address.

If you need a new IP address, have a word with your ISP.

1 Like

My ISP recycles IP address every time I reboot the router, so I intend to find a way to reboot the router automatically at a specific time maybe. I don't know if the IP changes if I restart the interfaces as well (don't need to reboot the WHOLE router)

OpenWRT uses cron, so you can whip up a crontab entry/script to bounce the WAN connection or even reboot the router on a schedule.

If you do it through the GUI, it's managed from System -> Scheduled Tasks (http://<router management address>/cgi-bin/luci/admin/system/crontab).

If you do it through the CLI, it's managed by the file /etc/crontabs/root (you might need to create it if it doesn't already exist, and you might need to restart the cron daemon).

1 Like

yes, I think so too. The problem is I'm new with OpenWrt and don't know how to set up cronjob correctly

https://man7.org/linux/man-pages/man5/crontab.5.html

You can try to schedule this command:

ifup wan
1 Like
# crontab -l
# Reinitialise PPPoE session at 04:00 in the morning.
00 04 * * * /sbin/ifdown wan && /sbin/ifup wan
1 Like