Similar to a http://whatismyip.com lookup. It would obviously need to query a computer out there. Just wondering if anyone had a clever way to do it?
Similar to a http://whatismyip.com lookup. It would obviously need to query a computer out there. Just wondering if anyone had a clever way to do it?
This only works if you are using OpenDNS as your dns server.
If you aren't, one of these should work:
STUN is the proper solution.
You can use curl to get the page from something like whatismyip and then get the pieces out. I used whatismyipaddress.com in this example...obviously the fields will differ with different services.
One must use OpenDNS' servers to use this... You can query a certain DNS server with dig like that:
i just run a traceroute to somewhere on the internet and look for the hop out of our local network.
perhaps there's a better way?
"lynx http://whatismyip.com"
the simplest way is: curl ifconfig.me
you can use the ifconfig command to list all interfaces and their associated IP address(es).
so, if you know your internet interface is ppp0, you can run
X.X.X.X will be your IP address. Y.Y.Y.Y is the IP address of the next hop.
you can then postprocess the output of ifconfig with grep/awk/sed/cut/perl/whatever to extract just the IP.
another alternative, if you have the iproute tools installed, is to use the ip command. e.g.
that's probably easier to read and certainly easier to parse: