|
发表于 2013-9-30 10:58:51
|
显示全部楼层
:local nyr [/system clock get date]
:local yy ([:find jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:pick $nyr 0 3]]+1)
:if ($yy<10) do={:set yy (0 . $yy)}
:set nyr ([:pick $nyr 7 11] . $yy . [:pick $nyr 4 6])
:local curip
:local newip
:local status
:local x1
#设定线路,默认2线
:set x1 3
:for i from=1 to=$x1 do={
:set status [/interface get [/interface find name=("pppoe-out" . $i)] running]
:if ($status=true) do={
:set newip [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address ]
:set newip [:pick $newip 0 [:find $newip "/"]]
:set curip [ /ip firewall nat get [/ip firewall nat find comment=("NAT-" . $i)] to-addresses ]
:if ($curip != $newip) do={
/ip firewall nat set [ /ip firewall nat find comment=("NAT-" . $i) ] to-addresses=$newip
:log error ("保存新IP成功")
}
}
} |
|