分享

思科交换机3550如何配置

 Frank_Chia 2010-04-22

需要完整的有关该章的语法和应用信息,请参考Catalyst 3550 Multilayer Switch Command ReferenceCisco IOS Interface Command Reference for Release 12.1.

理解接口类型

这个部分描述了不同的接口类型,以及其它章节所包括的详细配置这些接口的一些参考内容。其他章节描述了物理接口特性的配置过程。

这部分包括:

1.         基于端口的VLAN Port-Based VLANs

2.       交换端口 Switch Ports

3.   以太网通道端口组 EtherChannel Port Groups

4.   交换虚拟接口 Switch Virtual Interfaces

5.   被路由端口 Routed Ports

6.   连接接口 Connecting Interfaces

基于端口的VLAN Port-based Vlans

一个Vlan是一个按功能、组、或者应用被逻辑分段的交换网络,并不考虑使用者的物理位置。要更多关于Vlan的信息请看“Configuring VLANS”。一个端口上接受到的包被发往属于同一个Vlan的接收端口。没有一个第三层的设备路由Vlan间的流量,不同Vlan的网络设备无法通讯。

为了配置普通范围(Normal-range VlanVlan IDs 1-1005),使用命令:

config-vlan模式

(global) vlan vlan-id

vlan-configuration模式

(exec) vlan database

针对Vlan ID 1-1005vlan-configration模式被保存在vlan数据库中。
为配置扩展范围(extended-rangeVlans Vlan ID 1006-4094),你必须使用config-vlan模式,并把VTP的模式设为transparent透明模式。Extended-range Vlans不被添加到Vlan数据库。
VTP模式为透明模式,VTPVLan的配置被保存在交换机的running-configration中,并且你可以把它保存在startup-configration文件中,命令为:

(exec) copy running-config startup-config

添加端口到Vlan使用switchport接口配置命令:

确认接口

为一个干道(trunk)设置干道特性,并且如有需要,可定义该干道属于哪个VLANs

为一个访问端口(access port)设置和定义他属于哪个Vlan

为一个隧道端口(tunnel port)根据客户所指定的Vlan标签(customer-specific Vlan tag)设置和定义Vlan ID。请看配置802.1Q和第二层隧道协议

 

交换端口 Switch Ports

交换端口只是和一个物理端口相关的第二层接口。一个交换端口可以是一个访问端口、一个干道端口、或者一个隧道端口。你可以配置一个端口为一个访问端口或者干道端口;或者一个预端口(per-port)。该预端口允许DTP运行,靠与另一端的链路端口协商(negotiate)来决定一个交换端口是一个访问端口还是干道端口。你必须手工配置隧道端口,该隧道端口连结着一个 802.1Q干道端口,并作为一条不对称链路的一部分。交换端口被用于管理物理接口和与之相关的第二层协议,并且不处理路由和桥接。

配置交换端口使用命令:

(interface) switchport

需要详细的配置交换端口和干道端口的信息,请看配置Vlans”。需要更多关于隧道端口的信息请看配置802.1Q和第二层隧道协议

 

访问端口(Access Ports

一个访问端口乘载只属于一个Vlan的流量。流量以不带Vlan标签的本地格式被接收和发送。到达一个访问端口的流量被认为属于指定给某个端口的某个Vlan。如果一个访问端口收到了一个被标注的包(ISL802.Q),这个包被丢弃,他的原地址不被获知,并且这个帧在No destinaion统计项被中计数。

两种类型的访问端口被支持:

静态访问端口被手工指派给一个Vlan

 动态访问端口的Vlan成员资格通过进入的包被获知。缺省一个动态访问端口不是任何一个Vlan的成员,只有当该端口的Vlan成员资格被发现时该端口才能开始转发。在Catalyst 3550交换机中,动态访问端口被VMPS指派给一个Vlan。这个VMPS可以是一台Catalyst 6000线性交换机;而Catalyst 3550交换机不支持VMPS功能。

 

干道端口(Trunk Ports

一个干道端口乘载多Vlan的流量,并且默认是Vlan数据库中的所有Vlans的一个成员。两个类型的干道端口被支持:

在一个ISL干道端口中,所有接收到的数据包被期望使用ISL头部封装,并且所有被传输和发送的包都带有一个ISL头。从一个ISL端口收到的本地帧(non-tagged)被丢弃。

 一个IEEE802.1Q干道端口同时支持加标签和未加标签的流量。一个802.1Q干道端口被指派了一个缺省的端口Vlan IDPVID),并且所有的未加标签的流量在该端口的缺省PVID上传输。一个带有和外出端口的缺省PVID相等的Vlan ID的包发送时不被加标签。所有其他的流量发送是被加上Vlan标签的。

尽管缺省情况下,一个干道端口是每个了解VTPVlan的一个成员,你可以通过为每个干道端口配置一个允许列表来限制Vlan成员资格。这个允许Vlan列表不影响除相关干道端口以外的任何其他的端口。缺省所有可能的Vlan1-4094)都在这个允许列表里。如果VTP了解到了某个Vlan,并且该Vlan为启用运行状态,那么一个干道端口只能够成为一个Vlan的一个成员。如果VTP学到了一个新的,启用了的Vlan,并且对于一个干道端口来说该Vlan在允许列表内,那么该干道端口自动成为该Vlan的一个成员,并且该Vlan的流量通过该干道被转发。如果VTP学习到了一个新的,起用的,但对于该干道端口来说不在访问列表中的Vlan,这个端口不会成为该Vlan的成员,并且没有关于该Vlan的流量会从该端口被转发出去。

 

注意:Vlan1不包括在允许列表中。

 

需要更多信息请看配置Vlans”

 

隧道端口(Tunnel Ports

隧道端口被用于802.1Q隧道,来把服务提供商网络中的客户与表现为同一个Vlan的其他客户流量隔离开。
你从服务提供商的边缘交换机到客户交换机上的一个802.1Q隧道端口配置一条异步链路。包进入边缘交换机的隧道端口时,为每一个用户把已标注用户Vlan802.1Q帧与802.1Q标签的另一层(metro tag)一起封装。该metro标签层包含一个在服务提供商网络中唯一的Vlan ID。这个双标签包穿过服务提供商网络,并确保该源发客户区别于其他客户的Vlan。在外出接口,也是一个隧道接口,该metro标签被移除,并且来自于客户网络的源发Vlan号被检索。

隧道端口不能是干道端口或者访问端口,并且对于每个客户来说必须有一个唯一的Vlan号。

需要更多的关于隧道端口的信息请看配置802.1Q和第二层隧道协议

 

以太通道端口组(Ethernet Port Groups

以太通道端口组提供把多个交换机端口像一个交换端口对待。这些端口组为交换机之间或交换机和服务器之间提供一条单独的高带宽连接的逻辑端口。以太通道在一个通道中提供穿越链路的负载平衡。如果以太通道中的一个链路失效,流量会自动从失效链路转移到被用链路。你可以把多干道端口加到一个逻辑的干道端口;把多访问端口加到一个逻辑访问端口;或者多隧道端口加到一个逻辑的隧道接口。绝大多数的协议能够在单独或是集合的接口上运行,并且不会意识到在端口组中的物理端口。除了DTPCDPPAgP,这些协议只能在物理接口上运行。

当你配置一个以太通道,你创建一个端口通道逻辑接口,并且指派一个接口给以太通道。对于三层接口,你人工创建该逻辑接口:

(global) interface port-channel

对于二层接口,该逻辑接口是动态被创建的。

对于二层和三层接口,你人工指派一个接口给以太通道:

(interface) channel-group

这条命令把物理和逻辑端口绑定到一起。需要更多的信息请看配置以太通道

 

交换虚拟接口(Switch Virtual Interfaces

一个SVI代表一个交换端口的Vlan,该端口做为一个系统中的路由或者交换接口。只有SVI可以和一个Vlan相关联,但是只有当你期望在Vlan间路由,在VlanFallback桥接不可路由协议时,或提供IP主机与交换机相互联通时,你需要为一个Vlan配置一个SVI。缺省情况下,为实现远程交换的管理,一个SVI为缺省Vlan(Vlan1)而创建。额外的SVIs必须被明确的配置。在二层模式中,SVIs只提供IP主机到系统的可连通行;在三层模式中,你能够配置穿过SVIs的路由。


注意:为了在三层模式中使用SVIs,你必须在你的交换机上安装增强多层软件映像(EMI)。所有的Catalyst 3550GBT交换机交货时已装有EMICatalyst 3550FESwitch交货时既可能是标准多层软件映像(SMI)也可能是预装EMI。你可以定购EMI升级包,升级Catalyst3550SMIEMI


当你第一次为一个Vlan接口输入Vlan接口配置命令时SVIs就被创建。一个Vlan与一个Vlan标签相符合。该Vlan标签与在干道端口上封装的ISL或者802.1Q数据帧有关,或与为一个访问端口配置的Vlan ID有关。为你打算路由流量的每个Vlan配置一个Vlan接口,并且指定给他一个IP地址。需要更多的信息,请看配置IP地址部分。

SVIs支持路由协议和桥接配置。需要更多的关于配置IP路由的信息请看配置IP单播路由

配置IP多播路由,和配置Fallback桥接

 

被路由端口(Routed Ports

一个被路由端口是一个物理端口,就像路由器上的端口;他不必连接一个路由器。一个被路由端口与一个特定的Vlan没有关系,而是作为一个访问端口。一个被路由端口的表现象是一个普通的路由接口,除了他不支持Vlan的子接口。被路由端口能用一个三层路由协议配置。


注意:为了配置被路由端口,你必须有EMI装在你的交换机上。


把接口放入三层模式来配置被路由端口,用命令:

(interface) no switchport

接着指派一个IP地址给端口,启用路由,并且指派路由协议:

(interface) ip address ip_address

(global) ip routing

(global) router protocol


小心:输入一个no switchport接口配置命令将关闭该接口并重启他,该设备可能会产生消息给直连的接口。另外,当你使用这条命令把接口放入三层模式,那么你正在删除该端口的所有二层特性。


你可配置的被路由端口和SVIs的号码在软件上是没有限制的;然而,因为硬件的限制,这个数目和被配置的其他接口特征数目之间的相互关系会影响CPU的利用。需要更多的关于特征集的信息请看为用户选择特性优化系统资源部分。

需要更多关于IP单播和多播路由以及路由协议,请看配置IP单播路由配置IP多播路由

 

连接端口(Connecting Interfaces

一个单独Vlan里的设备能够直接通过任何交换机直接通信。没有通过一个路由设备或路由接口,在不同Vlan中的端口不能交换数据。作为一个标准二层的交换机,在不同Vlan中的端口不得不通过路由器交换信息。在图9-1显示的配置中,当Vlan20中的主机A发送数据给Vlan30中主机B,他必须从主机A到交换机,到路由器,回到交换机,接着再到主机B

Figure 9-1: Connecting VLANs with Layer 2 Switches

使用带EMICatalyst3550,当你配置Vlan20Vlan30,并且他们都带有一个被指派了IP地址的SVI。包将被直接通过Catalyst3550,并不需要一个外部路由器就从主机A发送到主机B(图9-2)。

Figure 9-2: Connecting VLANs with the Catalyst 3550 Multilayer Switch

 该带有EMICatalyst3550在接口间转发流量,支持两种方法:路由和fallback桥接。为了保持高性能转发时尽量使用交换机的硬件。然而,只有以太网二型封装的IPV4数据包能够被用硬件路由。所有其他类型的流量可以使用依靠硬件的Fallback桥接。

路由功能能够在所有的SVIs和被路由接口上启用。带有EMICatalyst3550交换机只路由IP流量。当IP路由协议参数和地址配置被添加到一个SVI或者被路由接口,任何从这些端口收到的IP流量会被路由。需要更多的信息请看配置IP单播路由配置IP多播路由,和配置多播源发现协议(MSDP

Fallback桥接转发带有EMI交换机的不路由的流量或者属于一个不可路由协议的流量,如DECnetFallback桥接连接多个Vlan进入一个桥接域,该桥接域桥接了两个或多个SVIs或被路由端口。当配置Fallback桥接时,你指派SVIs或被路由端口到桥接组,同时每个SVI或被路由端口被指派给一个唯一的桥接组。所有在同一个组内的接口属于同一个桥接域。需要更多的信息,请看配置Fallback桥接

使用的接口命令

Catalyst3550支持这些接口类型:

物理接口---包含交换端口和被路由接口

 Vlans---交换虚拟端口

 端口通道---接口的以太通道

你也可以配置一个接口范围(请看配置一个接口范围部分)。

为了配置一个物理接口(端口),进入接口配置模式,并且指定接口Typeslot,和number

Type---10/100Fast Ethernetfastethernet or fa)或者Gigabit Ethernetgigabitethernet or gi

Slot---交换机上的插槽号码。在Catalyst3550上,插槽号码是0

Port number---交换机上的端口号。端口号码总是以1开头,面对交换机正面从左开始,例如,gigabitethernet 0/1gigabitethernet 0/2。如果这儿有超过一种媒介类型(例如,10/100端口和Gigabit Eehernet端口),该对口号码从第二中媒介再次开始:fastethernet0/1fastethernet0/2

你可用物理的方式检查交换机上的本地接口以确认物理接口。你也可以用IOSshow特权命令来显示交换机上指定接口或者所有接口的信息。该章以下的内容主要提供物理接口配置过程。

 

配置接口的步骤

这些通用的用法应用于所有的接口配置步骤。


第一步 在特权模式输入命令进入配置终端

Switch# configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#

第二步 在全局配置模式输入命令进入接口。确认接口的类型和接口的号码。在这个例子中,Gigabit Eehernet 接口0/1被选择:

Switch(config)# interface gigabitethernet0/1

Switch(config-if)#


注意:你不必在接口类型和接口号码之间加上一个空格。例如,在前面的行上,你可以既可以是gigabitethernet0/1gigabitethernet0/1gi 0/1,也可以是gi0/1


第三步 在带有接口配置命令的每个interface命令之后你可根据该接口的要求个别配置。那些你所输入定义的协议和应用的命令将会在接口上运行。当你进入另一个接口或者输入end返回特权EXEC模式时,这些命令被收集并且被应用。

你也可以配置一个接口范围,用命令:

(global) interface range

(global) interface range macro

在一个范围中被配置的接口必须是同一类型以及必须被配置相同的特征选项。

第四步 你配置一个接口以后,用命令确认它的状态,这些命令被列在监控和维护第二层接口部分。


输入show interface的特权命令以察看所有接口或为该交换机具体配置的一张列表。设备所支持的每个接口或特定接口的一个报告被提供出来:

Switch# show interfaces

 Vlan1 is up, line protocol is up

  Hardware is EtherSVI, address is 0000.0000.0000 (bia 0000.0000.00

  Internet address is 10.1.1.64/24

  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation ARPA, loopback not set

  ARP type: ARPA, ARP Timeout 04:00:00

  Last input 00:00:35, output 2d14h, output hang never

  Last clearing of "show interface" counters never

  Queueing strategy: fifo

  Output queue 0/40, 1 drops; input queue 0/75, 0 drops

  5 minute input rate 0 bits/sec, 0 packets/sec

  5 minute output rate 0 bits/sec, 0 packets/sec

     264251 packets input, 163850228 bytes, 0 no buffer

     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles

     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored

     380 packets output, 26796 bytes, 0 underruns

     0 output errors, 0 interface resets

     0 output buffer failures, 0 output buffers swapped out

FastEthernet0/1 is up, line protocol is down

  Hardware is Fast Ethernet, address is 0000.0000.0001 (bia 0000.00

  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation ARPA, loopback not set

  Keepalive set (10 sec)

  Auto-duplex, Auto-speed

  input flow-control is off, output flow-control is off

  ARP type: ARPA, ARP Timeout 04:00:00

  Last input never, output never, output hang never

  Last clearing of "show interface" counters never

  Queueing strategy: fifo

  Output queue 0/40, 0 drops; input queue 0/75, 0 drops

  5 minute input rate 0 bits/sec, 0 packets/sec

  5 minute output rate 0 bits/sec, 0 packets/sec

     0 packets input, 0 bytes, 0 no buffer

     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles

     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored

     0 input packets with dribble condition detected

     0 packets output, 0 bytes, 0 underruns

     0 output errors, 0 collisions, 2 interface resets

     0 babbles, 0 late collision, 0 deferred

     0 lost carrier, 0 no carrier

     0 output buffer failures, 0 output buffers swapped out

 

 

配置一个接口范围

 

命令

目的

第一步

configure terminal

启用全局配置模式

第二步

interface range {port-range | macro macro_name}

输入接口的范围(Vlans或者物理端口)进入接口范围配模式进行配置。

l         你可以使用interface range命令配置可达5个端可范围或一个事先定义的宏。

l         配置和使用接口范围宏中阐明宏是可变的。

l         每个逗号分隔的port-range必须包含相同的接口类型。你不必在逗号后面输入空格。

l         当你定义了一个范围,第一个端口和连字符之间需要一个空隔。

第三步

 

你现在可以用普通的配置命令提供配置参数给所有在范围内的接口。

第四步

end

返回特权EXEC模式。

第五步

show interface [interface-id]

确认在范围内的接口配置。

第六步

copy running-config startup-config

(可选) 保存你的条目到配置文件中。

当使用interface range全局配置命令时,注意这些指导:

l         确认port-range的条目:

²        vlan vlan-ID-vlan-ID,该处Vlan ID1-4094

²        fastethernet slot/{firt port} –{last port},该处slot0

²        gigabitethernet slot/{first port} –{last port},该处slot0

²        port-channel port-channel-number -port-channel-number,该处port-channel-number1-64

 

当使用interface range命令时,你在必须在接口号码和连字符之间添加一个空格。例如,

(globel) interface range gigabitethernet 0/1 -5是一个可用的范围;而

(globel) interface range gigabitethernet 0/1-5是一个不可用的范围。

interface range命令只工作在已经被配置了interface vlan命令的Vlan接口(show running-config特权命令显示被配置的Vlan接口)。用show running-config 命令不能显示的Vlan接口不能被interface range命令使用。

范围内的所有接口必须是同一种类型;就是说,所有快速以太端口,所有千兆以太端口,所有以太通道端口,或所有交换虚拟端口。

这个例子显示怎样使用interface range全局配置命令启用Gigabit Ethernet接口0/10/5

Switch# configure terminal

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

 Switch(config-if-range)# no shutdown

Switch(config-if-range)#

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

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

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

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

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

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

changed state to up

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

changed state to up

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

changed state to up

这个例子展示怎样给范围用一个逗号来添加不同的接口类型字符串,在范围0/10/3和两个GBT接口0/70/8上启用所有的Gigabit Ethernet接口:

Switch# configure terminal

Switch(config)# interface range gigabitethernet0/1 -3, gigabitethernet0/7 -8

Switch(config-if-range)# no shutdown

Switch(config-if-range)#

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

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

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

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

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

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

changed state to up

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

changed state to up

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

changed state to up

 

如果当你在接口范围模式输入复合配置命令,每个命令就像他们被输入那样被执行。你退出接口范围模式后,这些命令不会被堆到一起被执行。如果命令正被执行时你退出接口配置模式,那么在范围里的所有接口的一些命令可能不会被执行。在退出接口范围配置模式之前要等到直到命令快速的再次出现。

 

配置和使用接口范围宏

你可以创建一个接口范围宏自动选择一个接口范围来配置。在你能够在interface range macro全局命令字符串中使用macro关键字之前,你必须用命令定义宏:

(global) define interface-range

 

命令

目的

第一步

configure terminal

进入全局配置模式

第二步

define interface-range macro_name interface_range

定义interface-range macro并保存在NVRAM

l         macro_name是一个最大32个字符的字符串。

l         一个macro可以包含5个以逗号隔开的接口范围。你不必在逗号前面或后面输入空格。

l         每个interface-range必须包含相同类型的端口

第三步

interface range macro macro_name

选择需被配置的接口范围,并使用保存在interface-range中叫做macro_name的宏。

 

第四步

end

返回特权模式

第五步

show running-config | include define

显示被确认的接口范围宏配置

第六步

copy running-config startup-config

(可选)保存你的条目到配置文件中。

用命令删除一个宏:

(global) no define interface-range macro_name

当使用define interface-range全局命令时,注意这些指导方针:

interface-range有效的条目:

²       vlan vlan-ID -vlan-ID, 该处VLAN ID 1 4094

²       fastethernet slot/{first port} -{last port}, where slot is 0

²       gigabitethernet slot/{first port} -{last port}, where slot is 0

²       port-channel port-channel-number -port-channel-number, 该处 port-channel-number 1 64.

当使用interface range命令时,你在必须接口号码和连字符之间添加一个空格。例如,

(globel) interface range gigabitethernet 0/1 -5是一个可用的范围;而

(globel) interface range gigabitethernet 0/1-5是一个不可用的范围。

Vlan接口(SVIs)必须已经用interface vlan命令配置好了。show running-config特权命令显示被配置的Vlan接口,
show running-config 命令不能显示的Vlan接口不能被interface range命令使用。

范围内的所有接口必须是同一种类型;就是说,所有快速以太端口,所有千兆以太端口,所有以太通道端口,或所有交换虚拟端口。

这个例子展示怎样定义一个选择了GBT端口1-4,名为enet_list的接口范围宏,确认宏配置如下:

Switch# configure terminal

Switch(config)# define interface-range enet_list gigabitethernet0/1 -4

Switch(config)# end

Switch# show running-config | include define

define interface-range enet_list GigabitEthernet0/1 -4

Switch#

这个例子展示怎样创建一个名为macrol的多接口宏:

Switch# configure terminal

Switch(config)# define interface-range macro1 gigabitethernet0/1 -2, fastethernet0/5 -7

Switch(config)# end

Switch#

这个例子展示怎样把接口宏enet_list输入到接口范围配置模式:

Switch# configure terminal

Switch(config)# interface range macro enet_list

Switch(config-if-range)#

这个例子展示怎样删除接口范围宏enet_list,并且确认他确实已被删除。

Switch# configure terminal

Switch(config)# no define interface-range enet_list

Switch# show run | include define

Switch#

 

配置第二层接口

这些部分描述了缺省接口配置以及那些你可以在大多数物理接口上配置的可选项:

 缺省第二层以太网接口配置

 配置接口速度和双工模式

配置IEEE802.3X流控制

为一个接口添加一个描述

 

注意:进入接口配置模式以后,如果接口在第三层模式,你必须输入不带任何参数

(interface) switchport  以把该接口放入第二层模式。这样会关闭接口并重新起用他,并产生消息给已经连接着的接口。

同时,当你用这个命令把接口放入第二层模式时,你也删除了接口上的所有第三层特征。

 

缺省第二层以太接口配置

9-1显示了第二层以太接口缺省配置。需要更多的被列在表中的Vlan参数的详细信息,请看配置Vlans”

需要详细的控制端口流量的信息,请看配置基于端口的流量控制

9-1:缺省第二层以太接口配置

特征

缺省设置

运作模式

第二层或交换模式 (switchport command).

注意  路由模式 (no switchport command) 只有当交换机装有EMI时才是一个可用模式。所有的Catalyst 3550GBT交换机交货时已装有EMICatalyst 3550FESwitch交货时要么是标准多层软件映像(SMI)要么是预装EMI的。你可以定购EMI升级包,升级Catalyst3550SMIEMI

允许的 VLAN 范围

VLANs 1 - 4094.

缺省 VLAN (给访问端口)

VLAN 1.

本地 VLAN (802.1Q干道)

VLAN 1.

VLAN 中继

动态可用的交换端口模式 (支持 DTP).

端口启用状态

所有端口都被启用

端口描述

没有定义

速度

自适应

双工模式

自适应

流控制

对于10/100/1000 Mb/s端口流控制收为关闭off, 发为期望 desired。而对于10/100 Mb/s 端口, 发总是关闭off

以太通道 (端口聚合协议PAgP)

在所有端口上没有启用。 请看配置以台通道”

端口阻塞 (未知多播和未知单播流量)

禁用(没有被阻断). 请看 "配置端口阻断" 部分.

广播,多播和单播风暴控制 

禁用。 请看缺省风暴控制配置

受保护

禁用。 请看配置受保护端口部分

端口安全

禁用 请看缺省端口安全配置部分

速端口

禁用

 

配置接口速度和双工模式

这个部分描述怎样配置接口速度和双工模式:

 配置方针

设置接口速度和双工参数

 

配置方针

当配置一个接口速度和双工模式时,注意这些方针:

如果线路两端支持自动协商,我们强烈建议使用缺省自动协商设置。

 如果一端接口支持自动协商而另一端不支持,需在两个接口上配置双工和速度;不要在支持的一方使用auto设置

 

注意:GigaStack-to-GigaStack串联连接运行在半双工模式,而GigaStack-to-GigaStack点到点连接运行在全双工模式。

 

 

小心:改变接口速度和双工模式的配置,在重配置期间可能会关闭并重启该接口。

 

 

设置接口速度和双工模式

你可以在快速以太(10/100-Mbps)和千兆以太(10/100/1000-Mbps)上配置接口速度;

你无法在千兆接口转发器接口(GBIC)上配置速度。

你可以配置在任何没有设置自动协商的快速或千兆接口上配置双工模式;你无法在GBIC上配置双工模式。

因为以太网中的主要约束是冲突,全双工通讯是一个有效的解决方案。

通常,10-Mbps端口运行在半双工模式,这就意味着该站点要么接收要么发送。

在全双工模式模式,两个站点能够在同一时间接收和发送。

当包同时在两个方向上流动时,10-Mbps接口的有效以太带宽会翻一倍到20Mbps,快速以太接口会到200Mbps,而GBT接口会到2Gbps

 

注意:你无法在GBIC上配置速度和双工模式,

但是,如果被连接的设备不支持自动协商,你可以在某些GBICs上配置速度为不协商(nonegotiate)。

 

 

从特权模式开始,以下的步骤为物理接口设定速度和双工模式:

 

命令 

目的

Step 1 

configure terminal

进入全局配置模式

Step 2 

interface interface-id

进入接口配置模式,并确认物理接口

Step 3 

speed {10 | 100 | 1000 | auto | nonegotiate}

为接口输入适当的接口参数, 或者输入 auto nonegotiate.

注意   1000关键字只针对10/100/1000 Mbps 的端口有效. nonegotiate 关键字只针对1000BASE-SX, -LX, and -ZX GBIC 端口有效.

Step 4 

duplex {auto | full | half}

为接口输入双工参数

Step 5 

end

返回特权模式

Step 6 

show interfaces interface-id

显示接口配置的速度和双工模式

Step 7 

copy running-config startup-config

(可选) 保存你的条目到配置文件

no speedno duplex接口配置命令使接口返回缺省速度和双工设置(autonegotiate)。为了返回所有的接口缺省设置,使用命令

(interface) default interface interface-id

这个例子显示了在fastethernet interface 0/3口上怎样设定接口速度为10Mbps和半双工模式,并确认这个配置:

Switch# configure terminal

Switch(config)# interface fastethernet0/3

Switch(config-if)# speed 10

Switch(config-if)# duplex half

Switch(config-if)# end

Switch# show interfaces fastethernet0/3

FastEthernet0/3 is up, line protocol is down

  Hardware is Fast Ethernet, address is 0000.0000.0003 (bia 0000.0000.0003)

  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation ARPA, loopback not set

  Keepalive set (10 sec)

  Half-duplex, 10Mb/s

 

 

配置IEEE802.3X流控制

流控制在直连的以太端口上启用,在拥塞期间允许另一端拥塞的节点暂停链路运作来控制

流量速率。如果一个端口发生拥塞并且不能接收任何更多的流量,他将通知对端端口停止发送直到这种拥塞情况消失。

当本地设备在他本地检测到了任何拥塞,他能够发送一个暂停帧通知链路伙伴或者远程设备已发生拥塞。

紧随收到暂停帧之后,远程设备停止发送任何数据包,这样防止在拥塞期间丢弃任何一个数据包

 

注意:你不能在一个交换机上即配置IEEE802.3X流控制又配置QoS。在一个接口上配置流控制之前,用命令禁用交换机上的QoS

 

 

流控制可以用两种方式设计,对称和不对称。对称设计适合于点到点的链路,而不对称设计适合于辐射型节点连接。

辐射型节点中中心路由器可以中断末端系统,而反之就不行。用命令设置接口的发送或接收暂停帧为onoffdesired

(interface) flowcontrol {receive | send}{on | off | desired}

缺省快速以太端口是receive offsend off

 

注意:在Catalyst3550交换机上,GBT端口能够接收和发送暂停帧;快速以太端口只能够接收暂停帧。

因此,对快速以太端口来说,只能用send off来描述其状态。

 

 

这些规则应用于设备上的流控制:

 receive on (or desired) send on:流控制运行在两个方向;本地和远程设备都能够发送暂停帧来显示链路拥塞。

 receive on (or desired) send desired:如果连接设备支持流控制,那么该端口就能接收暂停帧和发送暂停帧

receive on (or desired) send off:该端口不能发送暂停帧但是能够和一个期望或能够发送暂停帧的连接设备一起运作;

该端口可以接收暂停帧。

receive off send on如果远程设备支持流控制,该端口就发送暂停帧;但是该端口不支持来自于远程设备的暂停帧。

receive off send desired:如果连接的设备支持流控制,而该端口不能够接收暂停帧但能发送暂停帧。

receive off send off:流控制不任何一个方向上执行。

在拥塞事件中,没有指示给链路伙伴,并且没有暂停帧在两个方向上被发送或接收。

 

注意:更多的关于命令配置的详情以及接口配置模式中的flowcontol命令给本地和远程的端口所带来的结果,

Catalyst 3550 Multilayer Switch Command Reference

 

 

从特权模式开始,以下这些步骤在接口上配置流控制:

 

Command

Purpose

Step 1 

configure terminal

进入全局配置模式

Step 2 

no mls qos

禁用交换机上的QoS

Step 3 

interface interface-id

进入接口配置模式以配置物理接口

Step 4 

flowcontrol {receive | send} {on | off | desired}

为端口配置流控制模式

注意   send 关键字不能用于10/100 Mbps接口.

Step 5 

end

返回特权模式

Step 6 

show interfaces interface-id

确认端口流控制配置

Step 7 

copy running-config startup-config

(可选) 把条目保存到配置文件中

要禁用流控制,使用:

(interface) flowcontrol receive off

(interface) flowcontrol send off

这个例子展示怎样关闭GBT 0/1上的所有流控制并显示结果:

Switch# configure terminal

Switch(config)# interface gigabitethernet0/1

Switch(config-if)# flowcontrol receive off

Switch(config-if)# flowcontrol send off

Switch(config-if)# end

Switch# show interfaces gigabitethernet0/1

 

GigabitEthernet0/1 is up, line protocol is down

  Hardware is Gigabit Ethernet, address is 0002.4b29.2e01 (bia 0002.4b29.2e01)

  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation ARPA, loopback not set

  Keepalive set (10 sec)

  Auto-duplex, Auto-speed

  input flow-control is off, output flow-control is off

 

为接口添加一个描述

你可以在一个接口上添加一段描述来帮助你记忆该接口的功能。该描述用以下的命令来显示:

(exec) show configuration

(exec) show running-config

(exec) show interface

从特权模式开始,以下步骤为给一个接口添加一段描述:

 

Command

Purpose

Step 1 

configure terminal

进入全局配置模式 

Step 2 

interface interface-id

进入接口配置模式,该接口是你想添加一段描述的接口。

Step 3 

description string

为一个接口添加一段描述(上限为240个字符)

Step 4 

end

返回特权模式

Step 5 

show interfaces interface-id description

or

show running-config

确认你的条目

Step 6 

copy running-config startup-config

(可选) 保存你的条目到配置文件中

删除接口描述用命令:

(interface) no description

这个例子展示怎样给快速以太接口0/4添加一段描述并确认该描述:

Switch# config terminal

 

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)# interface fastethernet0/4

Switch(config-if)# description Connects to Marketing

Switch(config-if)# end

Switch# show interfaces fastethernet0/4 description

 

Interface Status         Protocol Description

Fa0/4     up             down     Connects to Marketing

监控和维护第二层接口

你可以执行这几节中的任务来监控和维护接口:

监视接口和控制器状态

清空和重置接口和计数器

 关闭和重起接口

 

监视接口和控制器状态

在特权模式输入命令会立即显示关于该端口的信息,包括软件和硬件的版本,控制器状态,和接口的统计信息。

9-2列出了一些接口监控命令。

(你可以在特权模式中用show ?命令显示所有的show命令)这些命令的完全描述在

Cisco IOS Interface Command Reference for Release 12.1

9-2: 接口的show命令

Command

Purpose

show interfaces [interface-id]

显示所有接口或指定接口的状态和配置情况

show interfaces interface-id status [err-disabled]

显示接口状态或一个在错误禁用状态的接口列表

show interfaces [interface-id] switchport

显示交换端口(非路由端口)的管理和运行状态 你可以用这个命令派段一个端口实路由还是交换模式

show interfaces [interface-id] description

显示在一个接口上或所有接口上配置的描述信息和端口状态

show running-config

显示内存理的运行配置文件 

show version

显示配置文件的硬件配置, 软件版本, 名称 和源 ,以及引导映像(boot images)。

这个例子展示了怎么显示所有接口状态的命令:

Switch# show interfaces status

 

Port    Name    Status          Vlan   Duplex  Speed   Type

Gi0/1   CubeA   connected      1       a-full  a-100   10/100/1000BaseTX

Gi0/2   CubeE   notconnect     1       auto    auto    10/100/1000BaseTX

Gi0/3          CubeF   disabled       1       auto    auto    10/100/1000BaseTX

Gi0/4   CubeG   notconnect     1       auto    auto    10/100/1000BaseTX

Gi0/5   CubeH   notconnect     routed  auto    auto    10/100/1000BaseTX

Gi0/6   CubeI   notconnect     routed  auto    auto    10/100/1000BaseTX

Gi0/7   CubeJ   connected      1       a-full  a-100   10/100/1000BaseTX

Gi0/8   CubeK   notconnect     1       auto    auto    10/100/1000BaseTX

Gi0/9   CubeL   disabled       1       auto    auto    10/100/1000BaseTX

Gi0/10  CubeB   notconnect     routed  auto    auto    10/100/1000BaseTX

Gi0/11  CubeC   notconnect     1       auto    auto    unknown

Gi0/12  CubeD   notconnect     1       auto    auto    unknown

 

这个例子展示怎样显示交换端口的状态:

Switch# show interfaces switchport

 

Name: Gi0/1

Switchport: Enabled

Administrative Mode: dynamic desirable

Operational Mode: static access

Administrative Trunking Encapsulation: negotiate

Operational Trunking Encapsulation: native

Negotiation of Trunking: On

Access Mode VLAN: 1 (default)

Trunking Native Mode VLAN: 1 (default)

Trunking VLANs Enabled: ALL

Pruning VLANs Enabled: 2-1001

 

Protected: True

Unknown unicast blocked: disabled

Unknown multicast blocked: disabled

 

Voice VLAN: none (Inactive)

Appliance trust: none

 

Name: Gi0/2

Switchport: Enabled

Administrative Mode: dynamic desirable

Operational Mode: down

Administrative Trunking Encapsulation: negotiate

Negotiation of Trunking: On

Access Mode VLAN: 1 (default)

Trunking Native Mode VLAN: 1 (default)

Trunking VLANs Enabled: ALL

Pruning VLANs Enabled: 2-1001

 

Protected: True

Unknown unicast blocked: disabled

Unknown multicast blocked: disabled

 

Voice VLAN: none (Inactive)

Appliance trust: none

 

 

清空和重置接口和计数器

9-3列出了你可以用来清空计数器和重置接口的特权模式clear命令。

9-3:接口清除命令

Command

Purpose

clear counters [interface-id]

清除接口计数器

clear interface interface-id

重置接口的硬件逻辑电路

clear line [number | console 0 | vty number]

在一个异步串行线路上重置接口逻辑电路

 

为了清除用show interfaces特权模式命令显示的接口计数,使用特权命令:

(exec) clear counters

从接口清除所有当前接口计数,除非可选变量被指派来清除一个定接口类型,

该特定接口来自于一个特定接口号的唯一接口号。

 

注意:特权命令clear counters不能清除用SNMP重新收到的计数,只能清除用show interface特权命令显示的计数。

 

这个例子展示怎样清除和重置千兆口0/5

Switch# clear counters gigabitethernet0/5

Clear "show interface" counters on this interface [confirm] y

Switch#

*Sep 30 08:42:55: %CLEAR-5-COUNTERS: Clear counter on interface GigabitEthernet0/5

by vty1 (171.69.115.10)

清除和重置一个接口或一个串行线路,用命令:

(interface) clear interface

(interface) clear line

在绝大多数环境中,你不必清除一个接口或串行线路的硬件逻辑电路。

这个例子显示怎样清除和重置GBT接口0/5

Switch# clear interface gigabitethernet0/5

 

关闭和重启接口

关闭一个特定接口会禁用所有功能并且所有监控命令显示标注这个接口不可用。

通过动态路由协议给信息被发给其他的网络服务服务设备。

这个接口在所有路由更新中不被监控。

从特权模式开始,以下这些步骤关闭一个接口:

 

Command

Purpose

Step 1 

configure terminal

进入全局配置模式

Step 2 

interface {vlan vlan-id} | {{fastethernet | gigabitethernet} interface-id} | {port-channel port-channel-number}

选择一个需被配置的端口

Step 3 

shutdown

关闭一个接口

Step 4 

end

返回特权模式 

Step 5 

show running-config

确认你的条目

重启该接口用命令:

(interface) no shutdown

这个列子展示怎样关闭千兆以太接口0/5

Switch# configure terminal

Switch(config)# interface gigabitethernet0/5

Switch(config-if)# shutdown

Switch(config-if)#

*Sep 30 08:33:47: %LINK-5-CHANGED:

Interface GigabitEthernet0/5, changed state to a administratively down

这个例子展示怎样重启千兆以太接口0/5

Switch# configure terminal

Switch(config)# interface gigabitethernet0/5

Switch(config-if)# no shutdown

Switch(config-if)#

*Sep 30 08:36:00: %LINK-3-UPDOWN: Interface GiogabitEthernet0/5, changed state to up

为了确认一个接口是禁用的,输入命令:

(interface) show interface

在千兆以太接口0/1上,一个禁用的接口在show interface命令中被显示为administratively down

Switch# show interfaces

 GigabitEthernet0/2 is administratively down, line protocol is down

  Hardware is Gigabit Ethernet, address is 0002.4b29.4403 (bia 0002.4b29.4403)

  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation ARPA, loopback not set

  Keepalive set (10 sec)

  Auto-duplex, Auto-speed

 

配置一个三层接口

带有EMICatalyst3550交换机支持三, 种路由或桥接的三层接口:

SVIs:你应该为任何你想路由流量的Vlan配置SVIs。当你在interface vlan全局配置命令后输入一个Vlan ID时,SVIs被创建。

要删除一个SVI,用命令:

(global) no interface vlan

需要关于指派二层端口到VLANs,请看配置VLANs”

三层以太通道端口:以太通道由被路由端口组成。以太通道端口接口在配置以太通道中被描述。

被路由端口:被路由端口是被用接口配置命令no switchport配置为三层的物理端口。

 

注意:一个三层交换机可以有一个IP地址被指派个每个被路由端口和SVI

你可以配置的被路由和SVI接口在软件上是没有限制的;

然而,因为硬件的限制,这个数目和被配置的其他接口特征数目之间的相互关系会影响CPU的利用。

需要更多的关于特征集的信息请看为用户选择特性优化系统资源部分。

 

所有三层接口要求一个IP地址来路由流量。以下的步骤展示怎样配置一个三层接口和怎样指派一个IP地址给接口。

 

注意:如果该物理接口在二层模式(缺省),你必须用no switchport接口配置命令把接口放入三层模式。

输入一条no switchport命令会禁用并且重新启用该接口,该设备可能会产生消息给直连接口。

另外,当你使用这条命令把接口放入三层模式,你正在删除该端口的所有第二层特性。

 

从特权模式开始,以下这些步骤配置一个三层接口:

 

Command

Purpose

Step 1 

configure terminal

进入全局配置模式 

Step 2 

interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {port-channel port-channel-number}

进入接口配置模式,而且要进入一个将作为一个三层接口被配置的接口

Step 3 

no switchport

使物理接口进入三层模式 

Step 4 

ip address ip_address subnet_mask

配置IP地址和子网掩码 

Step 5 

no shutdown启用该接口 

 

 

Step 6 

end

返回特权模式 

Step 7 

show interfaces [interface-id]

show ip interface [interface-id]

show running-config interface [interface-id]

确认配置 

Step 8 

copy running-config startup-config

(可选) 把你的条目保存到配置文件

要移除一个接口的IP地址,用命令:

(interface) no ip address

这个例子显示怎样配置一个接口作为一个被路端口并给他指派IP地址:

Switch# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)# interface gigabitethernet0/2

Switch(config-if)# no switchport

Switch(config-if)# ip address 192.20.135.21 255.255.255.0

Switch(config-if)# no shutdown

Switch(config-if)# end

这是一个来自于一个接口的show interfaces特权命令的例子:

Switch(config)# show interfaces gigabitethernet0/2

GigabitEthernet0/2 is up, line protocol is up

  Hardware is Gigabit Ethernet, address is 0002.4b29.4400 (bia 0002.4b29.4400)

  Internet address is 192.20.135.21/24

  MTU 1500 bytes, BW 100000 Kbit, DLY 10 usec,

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation ARPA, loopback not set

  Keepalive set (10 sec)

  Full-duplex, 100Mb/s

  input flow-control is off, output flow-control is off

  ARP type: ARPA, ARP Timeout 04:00:00

  Last input 00:00:02, output 00:00:08, output hang never

  Last clearing of "show interface" counters never

  Queueing strategy: fifo

  Output queue 0/40, 0 drops; input queue 0/75, 0 drops

  5 minute input rate 0 bits/sec, 0 packets/sec

  5 minute output rate 0 bits/sec, 0 packets/sec

     89604 packets input, 8480109 bytes, 0 no buffer

     Received 81848 broadcasts, 0 runts, 0 giants, 0 throttles

     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored

     0 input packets with dribble condition detected

     60665 packets output, 6029820 bytes, 0 underruns

     0 output errors, 0 collisions, 16 interface resets

     0 babbles, 0 late collision, 0 deferred

     0 lost carrier, 0 no carrier

     0 output buffer failures, 0 output buffers swapped out

这是一个来自于一个接口的show ip interfaces特权命令的例子:

Switch# show ip interface gigabitethernet0/2

GigabitEthernet0/2 is up, line protocol is up

  Internet address is 192.20.135.21/24

  Broadcast address is 255.255.255.255

  Address determined by setup command

  MTU is 1500 bytes

  Helper address is not set

  Directed broadcast forwarding is disabled

  Multicast reserved groups joined: 224.0.0.5 224.0.0.6

  Outgoing access list is not set

  Inbound  access list is not set

  Proxy ARP is enabled

  Local Proxy ARP is disabled

  Security level is default

  Split horizon is enabled

  ICMP redirects are always sent

  ICMP unreachables are always sent

  ICMP mask replies are never sent

  IP fast switching is enabled

  IP fast switching on the same interface is disabled

  IP Flow switching is disabled

  IP CEF switching is enabled

  IP CEF Fast switching turbo vector

  IP multicast fast switching is enabled

  IP multicast distributed fast switching is disabled

  IP route-cache flags are Fast, CEF

  Router Discovery is disabled

  IP output packet accounting is disabled

  IP access violation accounting is disabled

  TCP/IP header compression is disabled

  RTP/IP header compression is disabled

  Probe proxy name replies are disabled

  Policy routing is disabled

  Network address translation is disabled

  WCCP Redirect outbound is disabled

  WCCP Redirect exclude is disabled

  BGP Policy Mapping is disabled

这是一个用了show running-config特权命令的接口输出的例子,该接口被配置不同的参数:

Switch# show running-config interface gigabitethernet0/2

 

Building configuration...

 

Current configuration : 122 bytes

!

interface GigabitEthernet0/2

 no switchport

 ip address 192.20.135.21 255.255.255.0

 speed 100

 mls qos trust dscp

end

Switch# show running-config interface fastethernet0/2

 

Building configuration...

 

Current configuration : 236 bytes

!

interface FastEthernet0/2

 switchport mode access

 no ip address

 ip access-group SecWiz_Fa0_2_in_ip in

 mac access-group SecWiz_Fa0_2_in_mac in

 wrr-queue cos-map 1 3 4 5 6

 wrr-queue cos-map 4 1 2

 spanning-tree portfast trunk

end

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多