When OpenWrt is used as a home router, there are situations where changing the public IP address can be useful:

  • a website suddenly becomes inaccessible;
  • a service temporarily restricts the current public IP;
  • you want to refresh your public IPv4 address;
  • you do not want to reboot the router or interrupt the local network and Wi-Fi.

If the WAN uses a dynamic public IP, especially through PPPoE, there is usually no need to reboot the entire OpenWrt device. Reconnecting only the WAN interface may be enough to obtain a new public IP.

Check the WAN Protocol First

After connecting to OpenWrt over SSH, run:

uci get network.wan.proto

Common results include:

pppoe

or:

dhcp

If the result is pppoe, the Internet connection is established through PPPoE dialing.

If the result is dhcp, the WAN address is normally assigned by an upstream DHCP server.

This article mainly focuses on PPPoE.

Check the Current WAN Status

Run:

ifstatus wan

A typical result may contain:

{
    "up": true,
    "l3_device": "pppoe-wan",
    "proto": "pppoe",
    "ipv4-address": [
        {
            "address": "<PUBLIC-IP>",
            "mask": 32
        }
    ]
}

The important fields are:

  • up: true means the WAN connection is active;
  • proto: pppoe means PPPoE is being used;
  • l3_device: pppoe-wan is the logical interface created by PPPoE;
  • <PUBLIC-IP> is the current public IPv4 address.

You can also verify the public IP using an external IP-check service:

wget -qO- https://api.ipify.org
echo

The result can be used as the baseline before reconnecting the WAN.

Make Sure SSH Is Connected Through the LAN

Before disconnecting the WAN, it is a good idea to confirm that the current SSH session is not using the public Internet connection.

Run:

echo "$SSH_CONNECTION"

A LAN-based session may look like:

<LAN-CLIENT-IP> <PORT> <ROUTER-LAN-IP> 22

If both addresses belong to your private local network, the SSH session is using the LAN.

In that case, disconnecting the WAN should not terminate the SSH session.

If you are remotely connected through the router’s public IP, do not disconnect the WAN unless you are prepared to lose the SSH connection immediately.

Reconnect the WAN Without Rebooting OpenWrt

For PPPoE, the simplest method is:

ifdown wan
sleep 10
ifup wan

The commands are straightforward.

First:

ifdown wan

disconnects the current WAN session.

Then:

sleep 10

waits briefly so that the previous PPPoE session has time to close.

Finally:

ifup wan

starts a new WAN connection.

This does not reboot OpenWrt and does not restart the entire network stack.

The LAN bridge, Wi-Fi, local DHCP server, and other local services normally continue running.

Check the New Public IP

After reconnecting the WAN, run:

wget -qO- https://api.ipify.org
echo

If the result has changed, for example:

Old address:
<PUBLIC-IP-A>

New address:
<PUBLIC-IP-B>

then the public IP has successfully changed.

You can also check the WAN status again:

ifstatus wan

If the result shows:

"up": true

and the WAN uptime is very short, the new PPPoE session has been established successfully.

Why This Is Better Than Rebooting the Router

A common way to obtain a new public IP is simply:

reboot

This may work, but it restarts far more than necessary.

A full reboot may temporarily interrupt:

  • Wi-Fi;
  • LAN connectivity;
  • DHCP;
  • DNS;
  • firewall services;
  • local applications;
  • VPN connections;
  • containers;
  • USB devices;
  • other services running on OpenWrt.

If the only goal is to refresh the public IP address, reconnecting only the WAN is a much cleaner approach:

ifdown wan
sleep 10
ifup wan

The general principle is simple:

Restart only the component that actually needs to be restarted.

Why Reconnecting PPPoE May Produce a New IP

With PPPoE, the public IP is often associated with the current PPPoE session.

When:

ifdown wan

is executed, the active PPPoE session ends.

When:

ifup wan

is executed, OpenWrt establishes a new PPPoE session.

The ISP may then:

  • assign the same public IP again;
  • assign another address from its dynamic address pool.

The exact behavior depends entirely on the ISP’s address allocation policy.

For this reason, reconnecting PPPoE does not guarantee that the public IP will always change.

However, if testing shows that a new PPPoE session frequently receives a different address, this method can effectively replace a full router reboot.

What If the IP Does Not Change?

If the new session receives the same address, it does not necessarily mean that OpenWrt failed to reconnect.

The ISP may simply have assigned the same IP again.

You can try increasing the disconnected period:

ifdown wan
sleep 30
ifup wan

or:

ifdown wan
sleep 60
ifup wan

Whether this helps still depends on the ISP’s allocation system.

It is generally not worth modifying unrelated network parameters simply to force a different IP address.

Avoid Restarting the Entire Network Service

Some guides recommend:

service network restart

or:

/etc/init.d/network restart

For the specific purpose of refreshing the public IP, this is usually unnecessary.

Those commands can affect much more than:

ifdown wan
ifup wan

Depending on the configuration, they may restart:

  • LAN;
  • WAN;
  • VLANs;
  • bridges;
  • VPN interfaces;
  • other logical network interfaces.

Unless the entire network configuration has changed, restarting only the WAN is preferable.

A Practical Public-IP Refresh Command

For an OpenWrt system already confirmed to use PPPoE, and where reconnecting PPPoE is known to produce a new address, the practical command is simply:

ifdown wan
sleep 10
ifup wan

Then verify the result:

wget -qO- https://api.ipify.org
echo

To display the address before and after reconnection:

echo "Old IP:"
wget -qO- https://api.ipify.org
echo

ifdown wan
sleep 10
ifup wan
sleep 10

echo "New IP:"
wget -qO- https://api.ipify.org
echo

Things to Check After Changing the Public IP

If services are exposed to the Internet from the home network, a public-IP change may affect them.

DDNS

If Dynamic DNS is in use, confirm that the DDNS client detected the IP change and updated the DNS record.

This usually happens automatically, but there may be a short delay.

Remote Access

Any remote service that directly depends on the old public IP will stop working through that address.

Examples include:

  • SSH;
  • VPN services;
  • self-hosted applications;
  • other forwarded services.

For regular remote access, DDNS is generally more convenient than relying on a fixed numeric IP.

Existing Internet Connections

When the WAN reconnects and the public IP changes, existing NAT and connection-tracking entries are no longer valid for the new connection.

Active Internet sessions may therefore disconnect, including:

  • downloads;
  • SSH sessions over the WAN;
  • games;
  • video streams;
  • long-lived TCP connections.

Applications normally recover after reconnecting.

Using an IP Change to Diagnose Reputation Problems

Changing the public IP can also be useful as a diagnostic method.

Consider this pattern:

Most websites work normally
↓
One particular website is inaccessible
↓
DNS works
↓
General Internet connectivity is normal
↓
Changing the public IP immediately fixes the problem

In such a case, the problem may not be caused by:

  • the browser;
  • OpenWrt;
  • DNS;
  • NAT;
  • the firewall.

Instead, the previous public IP may have been affected by:

  • website risk-control systems;
  • anti-abuse systems;
  • IP reputation databases;
  • temporary access restrictions.

For this reason, refreshing the public IP can be a useful troubleshooting technique when only specific websites or services are affected.

Conclusion

If OpenWrt uses PPPoE and the ISP provides dynamic public IPv4 addresses, changing the public IP usually does not require rebooting the router.

The minimal operation is:

ifdown wan
sleep 10
ifup wan

Then verify the result:

wget -qO- https://api.ipify.org
echo

Compared with rebooting the entire router, this method is:

  • faster;
  • less disruptive;
  • less likely to affect the LAN;
  • less likely to interrupt Wi-Fi;
  • unnecessary to reboot OpenWrt itself;
  • useful as a diagnostic tool for public-IP-related access problems.

For networks where PPPoE reconnection has already been verified to produce a new public address, this is one of the cleanest and most efficient ways to refresh the public IP.

Leave a Reply

Your email address will not be published. Required fields are marked *