[Solved] How to reconnect if WAN IP is CGN? ifup?

My ISP is handing out CGN addresses sometimes, I am using pppoe.

How can I configure openwrt to reconnect to the ISP till I get a normal IP address? CGN IPs always start with 100.

put this in /etc/hotplug.d/iface/100-no_cgn
eventually replace interface name

#!/bin/sh
#check ip and reconnect if starts with 100.

[ "$ACTION" = ifup ] || exit 0
[ "$DEVICE" = "pppoe-wan" ] || exit 0
. /lib/functions/network.sh
network_get_ipaddr ip wan

case "${ip}" in
      100\.*)       killall -HUP pppd
                        ;;
esac

but beware.. if your isp starts to give you an cgn ip always, this will keep you offline.

3 Likes

Thank you. This has solved the problem for now. I think the solution may help other people too.

If your problem is solved, please consider marking this topic as [Solved].

1 Like

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