刷新DNS

  1. killall -1 dnsmasq #重置DNS缓存 备选 killall -SIGHUP dnsmasq

刷新DDNS

  1. 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

  1. #-A参数解析:1是注册,2是更新
  2. ez-ipupdate -S "dyndns" -a $wanip -h $hostname -A 2 -s $nasserver -e $postexe -b $cachefile
  3. fi

fi

  1. #新增定时任务,5分钟执行一次
  2. /usr/sbin/cru a update_ddns_ip "*/5 * * * * /mnt/sda1/asusware.arm/update_ddns_ip"
  3. #将上面这行定时任务命令加到路由器启动 参考https://www.yuque.com/luanma-msytk/bc9cy2/mghcyc
  4. 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