Posts Tagged ddns

routeros ddns更新失败的问题

Posted by on 星期三, 27 七月, 2011

上一次帮一个网友解决了ros DDNS更新失败的问题,解决办法其实很简单,他的DNS没填。

ros对比ip动态域名更新

Posted by on 星期四, 6 一月, 2011

Routeros中通过对比本地外网IP和域名解析IP来更新动态域名

  本脚本用ros中的计划任务功能,每10秒钟解析一次指定域名的IP地址,再对比本地要更新域名的接口,如果发生改变,则更新域名。

  雕虫小技 ,有需要的拿去。

 

 

 

  脚本和注解:

:if ( [/interface get [/interface pppoe-client find name=WAN] running ]=true ) do={ #如果在interface中存在已经连接上的pppoe接口,则执行下列语句。本列中pppoe接口名为WAN
  :global ipResolved ([:resolve home.awolf.net] . "/32") #解析home.awolf.net,存入全局变量ipResolved。
  :global ipLocal [ /ip address get [ /ip address find interface=WAN ] address ] #获得本地IP,即pppoe接口的IP,本例中为WAN接口IP
  :if ($ipLocal != $ipResolved) do={ #如果解析的IP和本地接口IP不一致,则执行下列语句
    :log info "WAN IP has been changed!" #记录日志:“WAN IP has been changed!”
    :log info ("Resolved IP : " . $ipResolved) #记录日志:“Resolved IP:解析的IP地址”
    :log info ("Local IP : " . $ipLocal) #记录日志:“Local IP:本地IP”
    /tool dns-update zone="awolf.net" name="home" key=密码 key-name=用户名 address=[:pick $ipLocal 0 ([:len $ipLocal] - 3)]
#更新域名
    :log info "All Done!" #记录日志“All Done!”
  }
} else={ #如果interface中没有已经连接的pppoe接口
  :log warning "Interface WAN is down!" #日志中提示“Interface WAN is down!”
}

>>完整脚本下载<<(点击查看,右键另存为下载)

  将上面完整脚本下载,在ros中执行,然后用Winbox到System->Scheduler中,双击ddns-update把其中的帐号密码和域名等信息改成你自己的,无特殊情况的情况下应该可以正常更新了。

  ros 3.30测试通过。

  有问题欢迎联系我。

ros脚本记录1

Posted by on 星期三, 19 五月, 2010

  自已用的ros脚本,记录一下。

:global username username

:global password password

:global domainname "wolf"

:global domainzone "dnsrd.com"

:if ([/interface find type=pppoe-out running=yes]="") do={

:beep frequency=500 length=2s

:delay 4

:beep frequency=500 length=2s

:log warning "DDNS: No PPPoE is running."

} else={

:global intLocal [ /interface get [ /interface find type=pppoe-out running=yes ] name ]
:global ipResolve ([:resolve ($domainname . "." . $domainzone)] . "/32")
:global ipLocal [ /ip address get [ /ip address find interface=$intLocal ] address ]

:if ($ipLocal != $ipResolve) do={

:log info ("DDNS: Resolved IP address : " . $ipResolve )

:log info ("DDNS: Local IP address : " . $ipLocal )

:log info ("DDNS: Sending Dynamic DNS update to server")

/tool dns-update zone=$domainzone name=$domainname key=$password key-name=$username address=[:pick $ipLocal 0 ([:len $ipLocal] - 3)]

/tool dns-update zone="changeip.com" name="wolf" key=****** key-name="******" address=[:pick $ipLocal 0 ([:len $ipLocal] - 3)]

/tool dns-update zone="changeip.com" name="wolf" key=****** key-name="******" address=[:pick $ipLocal 0 ([:len $ipLocal] - 3)]

/ip upnp set enabled=no
:foreach i in=[/ip upnp interfaces find disabled=no ] do={/ip upnp interfaces remove $i}
/ip upnp interfaces add interface=[/interface get [/interface pppoe-client find running=yes ] name] type=external

/ip upnp interfaces add interface=LAN type=internal

/ip upnp set enabled=yes

/ip upnp set allow-disable-external-interface=no

/ip upnp set show-dummy-rule=yes

/ip firewall mangle set [find comment="flowback"] dst-address=[/ip address get [find interface=WAN ] address ]

/interface 6to4 set sit1 local-address=[:pick $ipLocal 0 ([:len $ipLocal] - 3)]

:beep frequency=500

:log info "All Done!"

}

}

vyatta更新zoneedit动态域名

Posted by on 星期一, 10 五月, 2010

直接上代码:


vyatta@vyatta# show service dns
 dynamic {
     interface pppoe0 {
         service zoneedit {
             host-name vyatta.awolf.net
             login yourusername
             password userpassword
         }
     }
 }
 forwarding {
     cache-size 150
     listen-on eth2
     name-server 8.8.8.8
     name-server 8.8.4.4
     name-server 4.2.2.1
     name-server 4.2.2.2
     name-server 208.67.220.220
     name-server 208.67.222.222
     name-server 202.96.69.38
     name-server 202.96.64.68
 }
[edit]
vyatta@vyatta#

其中eth2是内网接口。