Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2194941
  • 博文数量: 433
  • 博客积分: 4775
  • 博客等级: 上校
  • 技术积分: 8054
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-19 16:15
文章存档

2014年(9)

2013年(20)

2012年(77)

2011年(323)

2009年(4)

分类: 系统运维

2011-10-20 00:19:37

你可以使用“interface range”全局配置命令来用相同的配置参数一次性配置多个接口。在你进入接口范围配置模式(Interface-range Configuration Mode)时,你所键入的所有参数将同样应用到范围中的所有接口。具体的接口范围配置步骤如表4-2所示(从特权模式开始)。

表4-2  接口范围配置步骤

 

命令

说明

Step 1 

Switch#configure terminal

Step 2 

Catalyst 3750及以前系列:Switch(config)#interface range {port-range | macro macro_name}

 Catalyst 4500/4900系列:Switch(config)#interface range

{vlan vlan_ID - vlan_ID} | {{fastethernet | gigabitethernet | tengigabitethernet | macro macro_name} slot/interface - interface} [, {vlan vlan_ID - vlan_ID} {{fastethernet

| gigabitethernet | tengigabitethernet | macro macro_name} slot/interface - interface}]

 

Catalyst 6000/6500系列:Switch(config)#interface range {{vlan vlan_ID - vlan_ID [, vlan vlan_ID - vlan_ID]} | {type slot/port - port [, type slot/port - port]} | {macro_name [, macro_name]}}

后面两个格式中的“vlan_ID - vlan_ID”也是属于最前面的那个格式中参数“port-range”中的一种格式。而且后面两个格式其实是一样的,只是在接口范围表示形式和参数顺序排列上有少许不同。

参数“port-range”用来指定要配置的接口范围(VLAN或者物理接端口),进入接口范围配置模式。

“interface range”命令配置多达5个端口的范围,或者以前定义的宏(macro)。有关宏方面的说明,将在下节的“配置和使用接口范围宏”介绍。

,)分隔的接口范围中,你必须键入为每个接口条目键入接口类型,在逗号的前后都必须有空格。

-)格式的接口范围中,你不需要重复键入接口类型,但在是连接符前留有一个空格。

Step 3 

 

Step 4 

Switch(config-if)#end

show interfaces [interface-id]

copy running-config startup-config

在使用“interface range”全局配置命令时,注意以下事项:

n         首先,以下接口范围格式才是有效的:

Ø              vlan vlan-ID - vlan-ID(VLAN ID范围是1~4094)

Ø              fastethernet stack member/module/{第一个端口} - {最后一个端口}(模块号全是为0)

Ø              gigabitethernet stack member/module/{第一个端口} - {最后一个端口}(模块号全是为0)

Ø              port-channel 端口通道号 – 端口通道号(端口通道号范围为1~48,但必须都是激活的)

n         你必须连接符两端留有空格,如“interface range gigabitethernet1/0/1 - 4”是有效的,而“interface range gigabitethernet1/0/1-4”是无效的。

n         “interface range”命令仅适用于已用“interface vlan”配置的VLAN接口(此处只是针对VLAN接口而言,并非“interface range”命令中只能包括VLAN接口)。范围中的VLAN接口必须已用“interface vlan”命令进行了配置。可用“show running-config”特权模式命令显示VLAN接口配置,不在该命令输出中显示的VLAN接口不能在接口范围中。

n         在范围中定义的所有接口必须是同种类型的(如全部为快速以太网,或者千兆以太网,或者以太网通道,或者VLAN端口类型)。

下面的示例显示了在Catalyst 3750系列交换机中如何使用“interface range”全局配置模式设置堆叠成员1的端口1到端口4快速以太网端口。

Switch# configure terminal

Switch(config)# interface range gigabitethernet1/0/1 - 4

Switch(config-if-range)# speed 100

以下示例显示在Catalyst 3750系列交换机中如何使用逗号来在范围中添加不同类型接口,其中包括堆叠成员1的1~3号快速以太网端口和堆叠成员2的1~2号千兆以太网端口,并且应用帧的流控制。

Switch# configure terminal

Switch(config)# interface range fastethernet1/0/1 - 3, gigabitethernet2/0/1 - 2

Switch(config-if-range)# flowcontrol receive on

如果你在接口范围配置模式中键入多个配置命令,则每个命令在键入后即将被执行,而不会批量执行,也不会等到退出接口范围配置模式才执行。如果在执行过程中你退出了接口范围配置模式,则有些命令可能不会在范围中的所有接口上执行。所以,你必须在出现命令提示符后才退出接口范围配置模式。

以下示例显示的是在Catalyst 4500/4900/6000/6500等系列中如何一次性激活接口5/1 ~ 5/5。

Switch(config)# interface range fastethernet 5/1 - 5

Switch(config-if)# no shutdown   #  激活接口

Switch(config-if)#

*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet5/1, changed state to up

*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet5/2, changed state to up

*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet5/3, changed state to up

*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet5/4, changed state to up

*Oct  6 08:24:35: %LINK-3-UPDOWN: Interface FastEthernet5/5, changed state to up

*Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet5/

5, changed state to up

*Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet5/

3, changed state to up

*Oct  6 08:24:36: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet5/

4, changed state to up

Switch(config-if)#

以下示例显示了如何在Catalyst 4500/4900/6000/6500等系列中使用逗号分隔的不同类型接口范围内激活端口5/1 ~ 5/5快速以太网端口和1/1、1/2千兆以太网端口。

Switch(config-if)# interface range fastethernet 5/1 - 5, gigabitethernet 1/1 - 2

Switch(config-if)# no shutdown

Switch(config-if)#

*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet5/1, changed state to up

*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet5/2, changed state to up

*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet5/3, changed state to up

*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet5/4, changed state to up

*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface FastEthernet5/5, changed state to up

*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet1/1, changed state to

 up

*Oct  6 08:29:28: %LINK-3-UPDOWN: Interface GigabitEthernet1/2, changed state to

 up

*Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet5/

5, changed state to up

*Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet5/

3, changed state to up

*Oct  6 08:29:29: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet5/

4, changed state to up

Switch(config-if)#

本文摘自《(CiscoH3C交换机配置与管理完全手册)》第四章
阅读(965) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~