[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Get the external IP address from a Linux box

On Thu, 24 May 2018 07:22:56 +0100
André Rodier <andre@rodier.me> wrote:

> Hello,
> I am looking for a native package on Debian, that can give me the
> external IP address of the machine.
> So far, I used internet sites, but I am sure there is a package that
> do that properly, especially if one site is unreachable.
> Something I can run from the command line, and that would return the
> external IP address.

To begin with, try:

ip addr show

and look for the block of information with a label beginning 'eth' or
'en'. That will contain the Ethernet adaptor IP address. From your
question, I assume your computer contains only one.

The address returned by Internet sites will be your public IP address,
and unless you have a very unusual setup, that will not be the same as
the IP address of your computer. But you have told us nothing at all
about how your computer connects to the Internet, so I am just guessing.

On the assumption that you are using a router of some kind, your public
IP address will be that of the router WAN port (cable, ADSL, etc.) and
there will be a method of determining that by connecting to the router
as an administrator. That method will depend entirely on the router.


Reply to: