配置二层端口
2950的所有端口缺省的端口都是二层口,如果此端口已经配置成三层端口的话,则需要用switchport来使其成为二层端口。
配置端口速率及双工模式
可以配置快速以太口的速率为10/100Mbps及千兆以太口的速率为
10/100/1000-Mbps; 但对于GBIC端口则不能配置速率及双工模式,有时可以配置nonegotiate,当需要联接不支持自适应的其它千兆端口时 命令 目的 Step 1 configure terminal Step 2 interface 进入配置状态. 进入端口配置状态. interface-id Step 3 speed {10 | 100 | 1000 | auto | nonegotiate} 设置端口速率 注 1000 只工作在千兆口. GBIC模块只工作在1000 Mbps下. nonegotiate 只能在这些GBIC上用 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
Switch# configure terminal
Switch(config)# interface fastethernet0/3
设置全双工或半双工. 退出 显示有关配置情况 保存
Switch(config-if)# speed 10
Switch(config-if)# duplex half
端口描述
命令 目的 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
保存 Use the no description interface configuration command to delete the description.
This example shows how to add a description on Fast Ethernet interface 0/4 and to verify the description:
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
监控及维护端口
监控端口和控制器的状态
主要命令见下表:
Show Commands for Interfaces Command 目的 show interfaces [interface-id] 显示所有端口或某一端口的状态和配置. 显示一系列端口的状态或错误-关闭的状态 显示二层端口的状态,可以用来决定此口是否为二层或三层口。 显示端口描述 show interfaces interface-id status [err-disabled] show interfaces [interface-id] switchport show interfaces [interface-id] description show running-config interface [interface-id] show version
举例如下:
Switch# show interfaces status
显示当前配置中的端口配置情况 显示软硬件等情况 Port Name Status Vlan Duplex Speed Type
Gi0/1 connected routed a-full a-100 10/100/1000Base TX
Gi0/2 wce server 20.20.2 disabled routed auto auto 10/100/1000Base TX Gi0/3 ip wccp web-cache notconnect routed auto auto 10/100/1000Base TX Gi0/4 notconnect routed auto auto 10/100/1000Base TX Gi0/5 notconnect routed auto auto 10/100/1000Base TX Gi0/6 disabled routed auto auto 10/100/1000Base TX Gi0/7 disabled routed auto auto 10/100/1000Base TX Gi0/8 disabled routed auto 100 10/100/1000Base TX Gi0/9 notconnect routed auto auto 10/100/1000Base TX Gi0/10 notconnect routed auto auto 10/100/1000Base TX Gi0/11 disabled routed auto auto unknown Gi0/12 notconnect routed auto auto unknown
Switch# show interfaces fastethernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: static access Operational Mode: down
Administrative Trunking Encapsulation: dot1q Negotiation of Trunking: Off Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default) Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001
Protected: false
Unknown unicast blocked: disabled Unknown multicast blocked: disabled
Voice VLAN: dot1p (Inactive) Appliance trust: 5
Switch# show running-config interface fastethernet0/2
Building configuration...
Current configuration : 131 bytes !
interface FastEthernet0/2 switchport mode access switchport protected no ip address mls qos cos 7 mls qos cos override end
刷新、重置端口及计数器
Clear命令 目的 clear counters [interface-id] clear line [number | console 0 | vty number]
清除端口计数器. 重置异步串口的硬件逻辑 Note clear counters 命令只清除用show interface所显示的计数,不影响用snmp得到
的计数
举例如下:
Switch# clear counters fastethernet0/5
Clear \y Switch#
*Sep 30 08:42:55: %CLEAR-5-COUNTERS: Clear counter on interface FastEthernet0/5 by vty1 (171.69.115.10)
可使用clear line 命令来清除或重置某一端口或串口,在大部分情况下并不需要这样做:
Switch# clear interface fastethernet0/5
关闭和打开端口