Curl 純文本格式輸出:
curl icanhazip.comcurl ifconfig.mecurl curlmyip.comcurl ip.appspot.comcurl ipinfo.io/ipcurl ipecho.net/plaincurl www.trackip.net/i
curl JSON格式輸出:
curl ipinfo.io/jsoncurl ifconfig.me/all.jsoncurl www.trackip.net/ip?json
curl XML格式輸出:
curl ifconfig.me/all.xml
curl 得到所有IP細節 (挖掘機)
curl ifconfig.me/all
使用 DYDNS (當你使用 DYDNS 服務時有用)
curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: /([0-9/.]*/).*//1/g'curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]/+"
使用 Wget 代替 Curl
wget http://ipecho.net/plain -O - -q ; echowget http://observebox.com/ip -O - -q ; echo
使用 host 和 dig 命令
如果有的話,你也可以直接使用 host 和 dig 命令。
host -t a dartsclink.com | sed 's/.*has address //'dig +short myip.opendns.com @resolver1.opendns.com
bash 腳本示例:
#!/bin/bashPUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`echo $PUBLIC_IP
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。
新聞熱點
疑難解答