找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1689|回复: 6

[其它] 命令下用变量无法同时修改两个网关IP?

[复制链接]
发表于 2007-5-12 09:42:09 | 显示全部楼层 |阅读模式

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

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

×
/ ip route
add dst-address=0.0.0.0/32 gateway=192.168.0.0,1.0.0.1 distance=0 scope=255 \
    target-scope=10 comment="default-route" disabled=no

上面网关有两个IP,,,这里有两个做两变量
:set ip1 1.1.1.1
:set ip2 2.2.2.2

用上面 的变量修改网关
/ip route set [/ip route find comment=default-route] gateway=$ip1,$ip2
提示参数不对,肯定是gateway=$ip1,$ip2不对,,那位朋友知道原因的帮我改一下,谢谢!
routeros
发表于 2007-5-12 10:18:22 | 显示全部楼层
/ip route set [/ip route find comment=default-route] gateway=($ip1 . "," . $ip2)

试试
routeros
回复

使用道具 举报

 楼主| 发表于 2007-5-12 10:22:04 | 显示全部楼层
routeros
回复

使用道具 举报

 楼主| 发表于 2007-5-12 10:23:24 | 显示全部楼层
/ip route set [/ip route find comment=default-route] gateway=($ip1 "," $ip2)
/ip route set [/ip route find comment=default-route] gateway=($ip1 . ","  $ip2)

都不行的,,,
routeros
回复

使用道具 举报

发表于 2007-5-12 11:32:50 | 显示全部楼层
因为我现在没在环境试,复制我那个不可以吗?

你上面的发的两条没一条格式对的
routeros
回复

使用道具 举报

 楼主| 发表于 2007-5-12 13:25:58 | 显示全部楼层
你的格式就多了4 个空格,,对不。。!。。还是不行的。。
routeros
回复

使用道具 举报

发表于 2007-5-12 13:29:33 | 显示全部楼层
/ip route set [/ip route find comment=default-route] gateway=($ip1 . "," . "$ip2") //注意2个点
绝对可以
或者,清晰明了
:set gwa 61.0.0.1
:set gwb 61.0.0.2
:set gw (gwa . "," . gwb)
/ip route set [/ip route find comment=default-route] gateway=$gw
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-8 03:55 , Processed in 0.052767 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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