小钢炮IPV6 DDNS

IPV6会给每个联网设备独立分配个公网IP,我多拨之后小钢炮有6个IP 可以通过如下脚本实现DDNS,将其保存为.sh文件并定时执行就行了。

#!/bin/sh
curl -k -X POST https://dnsapi.cn/Record.Modify -d "login_token=845345,e3a7e5badadfsadafsfafdsaf617ad4&format=json&domain_id=41354434&record_id=48435121&sub_domain=n1&value=$(ip addr show eth0 | grep "inet6.*global dynamic" | awk '{print $2}' | awk -F"/" '{print $1}' |sed -n 1p)&record_type=AAAA&record_line=%e9%bb%98%e8%ae%a4"
return $?

新3 IPV4 DDNS

#!/bin/sh
curl -k -X POST https://dnsapi.cn/Record.Modify -d "login_token=22222,e3a7fdhgfdgfhdhfhdggfhg7ad4&format=json&domain_id=2222222&record_id=2222222&sub_domain=@&value=$1&record_type=A&record_line=%e9%bb%98%e8%ae%a4"
curl -k -X POST https://dnsapi.cn/Record.Modify -d "login_token=455454,e3aassfasdfasfasfsdfdsdfd4&format=json&domain_id=456443242354&record_id=4534534&sub_domain=n2&value=$1&record_type=A&record_line=%e9%bb%98%e8%ae%a4"

return $?

新3 花生壳DDNS脚本

wget -O ddns.log http://id:password@ddns.oray.com/ph/update?hostname=jysky007.gicp.net
date +"%Y-%m-%d %H:%M:%S" >>/a.log;cat /root/ddns.sh >>/a.log;rm ddns.log

新3 openwrt 获取ipv6前缀脚本

ip addr show br-lan | grep "inet6.*global dynamic" | awk '{print $2}' | awk -F"/" '{print $1}' |sed -n 1p |sed 's/::1/::15/g'