Problem connecting to pppoe

I am connecting to my internet provider through PPPoE connection

provider assigns me IP dynamically

but provider sometimes assigns private IP (10.x.x.x) instead of public
(I mean that my provider assigns randomly private or public IP)
here is my question

how can I configure openwrt to renew connection automatically if private IP is assigned ??
in openwrt forum wrote script
Code:
cat << "EOF" > /etc/hotplug.d/iface/10-fix-wan-ip
. /lib/functions/network.sh
network_flush_cache
network_find_wan NET_IF
network_get_ipaddr NET_ADDR "${NET_IF}"
if [ "${ACTION}" = "ifup" -a "${INTERFACE}" = "${NET_IF}" -a "${NET_ADDR%%.*}" = "10" ]
then
sleep 10
ifup "${NET_IF}"
fi
EOF

What is the way to start the script

Router tp link archer c20 v5 with complex openWrt
so far i have worked with ubuntu

Hi

you need to SSH into your router
then paste this code in SSH session
don't forget to hit ENTER at the end

code is "self writing", it will place script in right place

you could check if script is written with
ls /etc/hotplug.d/iface/

and you will see file named "10-fix-wan-ip"

EDIT: since it is hotplug script, it will be started automatically, on hotplug event, when your router get a WAN IP

1 Like

i went /etc/hotplug.d/iface/
nano 10-fix-wan-ip

. /lib/functions/network.sh
network_flush_cache
network_find_wan NET_IF
network_get_ipaddr NET_ADDR "${NET_IF}"
if [ "${ACTION}" = "ifup" -a "${INTERFACE}" = "${NET_IF}" -a "${NET_ADDR%%.*}" = "10" ]
then
sleep 10
ifup "${NET_IF}"
fi
EOF

safe

they will work like this