Stp Topology and Implement RSTP

The potential effect of a loop in the Layer 2 network is significant. Layer 2 loops could impact connected hosts as well as the network equipment. Layer 2 loops can be prevented by following good design practices and careful implementation of the Spanning Tree Protocol.

Switch#conf t
Switch(config)#hostname D1
D1(config)#spanning-tree mode pvst
D1(config)#banner motd ^ STP Topology Change and RSTP lab ^
D1(config)#line con 0
D1(config-line)#exec-timeout 0 0
D1(config-line)#logging synchronous 
D1(config-line)#exit
D1(config)#int range g1/0/1-3
D1(config-if-range)#switchport mode access 
D1(config-if-range)#switchport trunk
D1(config-if-range)#exit
D1(config)#vlan 2
D1(config-vlan)#name SecondVLAN
D1(config-vlan)#exit
D1(config)#
D1(config)#int vlan 1
D1(config-if)#ip add 10.0.0.1 255.0.0.0
D1(config-if)#no shut

D1(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

D1(config-if)#exit

D1#sh interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Gig1/0/1    on           802.1q         trunking      1
Gig1/0/2    on           802.1q         trunking      1
Gig1/0/3    on           802.1q         trunking      1

Port        Vlans allowed on trunk
Gig1/0/1    1-1005
Gig1/0/2    1-1005
Gig1/0/3    1-1005

Port        Vlans allowed and active in management domain
Gig1/0/1    1,2
Gig1/0/2    1,2
Gig1/0/3    1,2

Port        Vlans in spanning tree forwarding state and not pruned
Gig1/0/1    1,2
Gig1/0/2    1,2
Gig1/0/3    1,2

D1#

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname D2
D2(config)#banner motd ^ D2 Stp topology change and rstp lab ^
D2(config)#spanning-tree mode pvst 
D2(config)#line con 0
D2(config-line)#exec-timeout 0 0
D2(config-line)#logging synchronous 
D2(config-line)#exit
D2(config)#int range gig1/0/1-3
D2(config-if-range)#switchport mode access 
D2(config-if-range)#switchport mode trunk 

D2(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/3, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/3, changed state to up

D2(config-if-range)#no shut
D2(config-if-range)#exit
D2(config)#vlan 2
D2(config-vlan)#name SecondVLAN
D2(config-vlan)#exit
D2(config)#interface vlan 1
D2(config-if)#ip add 10.0.0.2 255.0.0.0
D2(config-if)#no shut

D2(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

D2(config-if)#exit

A1#sh version | include MAC
Base ethernet MAC Address       : 00:17:59:A7:51:80
A1#
D1#sh version | include MAC
Base ethernet MAC Address       : 00:0B:BE:41:E6:C6
D1#

D2#sh version | include MAC
Base ethernet MAC Address       : 00:E0:A3:09:23:60
D2#

D1#sh spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     000B.BE41.E6C6
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     000B.BE41.E6C6
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi1/0/1          Desg FWD 4         128.1    P2p
Gi1/0/2          Desg FWD 19        128.2    P2p
Gi1/0/3          Desg FWD 19        128.3    P2p

VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    32770
             Address     000B.BE41.E6C6
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     000B.BE41.E6C6
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi1/0/1          Desg FWD 4         128.1    P2p
Gi1/0/2          Desg FWD 19        128.2    P2p
Gi1/0/3          Desg FWD 19        128.3    P2p

D1#

sh spanning-tree root komutu örnek kullanımı

Last updated