自动更新IP地址
:local rosname
#路由编号
:local ethname
#网卡名称
:local ethip [/ip address get [/ip address find interface=("ether1")] address ]
:set ethip [:pick $ethip 0 [:find $ethip "/"]]
#网卡IP地址
:local beizu
#备注
:local host1 http://www.nanyuetong.com/
:local host2
#以下是设置传值
set rosname ROU668
set ethname vpn
set beizu 0668
:local host ($host1."vpnip-rosname-".$rosname."-ethname-".$ethname."-ethip-".$ethip."-beizu-".$beizu.".html")
/tool fetch url=("$host")
:delay 5s
#等待5秒
set host2 [:pick $host 26 [:find $host 0]]
#:log error ($host2)
#清除文件
file remove $host2
自动更新10-11网关
:local zconfIP
:local zcurIP
:local znewIP
:local znum1
:local znum2
:local znum3
:local znum4
:local ztmpstr1
:local ztmpstr2
:local ztmpstr3
:local ztmpstr4
:local zconfIP [/ip address get [/ip address find interface=("ether1")] network]
:set znum1 [:find $zconfIP "."]
:set ztmpstr1 [:pick $zconfIP 0 $znum1]
:set znum2 [:find $zconfIP "." $znum1]
:set ztmpstr2 [:pick $zconfIP ($znum1+1) $znum2]
:set znum3 [:find $zconfIP "." $znum2]
:set ztmpstr3 [:pick $zconfIP ($znum2+1) $znum3]
:set ztmpstr4 [:pick $zconfIP ($znum3+1) [:len $zconfIP]]
:set znewIP ($ztmpstr1 . "." . $ztmpstr2 . "." . $ztmpstr3 . "." . 1)
/ip route set [/ip route find comment=("eth2-10")] gateway=$znewIP
【收藏本页】 【返回顶部】 【关闭窗口】