Lab 1.2 PVST

root

Leader IT/Architect
Dec 31, 2012
1,153
72
48
I. Sơ đồ
1. Sơ đồ



2. Yêu cầu
- Đảm bảo tất cả các SW chạy PVST (mặc định hầu hết các Switch Cisco đã chạy)
- Tạo VLAN 10,20,30 trên tất cả các SW
- Cấu hình SW1 làm root bridge cho VLAN 10
- Cấu hình SW2 làm root bridge cho VLAN 20
- Cấu hình SW3 làm root bridge cho VLAN 30
- Thay đổi cost để đường đi từ SW2 -> SW1 thành SW2 -> SW3 -> SW1 trên VLAN 10
- Thay đổi port priority để e0/3 chuyển từ blocking -> forwarding
- Đảm bảo gói tin BPDU trên VLAN 20 được gửi ra mỗi giây
- Đảm bảo SW phát hiện ra lỗi trên VLAN 30 nếu sau 6s mà nó không nhận được gói tin BPDU

II. Triển khai
1. Cấu hình VLAN, trunk, root bridge
- Trên SW1: Tạo VLAN, cấu hình port trunk và đưa SW1 làm root bridge cho VLAN 10

SW1(config-vlan)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#vlan 30

SW1(config-if)#int e0/0
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#int e0/1
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#int e0/2
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#int e0/3
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk

SW1(config)#spanning-tree vlan 10 root primary

- Trên SW2: Tạo VLAN, cấu hình port trunk và đưa SW1 làm root bridge cho VLAN 20

SW2(config-vlan)#vlan 10
SW2(config-vlan)#vlan 20
SW2(config-vlan)#vlan 30

SW2(config-if)#int e0/0
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#int e0/1
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#int e1/2
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#int e1/3
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk

SW2(config)#spanning-tree vlan 20 root primary

- Trên SW3: Tạo VLAN, cấu hình port trunk và đưa SW1 làm root bridge cho VLAN 30

SW3(config-vlan)#vlan 10
SW3(config-vlan)#vlan 20
SW3(config-vlan)#vlan 30

SW3(config-if)#int e0/2
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config-if)#int e0/3
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config-if)#int e1/2
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config-if)#int e1/3
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk

SW3(config)#spanning-tree vlan 30 root primary

- Xem lại kết quả cấu hình

SW1#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address aabb.cc00.0100
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec

Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/0 Desg FWD 100 128.1 Shr
Et0/1 Desg FWD 100 128.2 Shr
Et0/2 Desg FWD 100 128.3 Shr
Et0/3 Desg FWD 100 128.4 Shr
- Trên SW2

SW2#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
Cost 100
Port 1 (Ethernet0/0)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address aabb.cc00.0200
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec

Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/0 Root FWD 100 128.1 Shr
Et0/1 Altn BLK 100 128.2 Shr
Et1/2 Desg FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr
- Trên SW3

SW3#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
Cost 100
Port 3 (Ethernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address aabb.cc00.0300
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec

Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2 Root FWD 100 128.3 Shr
Et0/3 Altn BLK 100 128.4 Shr
Et1/2 Altn BLK 100 128.7 Shr
Et1/3 Altn BLK 100 128.8 Shr
 
2. Cấu hình path cost
- Ở kết quả show spanning-tree vlan 10 trên các Switch ở trên các bạn thấy khi có 1 host cắm vào SW2 nó sẽ đi đến SW2 -> SW1. Vì các port trên SW3 nối giữa SW2 và SW3 đã bị block do có STP.
- Theo yêu cầu bây giờ chúng ta cần phải cấu hình lại để host cắm vào SW2 sẽ đi đến SW2 -> SW3 -> SW1. Và chúng ta chỉ được chính path cost, mà path cost trên các port là giống nhau đều = 100. Nên để SW2 -> SW3 -> SW1 chúng ta phải chính path cost từ SW2 -> SW1 cao hơn

SW2(config)#int range e0/0 - 1
SW2(config-if-range)#spanning-tree vlan 10 cost 500

- Bây giờ Show spanning-tree vlan 10 trên SW2 và SW3 để xem kết quả
- Trên SW2

SW2#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
Cost 200
Port 7 (Ethernet1/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address aabb.cc00.0200
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/0 Altn BLK 500 128.1 Shr
Et0/1 Altn BLK 500 128.2 Shr
Et1/2 Root FWD 100 128.7 Shr
Et1/3 Altn BLK 100 128.8 Shr
- Trên SW3

SW3#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
Cost 100
Port 3 (Ethernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address aabb.cc00.0300
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2 Root FWD 100 128.3 Shr
Et0/3 Altn BLK 100 128.4 Shr
Et1/2 Desg FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr
- Như vầy là đường đi từ SW2(e1/2) -> SW3 (e0/2) -> SW1 (e0/2)
 
3. Cấu hình port priority
- Theo kết quả "show spanning-tree vlan 10" trên SW3 cho thấy port e0/3 đang bị block do STP. Bây giờ chúng ta sẽ cấu hình để e0/3 chuyển sang trạng thái forwarding để kết nối với root bridge.
- Show spanning-tree vlan 10 và các bạn để ý thấy port priority trên e0/2 và e0/3 của SW1 đều = 128

SW1#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address aabb.cc00.0100
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/0 Desg FWD 100 128.1 Shr
Et0/1 Desg FWD 100 128.2 Shr
Et0/2 Desg FWD 100 128.3 Shr
Et0/3 Desg FWD 100 128.4 Shr
- Để đưa e0/3 trên SW3 chuyển từ blocking -> forwarding các bạn cần cấu hình để port priority trên interface hàng xóm ("show cdp neighber" đó là e0/2 và e0/3 của SW1) với nó phải nhỏ hơn cái kia.
- Bây giờ mình sẽ chính port priority trên e0/2 cho nó lớn hơn e0/3

SW1(config-if)#spanning-tree vlan 10 port-priority 192

- Kiểm tra lại port priority trên SW1 các bạn sẽ thấy e0/2 đã có priority 192 > 128 (e0/3)

SW1#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 24586 (priority 24576 sys-id-ext 10)
Address aabb.cc00.0100
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/0 Desg FWD 100 128.1 Shr
Et0/1 Desg FWD 100 128.2 Shr
Et0/2 Desg FWD 100 192.3 Shr
Et0/3 Desg FWD 100 128.4 Shr
- Kiểm tra trên SW3 các bạn thấy kết quả là e0/3 đã chuyển sang trạng thái forwarding và e0/2 chuyển thành blocking

SW3#sh spanning-tree vlan 10


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
Cost 100
Port 4 (Ethernet0/3)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address aabb.cc00.0300
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2 Altn BLK 100 128.3 Shr
Et0/3 Root FWD 100 128.4 Shr
Et1/2 Desg FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr
 
4. Hello time
- Đảm bảo gói tin BPDU được gửi ra mỗi giây trên VLAN 20. Mặc định thì 2s nó gửi ra 1 lần và chỉ có root bridge mới gửi gói tin BPDU nên bạn chỉ cần cấu hình trên SW2 (root bridge của VLAN 20)

SW2(config)#spanning-tree vlan 20 hello-time 1

- Kiểm tra

SW2#sh spanning-tree vlan 20


VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 24596
Address aabb.cc00.0200
This bridge is the root
Hello Time 1 sec Max Age 20 sec Forward Delay 15 sec


Bridge ID Priority 24596 (priority 24576 sys-id-ext 20)
Address aabb.cc00.0200
Hello Time 1 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/0 Desg FWD 500 128.1 Shr
Et0/1 Desg FWD 500 128.2 Shr
Et1/2 Desg FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr
5. Max-age
- Để đảm SW có thể phát hiện lỗi nếu trong vòng 6s SW không nhận được gói tin BPDU nào trên VLAN 30. Các bạn có thể cấu hình max-age thành 6s mặc định là 20s và thực hiện trên tất cả các SW

SW1(config)#spanning-tree vlan 30 max-age 6

SW2(config)#spanning-tree vlan 30 max-age 6

SW3(config)#spanning-tree vlan 30 max-age 6

- Kiểm tra

SW3#sh spanning-tree vlan 30


VLAN0030
Spanning tree enabled protocol ieee
Root ID Priority 24606
Address aabb.cc00.0300
This bridge is the root
Hello Time 2 sec Max Age 6 sec Forward Delay 15 sec


Bridge ID Priority 24606 (priority 24576 sys-id-ext 30)
Address aabb.cc00.0300
Hello Time 2 sec Max Age 6 sec Forward Delay 15 sec
Aging Time 300 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2 Desg FWD 100 128.3 Shr
Et0/3 Desg FWD 100 128.4 Shr
Et1/2 Desg FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr
 

About us

  • Securityzone.vn là một trang web chuyên về an ninh mạng và công nghệ thông tin. Trang web này cung cấp các bài viết, tin tức, video, diễn đàn và các dịch vụ liên quan đến lĩnh vực này. Securityzone.vn là một trong những cộng đồng IT lớn và uy tín tại Việt Nam, thu hút nhiều người quan tâm và tham gia. Securityzone.vn cũng là nơi để các chuyên gia, nhà nghiên cứu, sinh viên và người yêu thích an ninh mạng có thể trao đổi, học hỏi và chia sẻ kiến thức, kinh nghiệm và giải pháp về các vấn đề bảo mật trong thời đại số.

Quick Navigation

User Menu