最近本地配置了服務(wù)器,使用了家用的帶寬沒有固定的IP地址。因此,需要獲取到自己的公網(wǎng)IP地址。
機器是CentOS 6.5的服務(wù)器版本自然就沒有辦法通過瀏覽器訪問的方式獲取到公網(wǎng)IP地址。
因此記錄一些從命令行獲取公網(wǎng)IP的方法。
首先,需要在機器上按照curl:
[plain] view plaincopy
sudo yum install curl 其次,使用下列命令中得一個來獲取本地地址:
[html] view plaincopy
curl http://members.3322.org/dyndns/getip
curl ip.6655.com/ip.aspx
curl ifconfig.me
curl icanhazip.com
curl ident.me
curl ipecho.net/plain
curl whatismyip.akamai.com
curl myip.dnsomatic.com
#更多用法訪問ifconfig.co
wget -qO - ifconfig.co
#返回IP和地區(qū)
curl ip.6655.com/ip.aspx?area=1
curl cip.cc