Hacker News new | ask | show | jobs
by Aweorih 2766 days ago
> such as getting an external IP address of a host from the command-line.

What about using `ping host`? This also prints the ip

2 comments

Ah, sorry, I wasn't clear in my statement:

A function that it provides is to display the public IP address from a host behind the NAT.

Another way to do this: `dig @resolver1.opendns.com ANY myip.opendns.com +short`[0] ... it's just trickier to remember. And since dig is a tool for performing DNS lookups, `man dig` doesn't hint at this particular trick.

In fact, I didn't actually remember the command that displays that for `climate`[1], because if I had, I would have written it as `public-ip`, which `climate help` informed me of. :)

[0] ... or if you prefer a more interactive and profane experience, try `lynx wtfismyip.com`

[1] My public IP is displayed on terminal start since I need it with some frequency; Of course, it's displayed as "External IP:", which is something I'll have to remedy.

or "dig host" for a proper dns lookup