资源描述
配置STP与VTP
环境:三台交换机,形成一个全互连结构,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的根桥;
初始化配置:
查看vlan信息àSw#show vlan
Sw#Delete vlan.dat 用此命令将vlan删除à
查看一下NVRAM是否保存了配置àSw#show startup-config
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上启用vtpàsw3(config)#vtp mode server 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的配置:
进入vlan数据库àsw1#vlan database
sw1(vlan)#vtp 启用VTP client模式àclient
Setting device to VTP CLIENT mode.
sw1(vlan)#vtp 作用到cisco域中àdomain cisco
Changing VTP domain name from NULL to cisco
设置密码与server端相同àsw1(vlan)#vtp password cisco
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的状态:
显示vtp状态àsw3#show vtp status
VTP Version : 2
配置修订号àConfiguration Revision : 0
Maximum VLANs supported locally : 254
Number of existing VLANs : 5
VTP Operating Mode : server vtp模式à
vtp域名àVTP Domain Name : cisco
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à
命名为aaàsw3(config-vlan)#name aa
sw3(config-vlan)#exit 应用配置à
创建VLAN20àsw3(config)#vlan 20
sw3(config-vlan)#name bb 命名为bbà
sw3(config-vlan)#exit
sw3(config)#
sw3的状态:
在sw3显示vtp的状态àsw3#show vtp status
VTP Version : 2
server的修订号àConfiguration Revision : 2
Maximum VLANs supported locally : 254
vlan也已经增加àNumber of existing VLANs : 7
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
已经同步了serveràConfiguration Revision : 2
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信息:
显示vlan信息àsw1#show 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
已经同步了vlan的信息à10 aa active
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
非vlan1的根桥àAddress 0007.eb06.1740
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
为vlan10的根桥àAddress 0030.803d.f641
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 非vlan10的根桥àPriority 4096
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 为vlan20的根桥àPriority 4096
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 为vlan1的根桥àPriority 24577
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 非vlan10的根桥àID Priority 4096
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 非vàPriority 4096 lan20的根桥
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
展开阅读全文