Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Question:
If I check with google, I can see my public IP. Is there something on the Ubuntu command-line
which will yield me the same answer?
"having dynamic IP", "SSH using some other system across the internet", "the command which will display
the present PUBLIC IP". You see the chicken/egg problem here? How would you be able to run commands
on a remote server without knowing its address? You might be more interested in services like no-ip.com /
1 DynDNS.org. gertvdijk Jan 9 '13 at 13:11
one cannot SSH without knowing the public IP my friend... dynDNS costs a lot and no-ip tough works but
the situation don't allow that... anyway the question has been already answered.. thanks for your
suggestion Z9iT Jan 10 '13 at 8:46
To clarify: That was a hack, and a very ugly one at that, so I did an edit to make it simpler and something that people
can remember. jrg Jan 16 '12 at 16:17
19
This doesn't work anymore. whatsmyip.org is displaying the IP in an image (<img src='ipimg.php'/>). fiatjaf O
27 '13 at 6:17
2
Exacly as Giovanni P stated. The OP should change the accepted anwser.
For finding the external ip, you can either use external web-based services, or use system based
methods. The easier one is to use the external service, also the ifconfig based solutions will
work in your system only if you're not behind a NAT. the two methods has been discussed below
in detail.
ifconfig <interface_name> | grep "inet addr" | awk -F: '{print $2}' | awk
'{print $1}
n the above, replace <interface_name> with the name of your actual interface,
e.g: eth0, eth1, pp0, etc...
Example Usage:
saji@geek-lap:~$ ifconfig ppp0 | grep "inet addr" | awk -F: '{print $2}' | awk
'{print $1}'
111.222.333.444