Web lists-archives.com

Re: Get the external IP address from a Linux box

Hash: SHA1

On Thu, May 24, 2018 at 07:22:56AM +0100, André Rodier wrote:
> Hello,
> I am looking for a native package on Debian, that can give me the
> external IP address of the machine.

Before embarking in such a task, you might want to consider what
"the external IP address of your machine" actually means, just to
understand where the limitations and pitfalls of such a concept are.

> So far, I used internet sites, but I am sure there is a package that do
> that properly, especially if one site is unreachable.

Judging from that, I guess you mean "your machine as seen from the
Internet". Well, that will (in most cases)  the IP address your provider
assigns to your DSL modem (or your cable modem, or whatever device
you're using to connect to the Internet). Behind that, there's (again:
most probably, but not necessarily) an NAT ("network address translation",
so your machine's IP address looks different.

> Something I can run from the command line, and that would return the
> external IP address.

For that you'll always need the cooperation of some site located in what
you consider to be "out there".

- -- tomás
Version: GnuPG v1.4.12 (GNU/Linux)