默认分类

使用freedns.afraid.org自动更新公网ip地址

路由器:小米openwrt 域名skywikia1.us.to

自动更新

vi /root/ddns.sh
chmod +x ddns.sh

while true 
do
wget "http://freedns.afraid.org/dynamic/update.php?OGVSM1A3bUdwdGZHZVdUajNGcDBlZHlSOjE4NzAwNzI0" -O - >>/var/ddns.log
sleep 30
done

添加开机自动启动

vi /etc/init.d/freedns

#!/bin/sh /etc/rc.common
START=99
start(){
    /root/ddns.sh &
}

chmod +x freedns
./freedns enable
./freedns start

防火墙允许动态更新的ip

iptables -t nat -I PREROUTING -s skywikia.us.to -j ACCEPT   ##插入一条优先级为1的规则
while true 
do
sleep 30
iptables -t nat -R  PREROUTING 1 -s skywikia.us.to -j ACCEPT  ##  -R选项替换PREROUTING链为1的规则
done

回复

This is just a placeholder img.