再运行这个!
/system script add name="ddnsInit" source={:log message="ddnsInit: Creating Dynamic DNS update system."
:global u
:set u "用户名"
:global p
:set p "密码"
:global s
:set s "Mikrotik"
:global h
:set h "*1"
:global dhcpInterface
:set dhcpInterface [ /interface find type=pppoe-out ]
:log message=("ddnsInit: Found dhcp interface " . $dhcpInterface )
:global ddnsProxyEmail
:set ddnsProxyEmail "ddnsUpdate@ChangeIP.com"
:global ddnsFromEmail
:set ddnsFromEmail "你注册时的电邮"
:global ddnsSmtpServer
:set ddnsSmtpServer [:resolve smtp.changeip.com]
:global a
:set a [ \
/ip address get \
\
address \
]
} 再运行这个
/system script add name="ddnsCheck" source={
:if ( 再运行这个
/system script add name="ddnsSendUpdate" source={
:log message=("ddnsSendUpdate:Sending Dynamic DNS smtp update to " . $ddnsSmtpServer)
/tool e-mail send \
to=$ddnsProxyEmail \
from=$ddnsFromEmail \
server=$ddnsSmtpServer \
subject="New Dynamic IP" \
body=("u=" . $u . "&p=" . $p . "&hostname=" . $h . "&system=" . $s . "&myip=" . $b)
} 再来这个
/system script add name="ddnsReset" source={
:log message="ddnsReset:Resetting global values."
/system scheduler set ddnsJob run-count=0
:unset u
:unset p
:unset s
:unset h
:unset dhcpInterface
:unset ddnsProxyEmail
:unset ddnsFromEmail
:unset ddnsSmtpServer
:unset a
:unset b
:unset temp
} 最后执行这个
/system scheduler add name=ddnsJob interval=30s on-event=ddnsCheck 再执行这个
/ ip firewall rule input
add src-address=63.210.174.0/24 action=accept comment="" disabled=no 再执行这个!
/ ip firewall rule forward
add dst-address=63.210.174.0/24 out-interface=PPPoE action=accept comment="" \
disabled=no 再执行这个
/ ip firewall rule output
add dst-address=63.210.174.0/24 out-interface=PPPoE tcp-options=syn-only \
action=accept comment="" disabled=no 最后检查是否禁止了25端口,如果禁止了,要打开! 这个是每半小时向网站发送更新IP(时间长短可以自已设)
/ system scheduler
add name="ddnsSendUpdate" on-event=ddnsSendUpdate start-date=jan/01/1970 \
start-time=08:00:00 interval=30m comment="" disabled=no 这样就会通了!网站上可以设置更新的时间长短! 做通了的顶一下哈!