1、2900 系列交换机配置命令 查看交换机的信息Switch# show run 全部配置信息Switch# show version 版本信息Switch# show interface vlan 1 IP 地址信息Switch# show int 端口信息Switch# show flash 闪存目录信息 删除配置信息到出厂配置Switch#delete flash:vlan.dat 先删除 VLAN 配置文件Switch#erase start 再删除全部配置Erasing the nvram filesystem will remove all files! Continue? conf
2、irmOKErase of nvram: completeSwitch#reload 重新启动Proceed with reload? confirm 保存配置方法 1: Switch#write方法 2: Switch#copy run start 设置主机名Switch#conf tSwitch(config)#hostname XXX 密码设置1、设置进入控制台(用户模式)的密码Switch(config)#line console 0Switch(config-line)#pass ciscoSwitch(config-line)#login2、设置远程登录 VTY 线路密码Switc
3、h(config-line)#line vty 0 4(或 15)Switch(config-line)#pass ciscoSwitch(config-line)#login3、设置进入 ENABLE 特权模式的密码Switch(config)#enable pass feng 明文密码Switch(config)#enable secret cisco 加密密码 设置 IP 地址和缺省网关Switch(config)#int vlan1Switch(config-if)#ip address 192.168.1.10 255.255.255.0Switch(config-if)#no sh
4、utdownSwitch(config-if)#exitSwitch(config)#ip default-gateway 192.168.1.100 设置端口双工模式和速率Switch(config)int f0/1Switch(config-if)#duplex full|half|autoSwitch(config-if)#speed 100|10|auto 启动 HTTP 服务Switch(config) ip http serverSwitch(config) ip http port 80 查看 MAC 地址表信息Switch# show mac 配置端口安全性Switch(con
5、fig) int f0/101. 启动端口安全Switch(config-if)#switchport port-security2. 设置端口最大可容纳的 MAC 地址个数Switch(config-if)#switchport port-security max-mac-count 13. 设置地址违反时的处理方式Switch(config-if)#switchport port-security violation shutdown|protect|restrict4. 设置端口上绑定的 MAC 地址Switch(config-if)#switchport port-security m
6、ac-address 1111.1111.1111 查看端口安全性配置Switch# sh port-security address 查看绑定的安全地址Switch# sh port-security int f0/1 查看安全端口 配置信息的保存Switch#copy run startDestination filename startup-config?Building configuration.Switch#copy run tftp 配置信息的恢复Switch#copy tftp run IOS 文件的保存Switch#copy flash tftp IOS 文件的恢复Switc
7、h#copy tftp flash 设置 VLANSwitch#conf tSwitch(config)#vlan 3Switch(config-vlan)#name vlan3VLAN 3 added:Name: vlan3Switch(config-vlan)#exitAPPLY completed.Exiting将端口加入到 VLAN 中Switch(config)#int f0/4Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan 3显示 VLAN 信息Switch#show
8、vlanSwitch#show vlan briefSwitch#sh flashDirectory of flash:/2 -rwx 1645810 Jul 18 2000 01:26:29 c2900XL-c3h2s-mz-120.5.2-XU.bin3 -rwx 105970 Jul 18 2000 01:26:29 c2900XL-diag-mz-120.5.2-XU4 drwx 6784 Jul 18 2000 01:26:30 html111 -rwx 720 Mar 01 1993 00:17:12 vlan.dat112 -rwx 286 Jan 01 1970 00:00:2
9、4 env_vars113 -rwx 1130 Mar 05 1993 16:56:45 config.sl114 -rwx 0 Mar 01 1993 00:00:49 config.text3612672 bytes total (833024 bytes free) 删除 VLANSwitch#conf tSwitch(config)#no vlan 2Deleting VLAN 2.Switch(config)#no vlan 3Deleting VLAN 3.Switch#delete flash:vlan.datDelete filename vlan.dat?Delete fla
10、sh:vlan.dat? confirm 配置 TRUNKSwitch(config)# int f0/5Switch(config-if)#switchport mode trunk 验证 TRUNK 配置Switch#show int f0/1 switchport 启动 VTPSwitch#conf tSwitch(config)#vtp domain ciscoSwitch(config)#vtp password ciscoSwitch(config)#vtp serverSwitch(config #vtp pruning 验证 VTP 配置Switch#show vtp stat
11、usSwitch#show vtp counters STP 生成树协议配置sl#sh spanVLAN0001Spanning tree enabled protocol ieeeRoot ID Priority 24577Address 0002.179A.87B9Cost 19Port 10(FastEthernet0/10)Hello Time 2 sec Max Age 20 sec Forward Delay 15 secBridge ID Priority 32769 (priority 32768 sys-id-ext 1)Address 0002.1705.C1C7Hello
12、 Time 2 sec Max Age 20 sec Forward Delay 15 secAging Time 20Interface Role Sts Cost Prio.Nbr Type- - - - - -Fa0/1 Desg FWD 19 128.1 P2pFa0/5 Altn BLK 19 128.5 P2pFa0/10 Root FWD 19 112.10 P2p改变生成树协议类型sl(config)#spanning-tree mode pvst设置交换机为根桥sl(config)#spanning-tree vlan 1 root primary改变交换机的优先级sl(co
13、nfig)#spanning-tree vlan 1 priority 4096改变端口的优先级值sl(config)#int f0/2sl(config-if)#spanning-tree vlan 1 port-priority 112sl#sh span datailVLAN0001 is executing the ieee compatible Spanning Tree ProtocolBridge Identifier has priority of 32768, sysid 1, 0002.1705.C1C7Configured hello time 2, max age 20
14、, forward delay 15Current root has priority 24577Root port is 10 (FastEthernet0/10), cost of root path is 19Topology change flag not set, detected flag not setNumber of topology changes 0 last change occurred 00:00:00 agofrom FastEthernet0/1Times: hold 1, topology change 35, notification 2hello 2, m
15、ax age 20, forward delay 15Timers: hello 0, topology change 0, notification 0, aging 300Port 5 (FastEthernet0/5) of VLAN0001 is designated blockingPort path cost 19, Port priority 128, Port Identifier 128.5Designated root has priority 112, address 000B.BEDC.400ADesignated bridge has priority 24577,
16、address 0002.179A.87B9Designated port id is 128.5, designated path cost 19Timers: message age 16, forward delay 0, hold 0Number of transitions to forwarding state: 1Link type is point-to-point by defaultPort 10 (FastEthernet0/10) of VLAN0001 is designated forwardingPort path cost 19, Port priority 1
17、12, Port Identifier 112.10Designated root has priority 112, address 000B.BEDC.400ADesignated bridge has priority 24577, address 0002.179A.87B9Designated port id is 112.10, designated path cost 19Timers: message age 16, forward delay 0, hold 0Number of transitions to forwarding state: 1Link type is p
18、oint-to-point 交换机密码恢复关闭交换机电源后,按着交换机 Mode 按钮再次打开电源The system has been interrupted prior to initializing theflash filesystem. The following commands will initializethe flash filesystem, and finish loading the operatingsystem software:flash_initload_helperbootswitch: flash_initInitializing Flash.flashf
19、s0: 167 files, 2 directoriesflashfs0: 0 orphaned files, 0 orphaned directoriesflashfs0: Total bytes: 3612672flashfs0: Bytes used: 3591680flashfs0: Bytes available: 20992flashfs0: flashfs fsck took 8 seconds.done Initializing Flash.Boot Sector Filesystem (bs:) installed, fsid: 3Parameter Block Filesy
20、stem (pb:) installed, fsid: 4switch: flash_initswitch: load_helperswitch: dir flash:Directory of flash:/2 drwx 704 html5 -rwx 1751867 c3500XL-c3h2s-mz.120-5.WC3b.bin17 -rwx 94375 c3500XL-hdiag-mz-120.5.3.WC.119 -rwx 804 vlan.dat21 -rwx 1253 config.textswitch: rename flash:config.text flash:config.ol
21、d switch: boot交换机重启后,出现提示:Continue with configuration dialog? yes/no:NswitchenableSwitch#rename flash:config.old flash:config.textDestination filename config.text?YSwitch#copy flash:config.text system:running-configDestination filename running-config? YSwitch#configure terminalSwitch(config)#no enab
22、le secretSwitch(config)#enable secret 新口令Switch(config)#ZSwitch#Switch#copy running-config startup-config 交换机 ios 恢复全过程关闭交换机电源后,按着交换机 Mode 按钮再次打开电源The system has been interrupted prior to initializing theflash filesystem. The following commands will initializethe flash filesystem, and finish loading
23、 the operatingsystem software:flash_initload_helperbootswitch: flash_initInitializing Flash.flashfs0: 167 files, 2 directoriesflashfs0: 0 orphaned files, 0 orphaned directoriesflashfs0: Total bytes: 3612672flashfs0: Bytes used: 3591680flashfs0: Bytes available: 20992flashfs0: flashfs fsck took 8 sec
24、onds.done Initializing Flash.Boot Sector Filesystem (bs:) installed, fsid: 3Parameter Block Filesystem (pb:) installed, fsid: 4switch: flash_initswitch: load_helper输入后无提示输入拷贝指令:switch: copy xmodem: flash:c3500xl-c3h2s-mz.120-5.wc5.bin出现如下提示:Begin the Xmodem or Xmodem-1K transfer now.系统提示不断出现 C 这个字母就可以开始传文件了点击超级终端菜单:传送-发送文件,在协议选项中选择 Xmodem 或者 Xmodem-1K 协议,然后选择 ios 的影像文件(*.bin),开始传送。因为不能改速率,所以传送得很慢,传送完毕后提示:File “xmodem:“ sUCcessfully copied to “flash:c3500xl-c3h2s-mz.120-5.wc5.bin“switch:在提示符下输入switch:boot 启用新的 ios 系统重新加电完成恢复工作。