Lab 1.3 PVRST (Per VLAN Rapid Spanning Tree)

root

Leader IT/Architect
Dec 31, 2012
1,153
72
48
I. Mô hình
1. Mô hình



2. Yêu cầu:
- Đảm bảo tất cả các SW chạy Per VLAN Rapid Spanning Tree
- Tạo VLAN 10,20,30 trên các SW
  • SW1 làm root-bridge cho VLAN 10
  • SW2 làm root-bridge cho VLAN 20
  • SW3 làm root-bridge cho VLAN 30
- Thay đổi cost để packet ưu tiên đi từ SW2 sẽ đi qua SW3 và tới root bridge SW1 trong VLAN 10
- Thay đổi port-priority để e0/3 của SW3 được ưu tiên kết nối đến root-bridge của VLAN 10
- Đảm bảo e1/0 trên các SW được coi là một edge port for PVRST

II. Triển khai
1. Cấu hình
- Enable tính năng PVRST, tạo VLAN, port trunk và root bridge
- Trên SW1
SW1(config)#spanning-tree mode rapid-pvst

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

SW2(config)#spanning-tree mode rapid-pvst

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

SW3(config)#spanning-tree mode rapid-pvst

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

2. Kiểm tra
- SW1 làm root-bridge cho VLAN 10

Code:
SW1#[B]sh spanning-tree vlan 10[/B]


VLAN0010
  [I][COLOR=#ff0000]Spanning tree enabled protocol rstp[/COLOR][/I]
  Root ID    Priority    24586
             Address     aabb.cc00.0100
             [COLOR=#ff0000]This bridge is the root[/COLOR]
             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

- Tương tự SW2 làm root bridge cho VLAN 20

Code:
SW2#[B]sh spanning-tree vlan 20[/B]


[COLOR=#ff0000]VLAN0020[/COLOR]
  Spanning tree enabled protocol [I][COLOR=#FF0000]rstp[/COLOR][/I]
  Root ID    Priority    24596
             Address     aabb.cc00.0200
            [COLOR=#ff0000] This bridge is the root[/COLOR]
             Hello Time   2 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   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
Et1/2               Desg FWD 100       128.7    Shr
Et1/3               Desg FWD 100        64.8    Shr
- SW3 làm root-bridge cho VLAN 30

Code:
SW3#[B]sh spanning-tree vlan 30[/B]


[COLOR=#ff0000]VLAN0030[/COLOR]
  Spanning tree enabled protocol [I][COLOR=#FF0000]rstp[/COLOR][/I]
  Root ID    Priority    16414
             Address     aabb.cc00.0300
            [COLOR=#ff0000] This bridge is the root[/COLOR]
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    16414  (priority 16384 sys-id-ext 30)
             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               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
 
3. COST
- "Show spannning tree VLAN 10" trên SW2 các bạn thấy SW2 sẽ chạy về Root-bridge thông qua e0/0
- "show cdp neigber" các bạn thấy e0/0 của SW2 đang được đấu với e0/0 của SW1.

Code:
SW2(config)#do sh spanning-tree vlan 10


VLAN0010
  Spanning tree enabled protocol [I][COLOR=#FF0000]rstp[/COLOR][/I]
  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    28682  (priority 28672 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               [COLOR=#ff0000]Root FWD [/COLOR]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
Code:
SW2#sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay


Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
[COLOR=#ff0000]SW1              Eth 0/0           134              R S   Linux Uni Eth 0/0
SW1              Eth 0/1           134              R S   Linux Uni Eth 0/1[/COLOR]
SW3              Eth 1/3           134              R S   Linux Uni Eth 1/3
SW3              Eth 1/2           134              R S   Linux Uni Eth 1/2
- Bây giờ chúng ta sẽ phải chính cost để SW2 phải đi về root-bridge thì phải đi qua SW3. Lưu ý chúng ta phải sửa path cost của cá 2 interface nối về root-bridge e0/0 và e0/1

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

- Kiểm tra lại các bạn thấy các port từ SW2 tới root-bridge của VLAN đã bị block. Bây giờ nó sẽ đi tới root-bridge bằng e1/2 qua SW3

Code:
SW2#sh spanning-tree vlan 10


VLAN0010
  Spanning tree enabled protocol [I][COLOR=#FF0000]rstp[/COLOR][/I]
  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    28682  (priority 28672 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
[COLOR=#ff0000]Et1/2               Root FWD 100[/COLOR]       128.7    Shr
Et1/3               Altn BLK 100       128.8    Shr

4. Port-priority
- Kiểm tra SW3 các bạn thấy e0/2 của SW3 đang ở trạng thái forwarding về root-bridge, còn e0/3 đang ở trạng thái block. E0/2 và e0/3 đều có cùng priority = 128.
Code:
SW3#sh spanning-tree vlan 10


VLAN0010
  Spanning tree enabled protocol [I][COLOR=#FF0000]rstp[/COLOR][/I]
  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
------------------- ---- --- --------- -------- --------------------------------
[COLOR=#ff0000]Et0/2               Root FWD 100 [/COLOR]     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
- Các port e0/2 và e0/3 của SW3 được nối với e0/2 và e0/3 của SW1

Code:
SW3#sh cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
SW1              Eth 0/3           159              R S   Linux Uni Eth 0/3
[COLOR=#ff0000]SW1              Eth 0/2   [/COLOR]       159              R S   Linux Uni Eth 0/2
SW2              Eth 1/3           153              R S   Linux Uni Eth 1/3
SW2              Eth 1/2           153              R S   Linux Uni Eth 1/2
- Chúng ta sẽ chỉnh priority e0/2 của SW1 cao lên để e0/3 của SW3 lên làm Forwarding tới root-bridge.

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

- Kiểm tra các bạn sẽ thấy e0/3 đã chuyển sang trạng thái forwarding về root-bridge

Code:
SW3#sh spanning-tree vlan 10


VLAN0010
  Spanning tree enabled protocol rstp
  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  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2               Altn BLK 100       128.3    Shr
[COLOR=#ff0000]Et0/3               Root FWD 100[/COLOR]       128.4    Shr
Et1/2               Desg BLK 100       128.7    Shr
Et1/3               Desg BLK 100       128.8    Shr

5. Edge port
- Cấu hình edge port trên e1/0 của SW1.
- Kiểm tra SPT trên e1/0 của SW1

Code:
SW1(config-if)#do sh spanning-tree inter e1/0


Vlan                Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
[COLOR=#ff0000]VLAN0001[/COLOR]        [COLOR=#ff0000]    Desg FWD[/COLOR] 100       128.5    Shr
- Cấu hình e1/0 thành edge port

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

- Kiểm tra

Code:
SW1#sh spanning-tree


VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    32769
             Address     aabb.cc00.0100
             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     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 500       128.1    Shr
Et0/1               Desg FWD 500       128.2    Shr
Et0/2               Desg FWD 100       128.3    Shr
Et0/3               Desg FWD 100       128.4    Shr
[I][COLOR=#ff0000]Et1/0               Desg FWD 100       128.5    Shr Edge[/COLOR][/I]
Et1/1               Desg FWD 100       128.6    Shr
Et1/2               Desg FWD 100       128.7    Shr
Et1/3               Desg FWD 100       128.8    Shr
Code:
SW1(config-if)#do sh spanning-tree inter e1/0


Vlan                Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
VLAN0001            Desg FWD 100       128.5    Shr [COLOR=#ff0000]Edge[/COLOR]

 

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