找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3810|回复: 0

[策略设置] 求助,关于PPTP自动修改路由表IP的问题

[复制链接]
发表于 2008-7-7 15:45:23 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
看过wwjun和zooyo老大的教程.
发觉ADSL分流自动改路由表的脚本,可以修改成用来做pptp-out连接自动修改路由表的作用.
一下是原脚本:
:local assign-address
:local new-address
:local status
:local x
:set x 3  --- 有几条ADSL 就填几...这里是3
:for i from=1 to=$x do={     ---- 执行从1 到 3 pppoe-out 的连接
    :set status [/interface get [/interface find  name=("pppoe-out" . $i)] running]
    :if ($status=true) do={
     :set new-address [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
     :set new-address [:pick $new-address 0 ([:len $new-address] -3)]
     :set assign-address [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
     :set assign-address [:pick $assign-address 0 ([:len $assign-address] -3)]
        :if ($assign-address != $new-address) do={
        /ip address set [/ip address find comment=$i] address=$new-address network=$new-address broadcast=$new-address
        /ip route set [/ip route find comment=$i] gateway=$new-address
       }
   }
}


现在可以改成:
:local assign-address
:local new-address
:local status
:local x
:set x 3
:for i from=1 to=$x do={
    :set status [/interface get [/interface find  name=("pptp-out" . $i)] running]
    :if ($status=true) do={
     :set new-address [/ip address get [/ip address find dynamic=yes interface=("pptp-out" . $i)] address]
     :set new-address [:pick $new-address 0 ([:len $new-address] -3)]
     :set assign-address [/ip address get [/ip address find dynamic=no interface=("pptp-out" . $i)] address]
     :set assign-address [:pick $assign-address 0 ([:len $assign-address] -3)]
        :if ($assign-address != $new-address) do={ \
        /ip address set [/ip address find comment=$i] address=$new-address network=$new-address broadcast=$new-address
        /ip route set [/ip route find comment=$i] gateway=$new-address
       }
   }
}
}
请问各位有什么办法可以将comment的注释改成VPN1 VPN2???  ....不胜感激!
20080109_a7120b8f0d721a06e9e3WSuPQFbi3cv0.jpg
20080109_a7120b8f0d721a06e9e3WSuPQFbi3cv0.jpg
routeros
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-5 20:29 , Processed in 0.046298 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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