I'm looking for a way to get my IP address using the command prompt in Linux. I know when you type "ifconfig" you can get your local IP address (i.e. 192.168.0.103), but I'm looking for my IP address that I get from my ISP. How can I get this from Linux without having to visit some website?
|
feedback
|
|
If your machine is assigned a local IP address, it may not know your public-facing address. You can query a server not on your local network to discover your public-facing address.
| |||||
feedback
|
|
You can use one of the several services that tell you your own address: dig +short myip.opendns.com @resolver1.opendns.com curl corz.org/ip curl ip.uostas.net (I still haven't found one that supports IPv6.) | |||
feedback
|
|
If your computer is on e.g. a corporate LAN with an address-translating firewall there is unfortunately no information on your computer about the externally visible address. For all your computer knows it has a local IP (e.g. 192.168.0.103) that can be used to connect to any host on the Internet. The address-translating firewall is completely transparent from your computer's point of view. The only way is to use an external "observer" such as whatismyip.org to help. If you don't like having to access it through a full web browser curl is an alterantive as pointed out by Samuel K | |||
|
feedback
|