找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 14341|回复: 7

[脚本] 悬赏+求助一个简单的脚本高手几句就能完成(有图好说明)在线等

[复制链接]
发表于 2013-4-15 21:40:03 | 显示全部楼层 |阅读模式
悬赏20铜板已解决
本帖最后由 yuye110 于 2013-4-16 10:57 编辑

234.jpg

pppoe-c 动态ip 地址付值到 to-add当中。为了那一点点的效率。或者用其他方法来实现外网ip付值到to-add当中。谢谢各位高手了。在线等

最佳答案

查看完整内容

:global ipadd :set ipadd [ /ip address get [/ip address find interface =pppoe-out1] address ] :for i from=( [:len $ipadd] - 1) to=0 do={ :if ( [: pick $ipadd $i] = "/") do={ :set ipadd [:pick $ipadd 0 $i] } } :if ([/ip address get [/ip address find interface=pppoe-out1] address]!=[/ip firewall nat get 0 to-address ]) do={/ip firewall nat set 0 to-address=[/ip address get [/ip addr ...
routeros
发表于 2013-4-15 21:40:04 | 显示全部楼层
:global ipadd

:set ipadd [ /ip address get [/ip address find  interface =pppoe-out1] address ]

:for i from=( [:len $ipadd] - 1) to=0 do={
         :if ( [: pick $ipadd $i] = "/") do={
                 :set ipadd [:pick $ipadd 0 $i]
                 
} }


:if ([/ip address get [/ip address find  interface=pppoe-out1] address]!=[/ip firewall nat get 0 to-address ]) do={/ip firewall nat set 0 to-address=[/ip address get [/ip address find  interface=pppoe-out1] address]}
routeros
回复

使用道具 举报

发表于 2013-4-15 22:19:15 | 显示全部楼层
论坛里有这种脚本的呀
routeros
回复

使用道具 举报

 楼主| 发表于 2013-4-15 22:50:43 | 显示全部楼层
没找到兄弟
routeros
回复

使用道具 举报

发表于 2013-4-16 04:10:39 | 显示全部楼层
你把悬赏提高到20. 我就立刻给你写一个。
routeros
回复

使用道具 举报

发表于 2013-4-16 10:05:41 | 显示全部楼层

你把悬赏提高到20. 我就立刻给你写一个。
routeros
回复

使用道具 举报

发表于 2013-4-16 11:50:45 | 显示全部楼层
:global curaddress
:global ip
:set ip [/ip address get [/ip address find dynamic=yes interface="pppoe-out1"] address ]
:set ip [:pick $ip 0 [:find $ip "/"]]
:set curaddress [/ip firewall nat get [/ip firewall nat find comment="ADSL1"] to-addresses ]
:if ($curaddress!=$ip) do={
ip firewall nat set [/ip firewall nat find comment="ADSL1"] to-addresses=$ip
}
routeros
回复

使用道具 举报

 楼主| 发表于 2013-4-16 13:08:15 | 显示全部楼层

谢谢,你的代码非常简洁,非常感谢你给我提供代码。comment需要更改的不是很方便。hebin319代码不需要更改comment备注但是代码我看是官网的代码修改而成,稳妥了一些。所以采用他的办法,我会在论坛转给你10金币,作为感谢,希望能成为朋友,我的qq6194687
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-21 00:57 , Processed in 0.060672 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表