Web lists-archives.com

Re: Get the external IP address from a Linux box




On Thu, 2018-05-24 at 00:19 -0700, John Conover wrote:
> likcoras writes:
> > > > 
> > > > I am looking for a native package on Debian, that can give me
> > > > the
> > > > external IP address of the machine.
> > > > 
> > > 
> > > Hi Andre.
> > > 
> > > Type "ifconfig" without the quotes. The record you are looking
> > > for is
> > > inet addr: for IPV4. Its about the second line from the top.
> > > 
> > 
> > ifconfig would only work if you are directly assigned the public,
> > external IP. If you are behind eg. a router that does NAT, you
> > would
> > only see the private IP internal to the local network.
> > 
> 
> Then:
> 
>     dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
> 
>     John
> 

Thank you, John.

This solution works.

I doubt google would be offline, but perhaps I will add this solution
as part of a script, with other servers as well.

Kind regards,
André.