1. 基本配置命令
Switch (config)#hostname XXX 设置交换机主机名为XXX
Switch(config)exec-timeout 0 0 阻止会话退出
2. 使用Telnet远程管理
3. 控制台口令
4. Cisco发现协议(CDP)
Switch(config)#show cdp 显示Cisco设备全局配置信息
Switch(config)#show cdp interface 端口 查看CDP配置下端口信息
Switch(config)#show cdp neighbors 显示直连Cisco设备信息
5. 恢复出厂配置
6. 配置接口标识, 用于区分交换机,路由器的各个接口
switch(config)#interface fastethernet 0/1 以0/1 接口为例
switch(config)# description toMill2 端口描述为“到二厂”
7. Vtp配置
switch(config)#vtp mode server /client/transparent 设置vtp服务器模式
8. Vlan基本配置
Switch#vlan database 进入vlan配置模式
Switch(vlan)#vlan 号码 name 名称 创建vlan及vlan名
Switch(vlan)#vlan号码 mtu数值 修改MTU大小
Switch(vlan)#exit 更新vlan数据并退出
Switch#show vlan 查看验证
Switch#copy running-config startup-config 保存配置
9. VLAN 中添加 删除端口
Switch#config terminal 进入全局配置
Switch(config-if)#Switchport mode access 定义access端口,也就是二层端口
Switch(config-if)#switchport mode trunk 设置端口为trunk口(干线)
Switch(config-if)#switchport trunk encapsulation dot1q 设置vlan 中继协议(cisco 2960系列默认使用802.1q协议封装)
Switch(config-if)#no switchport mode 或 ( switchport mode access) 禁用干线
Switch(config-if)#switchport trunk allowed vlan add 1,2 从Trunk中添加vlan
Switch(config-if)#switchport trunk allowed vlan remove 1,2 从Trunk中删除vlan
Switch(config-if)#switchport trunk pruning vlan remove 1,2 ; 从Trunk中关闭局部修剪
Switch#show vlan brief 查看所有vlan信息
10. 查看trunk协议
Switch#show int trunk 查看trunk端口
Trunk
switch(config)#interface range fasternet0/1 - 2 将fasternet0/1和0/2 口捆绑
switch(config-if)#channel-group 1 mode on 配置以太通道模式
switch(config-if)#port-channel load-balance {dst-mac | src-mac}在链路间实现负载均衡
switch#show etherchannel 1 summary 查看通道信息
12. 交换机显示命令:
13. 生成树协议spanning-tree protocol
Switch(config-if)#spanning-tree portfast 配置速端口(连接终端设备的端口状态)如pc机
Switch#show spanning-tree vlan <vlan-id> detail 浏览详细生成树配置信息
Switch#show spanning-tree interface <int-id> detail 浏览详细生成树端口配置信息