Re: Cron job for inxi -i reports WAN IP: <filter>
On Sat, Sep 06, 2025 at 12:36:15 +0000, Andy Smith wrote:
> "inxi" sounds like a terrible way to programmatically find your IP
> address. I would most likely use the "ip" command and any of its
> machine-readable output formats.
How would that work? "ip" only know about the IP addresses of the
machine it runs on, right?
I've got no idea what inxi does or how it would discover the IP address
of your external router, unless it's by contacting one of the many web
sites that provide such information.
> Agreed, dig +short myip.opendns.com @resolver1.opendns.com is simpler and much
> faster.
I didn't know a DNS-based method existed. That's fascinating.
> There are many others, e.g. curl ifconfig.me .
Yeah, the web-based ones are what I'm familiar with. I've even
implemented one at <http://wooledge.org/myip.cgi>. It's incredibly easy;
mine's just an sh script.
# cat /var/www/wooledge.org/myip.cgi
#!/bin/sh
echo "Content-type: text/plain"
echo
echo "$REMOTE_ADDR"
Reply to: