环境:三台交换机,形成一个全互连结构, sw3 为 2950 , sw1 和 sw2 为 2900xl ; 要求:设置 sw3 为 VTP server, 设置 sw1 和 sw2 为 VTP client, 域名为 cisco ,密码为: cisco ,在 server 创建 vlan 10(name:aa) 和 vlan20(name:bb); 设置 sw3 为 vlan1 的根桥, sw1 为 vlan10 的根桥, sw2 为 vlan20 的根桥;
初始化配置: Sw# show vlan à 查看 vlan 信息 Sw# Delete vlan.dat à 用此命令将 vlan 删除 Sw# show startup-config à 查看一下 NVRAM 是否保存了配置 Sw# erase startup-config à 清空配置文件 Sw# reload à 重新启动交换机 sw>enable sw#config terminal sw(config)#hostname sw1 sw1(config)# no ip domain-lookup à 关闭域名查找 sw1(config)#line console 0 sw1(config-line)# logging synchronous à 命令输入达到同步 sw1(config-line)# exec-timeout 0 0 à 设置永不超时 sw1(config-line)#exit 步骤一、配置 VTP sw3 的配置: sw3(config)# vtp mode server à 在 sw3 上启用 vtp server Device mode already VTP SERVER. sw3(config)# vtp domain cisco à 设置域名 Changing VTP domain name from NULL to cisco sw3(config) #vtp password cisco à 设置密码 Setting device VLAN database password to cisco sw1 的配置 : sw1# vlan database à 进入 vlan 数据库 sw1(vlan)# vtp client à 启用 VTP client 模式 Setting device to VTP CLIENT mode. sw1(vlan)# vtp domain cisco à 作用到 cisco 域中 Changing VTP domain name from NULL to cisco sw1(vlan)# vtp password cisco à 设置密码与 server 端相同 Setting device VLAN database password to cisco. sw1(vlan)# exit à 使配置生效 In CLIENT state, no apply attempted. Exiting.... sw2 的配置 : sw2# vlan database sw2(vlan)# vtp client Setting device to VTP CLIENT mode. sw2(vlan)# vtp domain cisco Changing VTP domain name from NULL to cisco sw2(vlan)# vtp password cisco Setting device VLAN database password to cisco. sw2(vlan)# exit sw2# 步骤二、启用干道端口 sw3 的配置: sw3(config)#interface fa0/23 sw3(config-if)# switchport mode trunk à 启用 trunk 端口 sw3(config-if)#interface fa0/24 sw3(config-if)# switchport mode trunk sw1 的配置: sw1(config)#interface fa0/23 sw1(config-if)# switchport trunk encapsulation dot1q à 封装干道协议 sw1(config-if)# switchport mode trunk à 启用 trunk 模式 sw1(config-if)# sw1(config)#interface fa0/24 sw1(config-if)# switchport trunk encapsulation dot1q sw1(config-if)# switchport mode trunk sw2 的配置: sw2(config)#interface fa0/23 sw2(config-if)# switchport trunk encapsulation dot1q sw2(config-if)# switchport mode trunk sw2(config)#interface fa0/24 sw2(config-if)# switchport trunk encapsulation dot1q sw2(config-if)# switchport mode trunk 步骤三、测试 vtp 状态及创建 vlan sw3 的状态: sw3# show vtp status à 显示 vtp 状态 VTP Version : 2 Configuration Revision : 0 à 配置修订号 Maximum VLANs supported locally : 254 Number of existing VLANs : 5 VTP Operating Mode : server à vtp 模式 VTP Domain Name : cisco à vtp 域名 VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x3F 0x17 0xC8 0xB8 0x5A 0xE3 0x01 0x66 Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 创建 vlan: sw3(config)# vlan 10 à 创建 VLAN10 sw3(config-vlan)# name aa à 命名为 aa sw3(config-vlan)# exit à 应用配置 sw3(config)# vlan 20 à 创建 VLAN20 sw3(config-vlan)# name bb à 命名为 bb sw3(config-vlan)#exit sw3(config)# sw3 的状态: sw3# show vtp status à 在 sw3 显示 vtp 的状态 VTP Version : 2 Configuration Revision : 2 à server 的修订号 Maximum VLANs supported locally : 254 Number of existing VLANs : 7 à vlan 也已经增加 VTP Operating Mode : server VTP Domain Name : cisco VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x98 0x31 0xCF 0xA0 0xA7 0x17 0x73 0x66 Configuration last modified by 0.0.0.0 at 3-1-93 00:52:05 sw2 的状态: sw2# show vtp status VTP Version : 2 Configuration Revision : 2 à 已经同步了 server Maximum VLANs supported locally : 254 Number of existing VLANs : 7 VTP Operating Mode : Client VTP Domain Name : cisco VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x98 0x31 0xCF 0xA0 0xA7 0x17 0x73 0x66 Configuration last modified by 0.0.0.0 at 3-1-93 00:52:05 sw1 的 vlan 信息 : sw1# show vlan à 显示 vlan 信息 VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4, Fa0/5, 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/23, Fa0/24 10 aa active à 已经同步了 vlan 的信息 20 bb active 步骤四、配置 PVST sw3(config)# spanning-tree vlan 1 root primary à 设置为 vlan1 的根桥 Sw1(config)#spanning-tree vlan 10 priority 4096 à 设置为 vlan10 的根桥 Sw2(config)#spanning-tree vlan 20 priority 4096 à 设置为 vlan20 的根桥 步骤五、显示 STP 的信息 sw1 的生成树信息 : sw1# show spanning-tree brief à 显示每 VLAN 生成树信息 VLAN1 Spanning tree enabled protocol IEEE ROOT ID Priority 24577 Address 0007.eb06.1740 à 非 vlan1 的根桥 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32768 Address 0030.803d.f640 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec VLAN10 Spanning tree enabled protocol IEEE ROOT ID Priority 4096 Address 0030.803d.f641 à 为 vlan10 的根桥 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 4096 Address 0030.803d.f641 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec VLAN20 Spanning tree enabled protocol IEEE ROOT ID Priority 4096 Address 00b0.645f.34c2 à 非 vlan20 的根桥 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32768 Address 0030.803d.f642 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec sw2 的生成树信息 : sw2# show spanning-tree brief VLAN1 Spanning tree enabled protocol IEEE à 非 vlan1 的根桥 ROOT ID Priority 24577 Address 0007.eb06.1740 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32768 Address 00b0.645f.34c0 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec VLAN10 Spanning tree enabled protocol IEEE ROOT ID Priority 4096 à 非 vlan10 的根桥 Address 0030.803d.f641 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32768 Address 00b0.645f.34c1 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec VLAN20 Spanning tree enabled protocol IEEE ROOT ID Priority 4096 à 为 vlan20 的根桥 Address 00b0.645f.34c2 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 4096 Address 00b0.645f.34c2 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec sw3 的生成树信息 : sw3# show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 24577 à 为 vlan1 的根桥 Address 0007.eb06.1740 This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 24577 (priority 24576 sys-id-ext 1) Address 0007.eb06.1740 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 VLAN0010 Spanning tree enabled protocol ieee Root ID Priority 4096 à 非 vlan10 的根桥 Address 0030.803d.f641 Cost 19 Port 24 (FastEthernet0/24) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32779 (priority 32768 sys-id-ext 11) Address 0007.eb06.1740 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 VLAN0020 Spanning tree enabled protocol ieee Root ID Priority 4096 à 非 vlan20 的根桥 Address 00b0.645f.34c2 Cost 19 Port 23 (FastEthernet0/23) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32780 (priority 32768 sys-id-ext 12) Address 0007.eb06.1740 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/23 Root FWD 19 128.23 P2p Fa0/24 Altn BLK 19 128.24 P2p 步骤六、显示当前配置结果 Sw1 的配置结果: sw1#show running-config ! hostname sw1 ! spanning-tree vlan 10 priority 4096 ! no ip domain-lookup ! interface FastEthernet0/23 switchport trunk encapsulation dot1q switchport mode trunk interface FastEthernet0/24 switchport trunk encapsulation dot1q switchport mode trunk ! end sw2 的配置结果: sw2#show running-config hostname sw2 ! spanning-tree vlan 20 priority 4096 ! no ip domain-lookup ! interface FastEthernet0/23 switchport trunk encapsulation dot1q switchport mode trunk ! interface FastEthernet0/24 switchport trunk encapsulation dot1q switchport mode trunk ! end sw3 的配置结果: sw3#show running-config ! hostname sw3 ! no ip domain-lookup ! spanning-tree vlan 1 priority 24576 ! interface FastEthernet0/23 switchport mode trunk ! interface FastEthernet0/24 switchport mode trunk ! End |