1. dig # dig +short myip.opendns.com @resolver1.opendns.com
XXX.XXX.208.36
# dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
"XXX.XXX.208.36"
+[no]short (Display nothing except short form of answer)
# host myip.opendns.com resolver1.opendns.com
Using domain server:
Name: resolver1.opendns.com
Address: 208.67.222.222#53
Aliases:
myip.opendns.com has address XXX.XXX.208.36
Host myip.opendns.com not found: 3(NXDOMAIN)
Host myip.opendns.com not found: 3(NXDOMAIN)
2. curl
# curl ipecho.net/plain; echo
XXX.XXX.208.36
# curl icanhazip.com
XXX.XXX.208.36
# curl ifconfig.co
XXX.XXX.208.36
3 wget
# wget -qO- http://ipecho.net/plain ; echo
XXX.XXX.208.36
¡Ø-O, --output-document=FILE write documents to FILE.
-q : --quite Turn off Wget's output.
4. lynx
# lynx -dump checkip.dyndns.org
Current IP Address: XXX.XXX.208.36
5 Bash script
À§¿¡¼ ¾ð±ÞÇß´ø ³×°¡Áö ¹æ¹ýÀ» bash ½ºÅ©¸³Æ®ÈÇؼ.....
# cat find_publicip.sh
MY_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
echo "My OpenStack / Public IP address: ${MY_IP}"
# sh find_publicip.sh
My OpenStack / Public IP address: XXX.XXX.208.36
6. ¸ÞŸµ¥ÀÌŸ Á¤º¸ ÀÌ¿ë
# curl http://169.254.169.254/latest/meta-data
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-action
instance-id
instance-type
local-hostname
local-ipv4
placement/
public-hostname
public-ipv4
reservation-id
# curl http://169.254.169.254/latest/meta-data/public-ipv4; echo
XXX.XXX.208.36