查看文章 |
从Trunk中添加、删除Vlan v 去除VLAN Switch (config-if )# switchport trunk allowed vlan remove vlan-list v 添加VLAN Switch (config-if)# switchport trunk allowed vlan add vlan-list v 检查中继端口允许VLAN的列表 Switch # show interface interface-id switchport
从Trunk中删除Vlan配置实例 SW1(config-if)#switchport trunk allowed vlan remove 2 SW1(config-if)#end SW1#show interface f0/24 switchport Name: Fa0/24 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none Administrative private-vlan host-association: none Administrative private-vlan mapping: none Operational private-vlan: none Trunking VLANs Enabled: 1,3-1005 Pruning VLANs Enabled: 2-1001 Capture Mode Disabled
使用show命令检查配置 v 查看端口状态 SW1#show interface interface-id switchport v 查看VLAN信息 SW1#show vlan brief v 查看配置 SW1#show run
VTP协议 v VLAN Trunk Protocol v 从一个控制点,维护整个企业网上VLAN的添加、删除和重命名工作
VTP 配置 v 创建VTP 域 switch(config)# vtp domian domain_name v 配置交换机的VTP模式 switch(config)# vtp mode server | client | transparent v 配置VTP口令 switch(config)# vtp password password v 配置VTP修剪 switch(config)# vtp pruning v VTP版本的配置 switch(config)# vtp version 2 v 查看VTP的配置 switch# show vtp status VTP配置实例 v 在SwA上配置VTP SwA(config)# vtp domain test Changing VTP domain name from null to test SwA(config)# vtp mode server Device mode already VTP SERVER. SwA(config)#interface fastEthernet 0/23 SwA(config-if)#switchport mode trunk
v 在SwB上配置VTP SwB(config)# vtp domain test Changing VTP domain name from null to test SwB(config)# vtp mode client Device mode already VTP CLIENT mode. SwB(config)#interface fastEthernet 0/22 SwB(config-if)#switchport mode trunk SwB(config)#interface fastEthernet 0/23 SwB(config-if)#switchport mode trunk
v 在SwA上添加VLAN SwA#vlan database SwA(vlan)#vlan 2 name sales VLAN 2 added: Name: sales SwA(vlan)#vlan 3 name develop VLAN 3 added: Name: develop SwA(vlan)#exit APPLY completed. Exiting....
v 在SwA的VLAN中添加端口 SwA(config)#interface range fastEthernet 0/2 - 3 SwA(config-if-range)#switchport access vlan 2 SwA(config)#interface range fastEthernet 0/4 - 5 SwA(config-if-range)#switchport access vlan 3
v 配置SwA的管理IP地址 SwA(config)#interface vlan 1 SwA(config-if)#ip address 192.168.1.1 255.255.255.0 SwA(config-if)#no shutdown v 在SwA上查看VLAN信息 SwA#show vlan brief
VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/15, Fa0/16 Fa0/17, Fa0/18, Fa0/19, Fa0/20 Fa0/21, Fa0/22, Fa0/24 2 sales active Fa0/2, Fa0/3 3 develop active Fa0/4, Fa0/5 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active
v 在SwA上查看VTP状态信息 SwA#show vtp status
VTP Version : 2 Configuration Revision : 2 Maximum VLANs supported locally : 64 Number of existing VLANs : 7 VTP Operating Mode : Server VTP Domain Name : test VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x34 0x9D 0xE1 0x18 0x50 0x 0xC1 0xD0 Configuration last modified by 192.168.1.1 at 7-27-06 11:27:16 Local updater ID is 192.168.1.1 on interface Vl1 (lowest numbered VLAN interface found) v 配置SwA的VTP口令 SwA(config)#vtp password cisco Setting device VLAN database password to cisco
v 修改SwA的VLAN配置,添加VLAN 4 SwA#vlan database SwA(vlan)#vlan 4 name market VLAN 4 added: Name: market SwA(vlan)#exit
v 配置SwB的VTP密码 SwB(config)#vtp password cisco Setting device VLAN database password to cisco v 在SwA上配置VTP修剪 SwA(config)#vtp pruning Pruning switched on
STP协议介绍 v STP - Spanning Tree Protocol(生成树协议) v 逻辑上断开环路,防止广播风暴的产生 v 当线路出现故障,断开的接口被激活,恢复通信,起备份线路的作用
STP的算法 v STP将一个环形网络生成无环拓朴的步骤: § 选择根网桥(Root Bridge) § 选择根端口(Root Ports) § 选择指定端口(Designated Ports)
选择根网桥的依据 v 网桥ID(BID) § 网桥ID是唯一的,交换机之间选择BID值最小的交换机作为网络中的根网桥 选择根端口的依据 v 在非根网桥上选择一个到根网桥最近的端口作为根端口 v 选择根端口的依据是: § 根路径成本最低 § 直连的网桥ID最小 § 端口ID最小 选择指定端口的依据 v 在每个网段上,选择1个指定端口 § 根桥上的端口全是指定端口 § 非根桥上的指定端口: • 根路径成本最低 • 端口所在的网桥的ID值较小 • 端口ID值较小 PVST的配置命令 v 启用生成树 Switch(config)#spanning-tree vlan vlan-list v 设置根网桥 Switch(config)#spanning-tree vlan vlan-list root primary | secondary v 修改网桥的优先级 Switch(config)#spanning-tree vlan vlan-list priority Bridge-priority v 修改端口成本 Switch(config-if)#spanning-tree vlan vlan-list cost cost v 修改端口优先级 Switch(config-if)#spanning-tree vlan vlan-list port-priority priority v 配置上行速链路 Switch(config)#spanning-tree uplinkfast v 配置端口速链路 Switch(config-if)#spanning-tree portfast v 查看生成树的配置 Switch#show spanning-tree v 查看某个VLAN的生成树详细信息 Switch#show spanning-tree vlan vlan-id detail
PVST配置实例 v 配置SwA为VLAN 1和2的根网桥 SwA(config)#spanning-tree vlan 1 root primary SwA(config)#spanning-tree vlan 2 root primary v 配置SwB在VLAN 3和4中优先级为4096 SwB(config)#spanning-tree vlan 3 priority 4096 SwB(config)#spanning-tree vlan 4 priority 4096 v 查看配置结果 SwB# show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 24577 Address 000d.28bf.4b40 Cost 19 Port 24 (FastEthernet0/24) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0013. Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300
Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/22 Altn BLK 19 128.22 P2p Fa0/23 Altn BLK 19 128.23 P2p Fa0/24 Root FWD 19 128.24 P2p v 配置交换机C上连接主机的端口为速端口 SwC(config)#interface range fastEthernet 0/1 - 20 SwC(config-if-range)#spanning-tree portfast %Warning: portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc... to this interface when portfast is enabled, can cause temporary bridging loops. Use with CAUTION %Portfast will be configured in 20 interfaces due to the range command but will only have effect when the interfaces are in a non-trunking mode. v 在交换机C上配置上行速链路 SwC(config)#spanning-tree uplinkfast
EthernetChannel(以太通道)
Switch(config-if-range)#channel-group 1 mode on Creating a port-channel interface Port-channel 1 |