类别命令格式命令含义基本配置S> enable进入特权模式S# configure terminal进入全局配置模式S(config)# hostnamename改变交换机名称S(config)# enable password levellevel_# password设置用户口令(level_#=1)或特权口令(level_#=15)S(config)# line console 0进入控制台接口S(config-line)# passwordconsole_password接上一条命令,设置控制台口令S(config)# line vty 0 15进入虚拟终端S(config-line)# passwordtelnet_password接上一条命令,设置Telnet口令S(config-line)# login允许Telnet登录S(config)# enable password|secretprivilege_password配置特权口令(加密或不加密)S(config)# interface ethernet|fastethernet|gigabitethernetslot_#/port_#进入接口子配置模式S(config-if)# [no] shutdown关闭或启用该接口(默认启用)S(config)# ip addressIP_address sunbet_mask指定IP地址S(config)# ip default-gatewayrouter's_IP_address指定哪台路由器地址为默认网关S# show running-config查看当前的配置S# copy running-config startup-config将RAM中的当前配置保存到NVRAM中S> show interface[type slot_#/port_#]查看所有或指定接口的信息S> show ip 显示交换机的IP配置(只在1900系列上可用)S> show version查看设备信息S# show ip interface brief验证IP配置S(config-if)# speed 10|100|auto设置接口速率S(config-if)# duplex auto|full|half设置接口双工模式S> show mac-address-table查看CAM表S# clear mac-address-table清除CAM表中的动态条目1900(config)# mac-address-table permanentMAC_address type [slot_#/]port_#在CAM表中创建静态条目2950(config)# mac-address-table staticMAC_address vlan VLAN_# interface type [slot_#/] port_#在CAM表中创建静态条目1900(config)# mac-address-table restricted staticMAC_address source_port list_of_allowed_interface设置静态端口安全措施1900(config-if)# port secure启用粘性学习1900(config-if)# port secure max-mac-count value设置粘性学习特性能够学到的地址数量(默认132,取值范围是1-132)1900(config)# address-violation suspend|ignore|disable改变安全选项1900> show mac-address-table security验证端口安全措施2950(config)# switchport mode access定义接口为主机端口而不是中继端口2950(config)# switchport port-security启用端口安全措施2950(config)# switchport port-security maximumvalue指定可与此接口相关的设备的最大数量2950(config)# switchport port-security violation protect|restrict|shutdown指定出现安全违规时应该发生的事2950(config)# switchport port-security mac-addressMAC_address指定允许与此接口相关的确切的MAC地址2950(config)# switchport port-security mac-address sticky启用粘性学习特性2950(config)# show port interface type [slot_#/] port_#验证接口配置2950(config-if) descriptionname设置接口描述信息2950# show buffers查看系统缓存的大小1900# copy nvram tftp://IP_address_of_TFTP_server/ file_name将配置文件备份到TFTP服务器上1900# copy tftp://IP_address_of_TFTP_server/ file_namenvram 从TFTP服务器上恢复配置到NVRAM1900# delete nvram删除配置文件2950# erase startup-config删除配置文件3550# show tcam qosTCAM_IDstatistics查看TCAM剩余容量4000> enable进入特权模式4000>(enable) set password设置用户模式密码4000>(enable) set enablepass设置授权密码4000>(enable) set interface sc0IP_address mask配置IP地址4000>(enable) set port enable|disableslot_#/port_#启用/禁用接口4000>(enable) show port[slot_#/port_#]显示接口信息4000>(enable) set port nameslot_#/port_# name设置交换机接口描述信息4000>(enable) set port speedslot_#/port_#4|10|16|100|auto设置交换机接口速率4000>(enable) set port duplexslot_#/port_#full|half设置交换机接口双工模式4000>(enable) clear config all删除NVRAM中的配置信息4000>(enable) erase all删除FLASH中的内容4000>(enable) show flash显示FLASH中的内容4000>(enable) show cam [count] dynamic|static|permanent|system[vlan_#]显示CAM表VLAN1900(config)# vtp domain VTP_domain_name定义交换机域名1900(config)# vtp server|client|transparent定义交换机VTP模式(默认服务器)1900(config)# vtp passwordVTP_password配置VTP口令1900(config)# vtp pruning enable|disable启用/禁用修剪(默认启用)1900(config)# vtp trap enable启用SNMP陷阱(默认启用)1900# show vtp验证VTP配置2950# vtp database访问VLAN和VTP配置(以下均是在IOS12.1前用,12.1后全是在全局配置模式下)2950(vlan)# vtp domainVTP_domain_name定义交换机域名2950(vlan)# vtp server|client|transparent定义交换机VTP模式(默认服务器)2950(vlan)# vtp passwordVTP_password配置VTP口令2950(vlan)# vtp pruning启用/禁用修剪(默认启用)2950(config)# snmp-server enable traps vtp启用SNMP陷阱(默认启用)2950# show vtp status检查VTP配置2950# show vtp counters显示与VTP消息发送与接收相关的VTP统计信息1900(config-if)# trunk on|off|desirable|auto指定中继类型1900# show trunk A|B验证接口中继(A是fa0/26,B是fa0/27)2950(config-if)# switchport mode trunk|dynamic desirable|dynamic auto|nonegotiate指定中继类型(默认自动协商)2950(config-if)# switchport trunk native|allowed|pruning vlan VLAN_#配置中继2950(config-if)# switchport trunk pruning vlan removeVLAN_#清除不希望消减的VLAN2950# show interfaces [type 0/port_#] switchport|trunk验证接口中继1900(config)# vlan VLAN_# [nameVLAN_name创建VLAN1900(config-if)# vlan-membership static VLAN_#将该接口静态地分配给一个VLAN1900# show vlan验证VLAN1900# show vlan-membership查看VLAN成员关系1900# show spantree[VLAN_#]查看VLAN的STP信息2950# vlan database进入VLAN数据库(ISO12.1前用)2950(vlan)# vlan VLAN_#[name VLAN_name创建VLAN2950(config)# vlanVLAN_#进入VLAN数据库(ISO12.1后用)2950(config-vlan)# nameVLAN_name创建VLAN2950(config-if)# switchport mode access指定连接是接入链路连接2950(config-if)# switchport access vlan VLAN_#指定VLAN是接入链路连接4000>(enable) set vlan VLAN_#nameVLAN_name配置VLAN4000>(enable) set vlanVLAN_# slot_#/port_#-port_#为VLAN分配端口4000>(enable) set trunkslot_#/port_#[on|off|desirable|auto|nonegotiate][VLAN_#]配置中继4000>(enable) clear trunk slot_#/port_# VLAN_#删除VLAN4000>(enable) show trunkslot_#/port_#验证中继端口4000>(enable) set vtp v2 enable配置VTPv24000>(enable) set vtp [domainname] [mode client|server|transparent] [passwdpassword] [pruning enable|disable] [v2 enable|disable设置VTP4000>(enable) show vtp domain验证VTP域的信息4000>(enable) show vtp statistics显示发出或收到的VTP通告信息的摘要内容4000>(enable) set vtp pruneeligibleVLAN_#设置VTP消减4000>(enable) clear vtp pruneeligibleVLAN_#清除不希望消减的VLAN                        STP4000>(enable) set spantree enable|disableVLAN_#启用/禁用STP(默认启用)2950(config)# [no] spanning-tree vlanVLAN_#启用/禁用STP(默认启用)4000>(enable) show spantree[VLAN_#]验证STP状态2950# show spanning-tree验证STP状态4000>(enable) set spantree root [secondary]VLAN_# [dianetwork_diameter] [hellohello_time设置主根节点桥、备份节点桥、最大桥数量(2-7)、持续时间(1-10,默认2)4000>(enable) set spantree portcostslot_#/port_# cost_#设置端口开销2950(config-if)# spanning-tree costcost_#设置端口开销4000>(enable) set spantree portprislot_#/port_# priority_#设置端口优先级4000>(enable) set spantree portvlanprislot_#/port_# priority_# [VLAN_#]改变VLAN的优先级设置2950(config-if)# spanning-tree vlanVLAN_#port-prioritypriority_#设置端口优先级4000>(enable) set spantree fwddelaydelay_# [VLAN_#]设置从侦听状态到学习状态再到转发状态的时间间隔(默认15秒,取值范围是4-30秒)4000>(enable) set spantree hello interval_time [VLAN_#]设置根节点交换机发送BPDU的时间间隔(默认2秒,取值范围是1-10秒)4000>(enable) set spantree maxageagingtime [VLAN_#]设置交换机持有BPDU的时间(默认20秒,取值范围是6-40秒)2950(config)# spanning-tree vlanVLAN_# forward-timeforward_time设置从侦听状态到学习状态再到转发状态的时间间隔(默认15秒,取值范围是4-30秒)2950(config)# spanning-tree vlanVLAN_# hello-timehello_time设置根节点交换机发送BPDU的时间间隔(默认2秒,取值范围是1-10秒)2950(config)# spanning-tree vlan VLAN_#max-agemaxage设置交换机持有BPDU的时间(默认20秒,取值范围是6-40秒)4000>(enable) set port channelslot_#/port_# on建立以太通道集合4000>(enable) show port capabilities