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. It can be visualized as a local cloud of ISP. One side of the cloud faces customers (local reserved IP range), the other side faces the internet (real IP address pool). E.g. I am connected through 3G modem and my IP and my address starts with 10.x.x.x - an A class reserved block address. The only reliable way (AFAIK) is going through some sort of "loop-back" mechanism to see your external address. External sites are one way of achieving this. John Conover's (dig) and likcoras' (script) solutions look promising in that regard. Regards -- Abdullah Ramazanoğlu