Open boomzikazita opened 3 years ago
我用的这个可行,你试一下,
arIpAddress () {
curltest=which curl
if [ -z "$curltest" ] || [ ! -s "which curl
" ] ; then
wget -T 5 -t 3 --no-check-certificate --quiet --output-document=- "http://members.3322.org/dyndns/getip" | grep -E -o '([0-9]+\.){3}[0-9]+' | head -n1 | cut -d' ' -f1
#wget -T 5 -t 3 --no-check-certificate --quiet --output-document=- "ip.3322.net" | grep -E -o '([0-9]+\.){3}[0-9]+' | head -n1 | cut -d' ' -f1
#wget -T 5 -t 3 --no-check-certificate --quiet --output-document=- "http://pv.sohu.com/cityjson?ie=utf-8" | grep -E -o '([0-9]+\.){3}[0-9]+' | head -n1 | cut -d' ' -f1
else
curl -L -k -s "http://members.3322.org/dyndns/getip" | grep -E -o '([0-9]+\.){3}[0-9]+' | head -n1 | cut -d' ' -f1
#curl -L -k -s ip.3322.net | grep -E -o '([0-9]+\.){3}[0-9]+' | head -n1 | cut -d' ' -f1
#curl -L -k -s http://pv.sohu.com/cityjson?ie=utf-8 | grep -E -o '([0-9]+\.){3}[0-9]+' | head -n1 | cut -d' ' -f1
fi } arIpAddress6 () {
ifconfig $(nvram get br0_ifname_t) | awk '/Global/{print $3}' | awk -F/ '{print $1}' } if [ "$IPv6" = "1" ] ; then arIpAddress=$(arIpAddress6) else arIpAddress=$(arIpAddress) fi
我已经在阿里云上解析了我的ipv6地址,但是路由器报错: 【AliDDNS动态域名】: 错误! 获取目前 IPv6 失败,请在脚本更换其他获取地址,保证取得IPv6地址(例如:ff03:0:0:0:0:0:0:c1)