刷新DNS
killall -1 dnsmasq #重置DNS缓存 备选 killall -SIGHUP dnsmasq
刷新DDNS
vim /tmp/mnt/sda1/asusware.arm/update_ddns_ip
erver=nvram get ddns_server_x
hostname=nvram get ddns_hostname_x
wanip=nvram get wan0_ipaddr
wanoldip=nvram get wan0_realip_ip
nasserver=”nwsrv-ns1.asus.com”
postexe=”/sbin/ddns_updated”
cachefile=”/tmp/ddns.cache”
get real ip
getrealip.sh >& /dev/null
wanip=nvram get wan0_realip_ip
if [ “$1” != “” ] || [ “$wanoldip” != “$wanip” ] then if [ “$server” == “WWW.ASUS.COM” ] then
#-A参数解析:1是注册,2是更新
ez-ipupdate -S "dyndns" -a $wanip -h $hostname -A 2 -s $nasserver -e $postexe -b $cachefile
fi
fi
#新增定时任务,5分钟执行一次
/usr/sbin/cru a update_ddns_ip "*/5 * * * * /mnt/sda1/asusware.arm/update_ddns_ip"
#将上面这行定时任务命令加到路由器启动 参考https://www.yuque.com/luanma-msytk/bc9cy2/mghcyc
vi /mnt/sda1/asusware.arm/.asusrouter
参考链接:
https://koolshare.cn/thread-132318-1-1.html
源码链接:https://github.com/RMerl/asuswrt-merlin/tree/master/release/src/router/ez-ipupdate
https://github.com/RMerl/asuswrt-merlin/wiki/DDNS-Sample-Scripts
https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS