、交换机部分
1. 创建、删除VLAN 注意:在配置状态(config)下进行配置。 创建vlan : Switch(config)#vlan vlan-id 命名 vlan: Switch(config-vlan)#vlan-name 或者在database状态下创建并且命名vlan: Switch#vlan database Switch#(vlan)vlan vlan-id name vlan-name 删除vlan: Switch(config-vlan):no vlan vlan-id Switch(vlan)#no vlan vlan-id 查看 vlan: Switch#show vlan Switch#show vlan brief 保存设置: Switch#copy running-config startup-config
2. 在vlan中添加、删除端口 注意:进入要分配的端口,在端口状态下。 定义二层端口: Switch(config-if)# Switch(config)#switichport mode access 把端口分配给vlan: Switch(config-if)#switchport access vlan vlan-id 查看端口的vlan 配置情况: Switch#show interface interface-id switchport
3. 在交换机上配置trunk 注意:在接口状态一进行配置。 自动协商是否成为中继端口: Switch(config-if)#switchport mode dynamic auto 把端口设置为中继端口进行主动协商: Switch(config-if)#switchport mode dynamic desirable 把端口设置为强制中继端口: Switch(config-if)#switchport mode dynamic trunk 把端口设定为永久中继模式,但关闭协商机制: Switch(config-if)#switchport nonegotiate 查看有关switchport的设置: Switch#show interface interface—id switchport
4.从Trunk中添加,删除VLAN 注意:在断口配置状态下进行配置,并且端口是中继状态。 将端口配置为中继端口: Switch(config-if)#switchport mode trunk 在Trunk中删除一个VLAN: Switch(config-if)#switchport trunk allowed vlan remore vlan—id 在Trunk中天家一个VLAN Switch(config-if)#switchport trunk allowed vlan add vlan—id
5.在交换机上配置Channel(以太网通道): 注意:在接口模式下配置,并且配置Channel的接口必须是相连的,通道两边要在同一个组中。 如果使用PAgP协议: 选择需要配置Channel的端口,进入虚拟接口配置: Switch(config-if)#interface range fasternet0/1-2 被动协商配置Channel: Switch(config-if)#channel-group channel-group-number mode auto 主动协商配置Channel: Switch(config-if)#channel-group channel-group-number mode on 如果使用LACP协议,配置如下: 被动协商配置: Switch(config-if)#channel-group channel-group-number mode passive Switch(config-if)#channel-group channel-group-number mode active 查看Channel配置: Switch#show etherchannel channel-group-number summary
6.指定在组成Channel的链路之间实现负载均衡技术: 注意:dst-mac,src-mac参数用来指定基于目的mac还是源mac实现负载均衡。 在已经组成的Channel中实现基于目的地址的负载均衡: Switch(config-if)#port-channel load-balance dst-mac 在已经组成的Channel中实现基于源地址的负载均衡: Switch(config-if)#port-channel load-balance src-mac 查看负载均衡的配制: Switch#show pagp channelgroup-number counters
7.创建VTP域和配置命令: 注意:在培植状态下。 创建一个VTP域: Switch(config-if)#vtp domain domain-name 配置VTP服务器模式: Switch(config)#vtp mode server 配置VTP客户端模式: Switch(config)#vtp mode client 配置VTP 透明模式: Switch(config)#vtp mode transparent 配置VTP域口令: Switch(config)#vtp password mypassword 在整个域内启动VTP修剪: Switch(config)#vtp pruning 从可修建列表中去除VLAN: Switch(config)#switchport trunk pruning vlan remore vlan-id 查看VTP的修剪配置: Switch#show vtp status Switch#show interface interface-id switchport VTP 版本的配置(默认情况下使用的是version1): Switch(config)#vtp version 2
8.Spanning-tree的配置: 注意:在配置模式下操作: 在VLAN上启动生成树: Switch(config-if)#spanning-tree vlan vlan-id 查看Spanning-tree的详细状态信息: Switch#show spanning-tree vlan vlan-id detail 使用命令建立根网桥: Switch(config)#spanning-tree vlan vlan-id root primary 使用命令建立备用网桥(当根桥故障的时候,自动生成根桥): Switch(config)#spanning-tree vlan vlan-id root secondary 使用命令修改优先级配置根网桥(取值范围0-65535): Switch(config)#spanning-tree vlan vlan-id priority bridge-priority 在接口模式下使用命令修改端口成本(取值范围0-200000000,如果不指定VLAN则修改所 有VLAN的端口成本): Switch(config-if)#spanning-tree vlan vlan-id cost cost 在借口模式下使用命令修改端口优先级(取值范围0-255): Switch(config-if)#spanning-tree vlan vlan-id port-priority priority 查看配置: Switch#show spanning-tree interface interface-id detail
9.修改Spanning-tree记时器: 注意:在配置模式下修改。 修改HELLO时间(缺省2秒,最大10秒): Switch(config)#spanning-tree vlan vlan-id hello-time seconds 修改转发延迟记时器(缺省15秒,取值范围4-30): Switch(config)#spanning-tree vlan vlan-id forward-time seconds |
|