Re: Get the external IP address from a Linux box
- Date: Thu, 24 May 2018 11:04:51 -0000 (UTC)
- From: Dan Purgert <dan@xxxxxxxx>
- Subject: Re: Get the external IP address from a Linux box
Abdullah Ramazanoğlu wrote:
> On Thu, 24 May 2018 07:22:56 +0100 André Rodier said:
>> 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.
> Unless you have a dedicated IP address, then even if you directly
> connect to your ISP (no routers, no NAT) you will likely get a local
> pool address and from there routed to the internet by your ISP. In
> that case your link will have 2 *local* addresses (e.g. 192.168.. or
> 10...) : one for your side, one for ISP side. You first enter ISP's
> local IP pool, and from there exit to the internet over a real address
> from ISP's address block.
Ew, CGNAT. :(
If you have a particularly poor ISP, they may even NAT you somewhere
insane outside of RFC1918 (10.0.0.0 - 10.255.255.255 / 172.16.0.0 -
172.31.255.255 / 192.168.0.0 - 192.168.255.255) or RFC6598 (100.64.0.0 -
I've seen some of these jokers use space in some of the "old /8" space -
stuff owned by the likes of the US DOD, AT&T, HP, etc. who got in back
in the early days. So even if it looks like you have a "public" IP
address on your router, it's always a good idea to verify from the
|_|O|_| Registered Linux user #585947
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281