Views

Monday, January 9, 2012

Determining Public IP Address

Sometimes, it is just the simplest of things. An admin asked the other day what our Internet egress address was. I told him that he could use his browser to find out. However, he was dealing with a remote host, which had a different public address. A couple sites you can use to easily grab your public address from the command line are ifconfig.me and icanhazip.com.

  [bandarji ~]$ curl http://ifconfig.me/ ; curl http://icanhazip.com/
  200.99.99.200
  200.99.99.200
  [bandarji ~]$

These can also be used within bash quite easily.

  [bandarji ~]$ egress="`curl http://ifconfig.me/ 2> /dev/null`" ; echo $egress
  200.99.99.200
  [bandarji ~]$

No comments:

Post a Comment