常用交换机命令 8. 查看命令show switch> enable switch# show version 察看系统中的所有版本信息 show interface vlan 1 查看交换机有关ip 协议的配置信息 show running-configure 查看交换机当前起作用的配置信息 show interface fastethernet 0/1 察看交换机1接口具体配置和统计信息 show mac-address-table 查看mac地址表 show mac-address-table aging-time 查看mac地址表自动老化时间 9. 交换机恢复出厂默认恢复命令 switch> enable switch# erase startup-configure switch# reload 10. 双工模式设置(设置双工之前,需先设置speed) switch> enable switch#configure terminal switch(conf)#hostname aptch-2950 aptech2950(conf)# interface fastehernet 0/17 以17端口为例 aptech2950(conf-if)#duplex full/half/auto 有full , half, auto 三个可选项 11. cdp相关命令 switch> enable switch# show cdp 查看设备的cdp全局配置信息 show cdp interface fastethernet 0/17 查看17端口的cdp配置信息 show cdp traffic 查看有关cdp包的统计信息 show cdp nerghbors 列出与设备相连的cisco设备 12. csico2950的密码恢复 拔下交换机电源线。 用手按着交换机的MODE键,插上电源线 在switch:后执行flash_ini命令:switch: flash_ini 查看flash中的文件: switch: dir flash: 把“config.text”文件改名为“config.old”: switch: rename flash: config.text flash: config.old 执行boot: switch: boot 交换机进入是否进入配置的对话,执行no : 进入特权模式查看flash里的文件: show flash : 把“config.old”文件改名为 “config.text”: switch: rename flash: config.old flash: config.text 把“config.text”拷入系统的“running-configure”: copy flash: config.text system : running-configure 重新设置密码,并保存配置到startup-config,密码恢复成功。 13. 交换机telnet远程登录设置: switch>en switch#configure terminal switch(conf)#hostname aptech-2950 aptech2950(conf)#enable password cisco 以cisco为特权模式密码 aptech2950(conf)#interface vlan 1 进入用于管理的vlan 1 aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 给管理vlan配置IP地址 aptech2950(conf-if)#no shut aptech2950(conf-if)#exit aptech2950(conf)#ip default-gateway 192.168.1.254 设置交换机的网关 aptech2950(conf)line vty 0 15 设置0-15 个用户可以telnet远程登陆 aptech2950(conf-line)#password 123 123为telnet登录时的密码 aptech2950(conf-line)#login login表明启动验证 主机设置: ip 192.168.1.2 主机的ip必须和交换机的地址在同一网络段 netmask 255.255.255.0 gate-way 192.168.1.254 运行: telnet 192.168.1.1 进入telnet远程登录界面 password : 123 aptech2950> 14. 交换机配置的重新载入和保存 设置完成交换机的配置后: aptech2950(conf)#reload 是否保存(y/n) y: 保存设置信息 n:不保存设置信息 15. 例:把交换机的5~10口添加到VLAN 2中。 Switch# vlan database Switch(vlan)# vlan2 name v2 Switch(vlan)#exit Switch# configure terminal Switch(config)# interface range f0/5 – 10 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 2 Switch(config-if-range)# end Switch# show vlan brief 16. 例:创建VLAN 2,并把端口1加入VLAN 2。 Switch# config terminal Switch(config)# vlan 20 Switch(config-vlan) # name test20 Switch(config-vlan)# end Switch# configure terminal Switch(config)# interface fastethernet0/1 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 2 Switch(config-if)# end Switch# show vlan id 2 |