您好,登錄后才能下訂單哦!
??routeros可以運行Oray,但是在Oray的官方腳本中,routeros是默認(rèn)作為上網(wǎng)路由器的。
??(Oray官方文檔:http://service.oray.com/question/869.html)
{
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當(dāng)作公網(wǎng)IP,也就是說routeros必須是上網(wǎng)路由器,該腳本才能生效。
??但是如果routeros是在局域網(wǎng)里面(例如routeros作為內(nèi)網(wǎng)服務(wù)器),外面還有一層路由器,那這個腳本就必須做修改,前提條件是routeros也能上網(wǎng)。
{
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上網(wǎng)獲取當(dāng)前的公網(wǎng)IP,并保存在mypublicip.txt中,然后登陸Oray,注冊IP。
??(參考:https://forum.mikrotik.com/viewtopic.php?t=73287)
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。