找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4158|回复: 1

[脚本] [已解决]如何得到 inteface里 pppoe-out的条数,及name。

[复制链接]
发表于 2011-10-31 23:54:02 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 ww111222 于 2011-11-1 00:40 编辑

我的 ros 里 的全部接口:
  1. [ww111222@ROS3.30_CQ] /interface> print
  2. Flags: D - dynamic, X - disabled, R - running, S - slave
  3. #     NAME                           TYPE             MTU   L2MTU
  4. 0  R  LAN                            ether            1500
  5. 1  R  ;;; -10M
  6.        WAN-DXGQ-ADSL-10M              ether            1500
  7. 2  R  ;;; ADSL-4M
  8.        WAN-LT-ADSL-4M                 ether            1500
  9. 3  R  pppoe-10M                      pppoe-out        1480
  10. 4  R  pppoe-4M                       pppoe-out        1480
  11. 5  R  adsl-1-vrrp101                 vrrp             1500
  12. 6  R  adsl-1-vrrp102                 vrrp             1500
  13. 7  R  adsl-1-vrrp103                 vrrp             1500
  14. 8  R  adsl-1-vrrp104                 vrrp             1500
  15. 9  R  adsl-1-vrrp105                 vrrp             1500
  16. 10  R  adsl-2-vrrp201                 vrrp             1500
  17. 11  R  adsl-2-vrrp202                 vrrp             1500
  18. 12  R  adsl-1-pppoe-out101            pppoe-out        1480
  19. 13  R  adsl-1-pppoe-out102            pppoe-out        1480
  20. 14  R  adsl-1-pppoe-out103            pppoe-out        1480
  21. 15  R  adsl-1-pppoe-out104            pppoe-out        1480
  22. 16  R  adsl-1-pppoe-out105            pppoe-out        1480
  23. 17  R  adsl-2-pppoe-out201            pppoe-out        1480
  24. 18  R  adsl-2-pppoe-out202            pppoe-out        1480
  25. [ww111222@ROS3.30_CQ] /interface>
复制代码
我分析了 一下,

   所有 正常的 ADSL 线路,  条件是:  type=pppoe-out mtu=1480 running

我用 print where   type=pppoe-out mtu=1480 running
得出的 列表 与 我在 ROS 里看到的 是一样的, 说明,条件 是正确的。
  1. [ww111222@ROS3.30_CQ] /interface> print where type=pppoe-out running mtu=1480
  2. Flags: D - dynamic, X - disabled, R - running, S - slave
  3. #     NAME                                                          TYPE             MTU   L2MTU
  4. 3  R  pppoe-10M                                                     pppoe-out        1480
  5. 4  R  pppoe-4M                                                      pppoe-out        1480
  6. 12  R  adsl-1-pppoe-out101                                           pppoe-out        1480
  7. 13  R  adsl-1-pppoe-out102                                           pppoe-out        1480
  8. 14  R  adsl-1-pppoe-out103                                           pppoe-out        1480
  9. 15  R  adsl-1-pppoe-out104                                           pppoe-out        1480
  10. 16  R  adsl-1-pppoe-out105                                           pppoe-out        1480
  11. 17  R  adsl-2-pppoe-out201                                           pppoe-out        1480
  12. 18  R  adsl-2-pppoe-out202                                           pppoe-out        1480
  13. [ww111222@ROS3.30_CQ] /interface>





复制代码
我现在 的 问题是,

1、 我想得到    有几条  pppoe-out  正常运行 线路,比如说 上面 的 是 9条

2、 每条线路的 ID 号,比如说,上面 的是  3,4,12,13,14,15,16,17,18




      求高人指点。







我用 :put [/interface find type="pppoe-out"]                     

得到 一些东西, 数量 和 实际的一致。
  1. [ww111222@ROS3.30_CQ] > :put [/interface find type="pppoe-out"]                     
  2. *4;*5;*d;*e;*f;*10;*11;*12;*13
复制代码
现在知道  *4;*5;*d;*e;*f;*10;*11;*12;*13    是16进制数,





搞定了:
  1. :foreach i in=[/interface find type=pppoe-out running mtu=1480] do={:put [/interface get $i name]}
复制代码
routeros
发表于 2011-11-7 02:22:21 | 显示全部楼层
好东东..谢谢楼主了!
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-9 08:08 , Processed in 0.065955 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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