Log in

Previous Entry | Next Entry

So I need to quickly figure out my public IP from cmdline to allow access to different box. I could look thru the logs on the machine I was accessing but I had only access to its web ui. I need the public IP of my test box and from terminal. Honestly, I couldn't figure it out, from open connections or traceroute I could only see the internal IP, not the public one on NAT. I found this quick hack curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

Do you know something nicer?


( 7 comments — Leave a comment )
Dec. 7th, 2012 01:31 pm (UTC)
I can haz IP
I like Major's icanhazip.com page, where you can skip "sed" command :) But be careful, webpages can run on behalf of the CIA, FBI and NSA: http://rackerhacker.com/2012/08/04/privacy-and-icanhazip-com/
Keiran Smith
Dec. 7th, 2012 01:31 pm (UTC)
You can use my simple script at affix.me


You can use that with curl and don't need to use your sed hack
Dec. 7th, 2012 02:48 pm (UTC)
curl tnx.nl/ip
Dec. 10th, 2012 09:46 am (UTC)
Thanks, this one wins :-)
Adrian Fita
Dec. 7th, 2012 04:40 pm (UTC)
curl http://ifconfig.me
Dec. 13th, 2012 07:14 pm (UTC)

Came here to say this!

Other neat tricks:

$ curl ifconfig.me/host
$ curl ifconfig.me/all
$ curl ifconfig.me/all.json


Dec. 7th, 2012 07:19 pm (UTC)
Slightly refined
curl -s checkip.dyndns.org|sed -e 's/.*: \(.*\)<\/b.*/\1/'
( 7 comments — Leave a comment )