Restart wan if CGN ip

so my ISP assigns me CGN IPv4 (100.64/10) by mistake (or some error on their end - or lack of public IPs) but after a wan restart this usually gets fixed.
How can I detect such an IP and restart the wan ?

https://openwrt.org/docs/guide-user/base-system/hotplug

2 Likes

cool, thanks - what about detecting such an ip ?

[Solved] How to refresh Internet connection if assigned private IP - #8 by vgaetera

2 Likes

@vgaetera hooked you up...

thank you very much both @vgaetera and @frollic

2 Likes

just for completeness here's the script I've used (only replaced 10 with 100):

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" ] \
&& [ "${INTERFACE}" = "${NET_IF}" ] \
&& [ "${NET_ADDR%%.*}" = "100" ]
then
    sleep 10
    ifup "${NET_IF}"
fi
EOF
2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.