Netsky's Blog

  • *NIX相关
  • 心情随笔
  • 无线安全
  • 软件交流
  • 未分类
  1. 首页
  2. 未分类
  3. 正文

Ros动态自动更新A记录

2010年7月15日 1949点热度 0人点赞 0条评论

 

 

/ system script 

add name="ddnsInit" source="
:log info "ddnsInit: Creating Dynamic DNS
    update system."
:global u "你的账号"
:global p "你的密码"
:global n
    "你的账号"
:global z "25u.com"
:global dialInterface [/interface
    pppoe-client get pppoe-out name]
:log info ("find dial interface: " .
    $dialInterface)
:global ac [/ip address get [/ip address find
    interface=$dialInterface] address]
:global a [:pick $ac 0 [:find
    $ac "/"]]
" policy=ftp,reboot,read,write,policy,test,winbox,password 

add name="ddnsSendUpdate" source="
:log info ("ddnsSendUpdate: External IP
    Address is " . $a)
/tool dns-update name=$n zone=$z address=$a

/ip fir nat set[/ip firewall nat find
    comment="ADSL"] dst-address=$a"
    policy=ftp,reboot,read,write,policy,test,winbox,password 

add name="ddnsCheck" source="
:if ([/system scheduler get ddnsJob
    run-count]<=1) do={
/system script run ddnsInit
/system script run
    ddnsSendUpdate
/system scheduler enable ddnsRetry
}
:global temp
    $ac
:global b [/ip address get [/ip address find
    interface=$dialInterface] address]
:if ($temp != $b) do={
:global
    ac $b
:global a [:pick $ac 0 [:find $ac "/"]]
:log info
    ("ddnsCheck: Found new IP address: " . $a)
/system script run
    ddnsSendUpdate
}
"
    policy=ftp,reboot,read,write,policy,test,winbox,password 

add name="ddnsReset" source="
/system scheduler remove ddnsJob
/system
    scheduler add name=ddnsJob interval=30s on-event=ddnsCheck
:global
    u
:global p
:global n
:global z
:global dhcpInterface
:global
    a
:global ac
:global b
:global temp
"
    policy=ftp,reboot,read,write,policy,test,winbox,password 

add name="ddnsApp" source="
:if (([:resolve ($n . "." . $z)]) !=
    $a) do={
/system script run ddnsSendUpdate
}
"
    policy=ftp,reboot,read,write,policy,test,winbox,password 

add name="adslnat" source=":global ddns-interface [ /interface find

:global ddns-ip [ /ip address get [/ip address find

/ip firewall nat set[/ip e] address ] 

    firewall nat find comment="ADSL"] dst-address=$ddns-ip"
    policy=ftp,reboot,read,write,policy,test,winbox,password 

add name="DDNS2" source=":log info "ddnsInit: Creating Dynamic DNS update

:global n "密码"

:global dialInterface [/interface

:log info ("find dial interface: "

:global ac [/ip address get [/ip address find

:global a [:pick $ac 0 [:find ess]

" $ac "/"]]
    policy=ftp,reboot,read,write,policy,test,winbox,password 

add name="arp" source=":foreach i in [/ip arp find dynamic yes ] do={/ip arp
    add copy-from $i}"
    policy=ftp,reboot,read,write,policy,test,winbox,password 

/ system scheduler 

add name="ddnsRetry" on-event=ddnsApp start-date=apr/03/2007
    start-time=23:28:22 interval=1h comment="" disabled=yes 

add name="ddnsJob" on-event=ddnsCheck start-date=nov/13/2008
    start-time=22:05:24 interval=30s comment="" disabled=yes 


标签: 暂无
最后更新:2010年7月15日

Netsky

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

Netsky

这个人很懒,什么都没留下

实用工具
人民币大写电脑版 人民币大写手机版 DNSpod API获取PHP版 DNSpod API获取HTML版 Dnspod 动态解析
目录
  • *NIX相关
  • 心情随笔
  • 无线安全
  • 未分类
  • 群晖
  • 虚拟化
  • 软件交流

COPYRIGHT © 2022 Netsky's Blog. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang