Re: Get the external IP address from a Linux box
- Date: Thu, 24 May 2018 15:55:18 +0900
- From: likcoras <likcoras@xxxxxxxxxx>
- Subject: Re: Get the external IP address from a Linux box
On 05/24/2018 03:48 PM, John Conover wrote:
> =?ISO-8859-1?Q?Andr=E9?= Rodier 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.
I am not aware of any packages in the repos that has this kind of
functionality, but you could always just write a simple script around
the various sites that report your external ip.
It can be as simple as `curl ipinfo.io` (or your preferred site), you
could even try to have a script to try a few backups in case your
primary site happens to be unreachable.