Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果通过阿里DDNS访问ipv6 #529

Open
boomzikazita opened this issue Apr 16, 2021 · 1 comment
Open

如果通过阿里DDNS访问ipv6 #529

boomzikazita opened this issue Apr 16, 2021 · 1 comment

Comments

@boomzikazita
Copy link

我已经在阿里云上解析了我的ipv6地址,但是路由器报错:
【AliDDNS动态域名】: 错误! 获取目前 IPv6 失败,请在脚本更换其他获取地址,保证取得IPv6地址(例如:ff03:0:0:0:0:0:0:c1)

@alepc-cn
Copy link

我用的这个可行,你试一下,

自行测试哪个代码能获取正确的IP,删除前面的#可生效

arIpAddress () {

IPv4地址获取

获得外网地址

curltest=which curl
if [ -z "$curltest" ] || [ ! -s "which curl" ] ; then
#wget -T 5 -t 3 --no-check-certificate --quiet --output-document=- "https://www.ipip.net" | grep "IP地址" | 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://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 "https://www.ipip.net" | grep "IP地址" | grep -E -o '([0-9]+.){3}[0-9]+' | head -n1 | cut -d' ' -f1
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 () {

IPv6地址获取

因为一般ipv6没有nat ipv6的获得可以本机获得

ifconfig $(nvram get br0_ifname_t) | awk '/Global/{print $3}' | awk -F/ '{print $1}'
}
if [ "$IPv6" = "1" ] ; then
arIpAddress=$(arIpAddress6)
else
arIpAddress=$(arIpAddress)
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants