Hi, due to MTs outage of mynetname, I want to update my Cloudflare DNS-records alternatively.
But how can if find via scripting the current WAN-IP?
I have multiple 0.0.0.0/0 routes (distance, 1, 2, 3…) and they failover via a recursive-lookup which works good.
But how can I get the IP of the current active default-route? I can get the gateway-IP or immediate-gw which is someting like 1.2.3.4%PPPoE (and I found out via scripting you cant cut away the “%PPPoE”-part in this example). But thats the gateway IP, not the current IP of the default-route which I need to update my DNS-records…
Yeah I’m not sure the “best way” here… I think parsing the /ip/route and the intermediate gateway value, and then looking up /ip/address based on what was found+parsed from /ip/route is kinda the only indirect way to do this. Could be wrong, maybe someone else is smart here…
Another approach is not use Cloudflare… as some other DDNS provides have a web API that will update DNS based on the IP that’s detected from the packet to DDNS service. But since Cloudflare (and AWS too), just expose an API that allow updating DNS records, you do need to know the IP to set - since Cloudflare has not have specialized method (AFAIK) that will detect the WAN IP based on an HTTP src-address.