生成树的详细配置及实验1.docx
《生成树的详细配置及实验1.docx》由会员分享,可在线阅读,更多相关《生成树的详细配置及实验1.docx(15页珍藏版)》请在冰豆网上搜索。

生成树的详细配置及实验1
STP及其优化
实验拓扑图:
实验步骤:
1.设置SW1,SW2,SW3主机名分别为Core1,Core2,ED-SW
2.把Core1与Core2间的两条链路绑定成etherchannel2,并设置成Trunkmode
Core1:
interfacerangefa0/23-24
switchporttrunkencapsulationdot1q //支持ISL及dot1Q的交换机必须设置trunk的封装协议。
低端的C2950,C2960,C2918只支持dot1Q,无此命令。
switchmodetrunk //接口设置为Trunk模式。
channel-group2modeon //接口加入Etherchannel2。
Creatingaport-channelinterfacePort-channel2
//系统提示自动创建port-channel2。
interfacePort-channel2 //Port-channel2接口配置必须同物理接口一致。
switchporttrunkencapsulationdot1q
switchportmodetrunk
Core2:
interfacerangefa0/23-24
switchporttrunkencapsulationdot1q
switchmodetrunk
channel-group2modeon
Creatingaport-channelinterfacePort-channel2
interfacePort-channel2
switchporttrunkencapsulationdot1q
switchportmodetrunk
3.验证etherchannel设置
Core1#shetherchannelsummary //显示etherchannel的详细信息
Flags:
D-down P-inport-channel
I-stand-alones-suspended
H-Hot-standby(LACPonly)
R-Layer3 S-Layer2
U-inuse f-failedtoallocateaggregator
u-unsuitableforbundling
w-waitingtobeaggregated
d-defaultport
Numberofchannel-groupsinuse:
1 //目前已经建好1个etherchannel。
Numberofaggregators:
1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
2 Po2(SU) - fa0/23(P) fa0/24(P) //S-Layer2 U-inuseP-inport-channel
4.Core1,Core2,ED-SW间的所有链路均设置成Trunk
ED-SW:
intrangef0/23–24
noshutdown
switchportmodetrunk
Core1:
intf0/21
switchtrunkencapdot1q
switchmodetrunk
Core2:
intf0/21
switchtrunkencapdot1q
switchmodetrunk
5.验证etherchannel设置
Core2#showinterfacetrunk
Port Mode Encapsulation Status Nativevlan
Fa0/21 on 802.1q trunking 1 //F0/21,Trunk模式为ON,封装为802.1q,目前已经形成Trunking,nativevlan为vlan1。
Po2 on 802.1q trunking 1
Port Vlansallowedontrunk
Fa0/21 1-4094 //此Trunk允许所有的vlan流量通过。
Po2 1-4094
Port Vlansallowedandactiveinmanagementdomain
Fa0/21 1 //此交换域只有vlan1是活动的vlan。
因为现在无其他vlan
Po2 1
Port Vlansinspanningtreeforwardingstateandnotpruned
Fa0/21 1 //Vlan没有被vtp修剪
Po2 1
6.添加vlan1-10,奇数vlan生成树根选择Core1,偶数vlan生成树根选择Core2
Core1,Core2,ED-SW:
vlan2 //添加vlan2
nametestvlan2 //命名vlan2为testvlan2
vlan3
nametestvlan3
vlan4
nametestvlan4
vlan5
nametestvlan5
vlan6
nametestvlan6
vlan7
nametestvlan7
vlan8
nametestvlan8
vlan9
nametestvlan9
vlan10
nametestvlan10
7.验证新添加的vlan
Core1#shvlanbrief //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/22,Gi0/1,Gi0/2
//这些端口默认划分到vlan1,注意Fa0/21,23,24不在这里,因为这3个端口做成了Trunk
2 testvlan2 active
――――部分输出忽略――――――
9 testvlan9 active
10 testvlan10 active
1002fddi-default act/unsup //这些为特殊vlan,现在基本不用
1003token-ring-default act/unsup
8.验证新添加的vlan
Core1#shspanning-tree
VLAN0001
Spanningtreeenabledprotocolieee //Spanning-tree为ieee标准
RootID Priority 32769 //此交换机vlan1的优先级=默认32728+vlan的标号,则vlan2为32768+2,其他vlan类似。
Address 000d.65dc.8800 //交换机MAC
Thisbridgeistheroot //此交换机已经成为valn1的root,默认情况一台交换机成为所有vlan的root
HelloTime2sec MaxAge20sec ForwardDelay15sec
BridgeID Priority 32769 (priority32768sys-id-ext1)
Address 000d.65dc.8800
HelloTime 2sec MaxAge20sec ForwardDelay15sec
AgingTime300
Interface Role Sts Cost Prio.Nbr Type
---------------- ------- ----------------- --------------------------------
Fa0/4 Desg FWD 19 128.4 P2p
Fa0/21 Desg FWD 19 128.21 P2p //F0/21为指定端口,处于转发状态,STPCost为19
Po2 Desg FWD 12 128.65 P2p
VLAN0002
Spanningtreeenabledprotocolieee
RootID Priority 32770
Address 000d.65dc.8800
Thisbridgeistheroot
HelloTime 2sec MaxAge20sec ForwardDelay15sec
BridgeID Priority 32770 (priority32768sys-id-ext2)
Address 000d.65dc.8800
HelloTime 2sec MaxAge20sec ForwardDelay15sec
AgingTime300
Interface RoleStsCost Prio.NbrType
------------------------------------------------------------------------
Fa0/21 DesgFWD19 128.21 P2p
Po2 DesgFWD12 128.65 P2p
9.设置Core1为vlan1,3,5,7,9的主根
作为vlan2,4,6,8,10的次根
设置Core2为vlan2,4,6,8,10的主根
作为vlan1,3,5,7,9的次根
Core1:
spanning-treevlan1,3,5,7,9rootprimary
spanning-treevlan2,4,6,8,10rootsecondary
Core2:
spanning-treevlan1,3,5,7,9rootsecondary
spanning-treevlan2,4,6,8,10rootprimary
10.验证根配置
Core1#shspanning-tree
VLAN0001
Spanningtreeenabledprotocolieee
RootID Priority 24577
Address 000d.65dc.8800
Thisbridgeistheroot
HelloTime 2sec MaxAge20sec ForwardDelay15sec
BridgeID Priority 24577 (priority24576sys-id-ext1)
Address 000d.65dc.8800
HelloTime 2sec MaxAge20sec ForwardDelay15sec
AgingTime300
Interface RoleStsCost Prio.NbrType
------------------------------------------------------------------------
Fa0/4 DesgFWD19 128.4 P2p
Fa0/21 DesgFWD19 128.21 P2p
Po2 DesgFWD12 128.65 P2p
VLAN0002
Spanningtreeenabledprotocolieee
RootID Priority 24578 //根网桥优先级及MAC,vlan2的根已经变成了Core2
Address 0013.80e2.4880
Cost 12
Port 65(Port-channel2)
HelloTime 2sec MaxAge20sec ForwardDelay15sec
BridgeID Priority 28674 (priority28672sys-id-ext2) 本网桥优先级及MAC地址
Address 000d.65dc.8800
HelloTime 2sec MaxAge20sec ForwardDelay15sec
AgingTime300
Interface RoleStsCost Prio.NbrType
------------------------------------------------------------------------
Fa0/21 DesgFWD19 128.21 P2p
Po2 RootFWD12 128.65 P2p //指定端口变成了根端口
Core1#shrun
spanning-treemodepvst //生成树模式,默认为PVST
spanning-treevlan1,3,5,9priority24576
spanning-treevlan2,4,6,8,10priority28672 //命令被自动转换,也可以直接使用此命令
11.把PC接入到ED-SW的Fa0/2,并记录端口指示灯转换到绿色的时间___S
为了解决交换机端口转发延迟问题,启用Fa0/2的portfast功能
ED-SW:
ed-sw(config-if)#spanning-treeportfast
%Warning:
portfastshouldonlybeenabledonportsconnectedtoasingle
host.Connectinghubs,concentrators,switches,bridges,etc...tothis
interface whenportfastisenabled,cancausetemporarybridgingloops.
UsewithCAUTION
//告警信息,建议启用了portfast功能的接口只连接单台主机,接其他设备可能会发生环路
%PortfasthasbeenconfiguredonFastEthernet0/2butwillonly
haveeffectwhentheinterfaceisinanon-trunkingmode.
//Portfast功能只在非Trunk模式下生效
注:
也可以在全局模式下输入spanning-treeportfastdefault启用所有的端口portfast功能
12.重新插拔PC与ED-SW的网线,再次记录端口指示灯转换到绿色的时间__S
验证portfast已经在Fa0/2口上启用
ed-sw#shspanning-treeinterfacef0/2portfast
VLAN0001 enabled
13.配置PCIP地址:
192.168.88.203/24
配置Core1Vlan1IP地址:
192.168.88.201/24
配置Core2Vlan1IP地址:
192.168.88.202/24
Core1:
interfaceVlan1
ipaddress192.168.88.201255.255.255.0
noshut
end
Core2:
interfaceVlan1
ipaddress192.168.88.202255.255.255.0
noshut
end
14.在PC的DOS命令行下:
ping192.168.88.201-t //不停的Ping192.168.88.201
断掉ED-SW到Core1的连接,记录ping包丢失了___个
15.在ED-SW上配置uplinkfast
ed-sw(config)#spanning-treeuplinkfast
16.验证uplinkfast
ed-sw#shspanning-treeuplinkfast
UplinkFastisenabled
17.在PC的DOS命令行下:
ping192.168.88.201-t //不停的Ping192.168.88.201
断掉ED-SW到Core1的连接,记录ping包丢失了__个
18.取消ED-SW的uplinkfast功能
ed-sw(config)#nospanning-treeuplinkfast
19.启用Core1,Core2,ED-SW的RSTP功能
Core1,Core2,ED-SW:
(Config)#spanning-treemoderapid-pvst
20.验证RSTP是否启用
ed-sw#shspanning-tree
VLAN0001
Spanningtreeenabledprotocolrstp //生成树模式
RootID Priority 24577
Address 000d.65dc.8800
Cost 19
Port 23(FastEthernet0/23)
HelloTime 2sec MaxAge20sec ForwardDelay15sec
BridgeID Priority 32769 (priority32768sys-id-ext1)
Address 000d.bdbb.7480
HelloTime 2sec MaxAge20sec ForwardDelay15sec
AgingTime300
Interface RoleStsCost Prio.NbrType
------------------------------------------------------------------------
Fa0/2 DesgFWD19 128.2 EdgeP2p //边缘端口
Fa0/4 DesgBLK19 128.4 P2p
Fa0/23 RootFWD19 128.23 P2p
Fa0/24 AltnBLK19 128.24 P2p //被阻塞的端口
VLAN0002
Spanningtreeenabledprotocolrstp
RootID Priority 24578
Address 0013.80e2.4880
Cost 19
Port 24(FastEthernet0/24)
HelloTime 2sec MaxAge20sec ForwardDelay15sec
BridgeID Priority 32770 (priority32768sys-id-ext2)
Address 000d.bdbb.7480
HelloTime 2sec MaxAge20sec ForwardDelay15sec
AgingTime300
Interface RoleStsCost Prio.NbrType
------------------------------------------------------------------------
Fa0/23 AltnBLK19 128.23 P2p
Fa0/24 RootFWD19 128.24 P2p
在PC的DOS命令行下:
ping192.168.88.201-t //不停的Ping192.168.88.201
断掉ED-SW到Core1的连接,记录ping包丢失了__个
21.配置MST
Core1,Core2,ED-SW上启用两个MSTInstance1,2
Vlan1,3,5,7,9映射到Instance1
Vlan2,4,6,8,10映射到Instance