交换机基本操作1. 进入特权模式Switch>enableSwitch#2. 返回用户模式Switch#exitPress RETURN to get started!Switch>配置模式:全局配置模式[主机名(c on fig)#]:配置交换机的整体参数 子模式:1.线路配置模式[主机名(co nfig-li ne)#]:配置交换机的线路参数2■接口配置模式[主机名(con fig-if)#]:配置交换机的接口参数1. 进入全局配置模式下Switch#configure terminalSwitch(config)#exitSwitch#2. 进入线路配置模式Switch(config)#line console 0Switch(config-line)#exitSwitch(config)#3. 进入接口配置模式Switch(config)#interface fastEthernet 0/1 Switch(config-if)#exitSwitch(config)#从子模式下直接返回特权模式Switch(config-if)#endSwitch#交换机操作帮助特点:1. 支持命令简写(按TAB键将命令补充完整)2. 在每种操作模式下直接输入“?”显示该模式下所有的命令3. 命令空格 “?”显示命令参数并对其解释说明4. 字符“?”显示以该字符开头的命令5. 命令历史缓存:(Ct rl + P)显示上一条命令,(Ct rl + N )显示下一条命令6. 错误提示信息交换机显示命令: 显示交换机硬件及软件的信息 Switch#show version 显示当前运行的配置参数 Switch#show running-config 显示保存的配置参数 Switch#show configure常用交换机EXEC命令将当前运行的配置参数复制到 flash:Switch#write memoryBuilding configuration...[OK]Switch#清空flash 中的配置参数:Switch#delete flash:config.textSwitch#交换机重新启动: Switch#reloadSystem configuration has been modified. Save? [yes/no]:nProceed with reload? [confirm]配置交换机主机名: Switch(config)#hostname S2126GS2126G(config)#配置交换机口令:1、 配置交换机的登陆密码S2126G(config)#enable secret level 1 0 star“0”表示输入的是明文形式的口令2、 配置交换机的特权密码S2126G(config)#enable secret level 15 0 Star“0”表示输入的是明文形式的口令常用交换机配置命令:1、 为交换机分配管理IP地址S2126G(config)#interface vlan 1S2126G(config-if)#ip address {IP address} {IP subnetmask}[secondary]2、 将接口启用S2126G(config-if)#no shutdown | undo shutdown3、 将接口关闭S2126G(config-if)#shutdown4、配置接口速率S2126G(config-if)#speed [10|100|auto]5、配置接口双工模式S2126G(config-if)#duplex [auto|full|half显示接口状态:S2126G#show interfaces测定目的端的可达性: S2126G>ping {IP address}从 TFTP 服务器下载配置参数:S2126G#copy tftp startup-config管理交换机MAC地址表:1 、查看 MAC 地址表S2126G#show mac-address-table2、 配置MAC地址表记录的生存时间(缺省为300秒)S2126G(config)#mac-address-table aging-time <10-1000000>3、 查看MAC地址表记录的生存时间S2126G#show mac-address-table aging-timeVLAN的配置:1. 添加一个 VLANS2126G(config)#vlan <1-4094>S2126G(config-vlan)#2. 为 VLAN 命名(可选)S2126G(config-vlan)#name computer department将交换机端口分配到 VLAN1. 配置 Port VLANSwitch(config-if)#switchport access vlan <1-4094>2. 配置 Tag VLANSwitch(config-if)#switchport mode trunk1) .配置本地(native)VLANSwitch(config-if)#switchport trunk native vlan <1-4094>2) .从主干链路中清除VLANSwitch(config-if)#switchport trunk allowed vlan except 5注:VLAN1不可被清除VLAN 的验证:1. 显示全部的 VLAN: Switch#show vlan2. 显示单独的 VLAN : Switch#show vian id v1-4094>将 VLAN 信息保存到 flash 中:Switch#write memory从 fiash 中清除 VLAN 信息: Switch#deiete fiash:vian.datRSTP 的配置:1. 启用生成树: S2126G(config)#spanning-tree2. 配置交换机优先级:S2126G(config)#spanning-tree priority v0-61440>“0” 或 “4096” 的倍数(RSTP BPDU 该值后 12bit 全 0)3. 配 置 交 换 机 端 口 优 先 级 : S2126G(config-if)#spanning-tree port-priority v0-240>“0”或“16”的倍数(RSTP BPDU该值后4bit全0)4、 生成树 hello 时间的配置(由 Root 决定): S2126G(config)#spanning-tree hello-time v1-10>5、 生成树的验证: Switch#show spanning-treeSwitch#show spa nnin g-t ree inter face < 接口名称〉< 接口编号〉 以上用于锐捷交换机的。