routeros能夠運行Oray,可是在Oray的官方腳本中,routeros是默認做爲上網路由器的。
(Oray官方文檔:http://service.oray.com/question/869.html)php
{ local ipaddr local server "http://ddns.oray.com" local domain "域名" local par "/ph/update\?&hostname=$domain&myip=$ipaddr" local users "用戶名" local paswd "密碼" :set ipaddr [/ip address get [/ip address find interface=pppoe-out1] address] :set ipaddr [:pick $ipaddr 0 ([len $ipaddr] -3)] /tool fetch url=($server . $par) mode=http user=$users password=$paswd }
從第8行代碼能夠看出,該腳本是將pppoe-out1接口的IP看成公網IP,也就是說routeros必須是上網路由器,該腳本才能生效。 html
可是若是routeros是在局域網裏面(例如routeros做爲內網服務器),外面還有一層路由器,那這個腳本就必須作修改,前提條件是routeros也能上網。服務器
{ local ipaddr; /tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt local ip [file get mypublicip.txt contents ] put $ip :set ipaddr "$ip"; local server "http://ddns.oray.com"; local domain "域名"; local par "/ph/update\?&hostname=$domain&myip=$ipaddr"; local users "用戶名"; local paswd "密碼"; /tool fetch url=($server . $par) mode=http user=$users password=$paswd; }
前面的5行代碼就是讓routeros上網獲取當前的公網IP,並保存在mypublicip.txt中,而後登錄Oray,註冊IP。
(參考:https://forum.mikrotik.com/viewtopic.php?t=73287)dom