• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Xin chào ! Nếu đây là lần đầu tiên bạn đến với diễn đàn, xin vui lòng danh ra một phút bấm vào đây để đăng kí và tham gia thảo luận cùng VnPro.

Announcement

Collapse
No announcement yet.

Spanning tree protocol

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spanning tree protocol

    Spanning tree protocol

    A. Phần lý thuyết

    Bridging loop
    Bridge không có thông tin ban đầu về vùng địa chỉ của các đầu cuối. Nó phải lắng nghe các gói đi vào port của nó từ đó chỉ ra địa chỉ của đầu cuối.




    Giả sử máy PC1 gứi thông tin đến PC4. Thứ tự các bước :
    Bước 1: Switch (SW) A và SW B nhận được gói ở port 1/1. Địa chỉ MAC của PC1 sẽ được lưu vào bảng địa chỉ cùng với port 1/1. Từ những thông tin này hai SW biết được rằng PC1 nằm ở mạng A.
    Bước 2: Địa chỉ PC4 chưa có trong bảng địa chỉ , do đó hai SW sẽ chuyển frame ra port 2/1 vào mạng B
    Bước 3: PC4 thuộc mạng B nhận đươc hai frame được gửi đến từ hai SW. SW A nhận được frame do SW B gửi đến, và tương tự SW B cũng nhận được frame do SW A gửi đến.
    Bước 4: SW A nhận thấy có gói tin từ PC1 gửi đến PC4. Trong bảng địa chỉ, địa chỉ của PC1 tương ứng với port 1/1 ( mạng A). Tuy nhiên lúc này, địa chỉ của PC1 đang tương ứng với port 2/1 ( mạng B). Như vậy SW sẽ phải cập nhật lại địa chỉ tron bảng địa chỉ, cụ thể là thay đổi địa chỉ PC1 tương ứng với port 2/1. Ở SW B cũng xảy ra quá trình tương tự và xảy ra qúa trình cập nhật lại địa chỉ của PC1 tương ứng với port 2/1
    Bước 5: Lúc này cả SW A và SW B đều không học được địa chỉ củ PC4 bởi vì không có frame nào có thông tin về PC4. Do đó frame sẽ được truyền đến tất cả các port nhằm tìm cho được địa chỉ của PC4. Frame ban đầu lại được truyền vào mạng A.
    Bước 6: Cả hai SW sẽ học lại địa chỉ của frame và quá trình học địa chỉ cứ thế xảy ra, gói tin được gởi theo một vòng khép kín mà không được chuyển đến đích.
    Giải thuật chống loop Spanning tree ( STP)
    Để tránh xảy ra hiện tượng loop, các SW sẽ tiến hành bầu chọn ra một SW có nhiệm vụ quản lý, cơ chế này gọi là STP.
    Bầu chọn Root Bridge
    Việc bầu chọn Root Bridge dựa vào hai yếu tố theo thứ tự sau:
    Bridge Priority : nếu Bridge nào có priority thấp nhất sẽ được chọn làm root. Nếu các Bridge có priority bằng nhau, thì tiến hành chọn lựa dựa vào địa chỉ MAC
    Địa chỉ MAC: Bridge nào có MAC thấp hơn thì sẽ được chọn làm root. Đây là trường hợp cuối cùng trong việc chọn root vì không có trường hợp các Bridge có địa chỉ MAC giống nhau. Thông số priority có thể được thay đổi:
    Switch(config)#spanning-tree vlan vlan-id priority bridge-priority
    Thông số priority nằm trong khoảng từ 0  65535, và giá trị mặc định là 32768.
    Ta cũng có thể lựa chọn root trực tiếp bằng lệnh:
    Switch(config)#spanning-tree vlan vlan-id root {primary | secondary}
    [diameter diameter]
    + primary : sẽ chọn bridge làm root, khi chọn thông số này nếu priority của Root Bridge nhỏ hơn 24567 thì Bridge này sẽ thiết lập priority của nó nhỏ hơn so với priority của root hiện tại một lượng là 4096, và dĩ nhiên bridge này sẽ là root. Còn nếu priority của Root Bridge lớn hơn 24567, bridge sẽ thiết lập priority của nó là 24567.
    + secondary : lựa chọn bridge làm root thứ hai.
    + diameter: số lượng bridge nối tầng, tối đa là 7.
    Bầu chọn Root Port
    Root Port : Port thuộc Nonroot Bridge nối về Root Bridge sao cho chi phí nối về là thấp nhất. Root Port được bầu chọn dựa vào thông số Root Path Cost. Path cost được xem như là chi phí của liên kết, tỉ lệ với băng thông của liên kết. Thông số này có thể được cấu hình bằng dòng lệnh.
    Switch(config-if)#spanning-tree vlan vlan-id cost cost
    Port nào có tổng số path cost về root là thấp nhất sẽ được lựa chọn làm root port.
    Bầu chọn Designated Port (DP)
    Trong trường hợp có hai hay nhiều bridge nối vào chung một mạng (xem hình ở phần bridge loop) sẽ xảy ra trường hợp loop. Để khắc phục thì các bridge có port nối vào mạng sẽ tiến hành lựa chọn designated port. Port này có vai trò quan trọng vì nó có nhiệm vụ chuyển các gói tin đi trong mạng. Việc chọn lựa dựa vào các thông số theo trình tự:
    Dựa vào Root Path Cost : port nào có Root Path Cost thấp nhất sẽ được chọn làm DP. Trong trường hợp Root Path Cost bằng nhau, thì chọn dựa vào Bridge ID
    Bridge ID : port thuộc bridge nào có Bridge ID thấp hơn sẽ được chọn làm DP. Nếu thông số này cũng giống nào thì chọn dựa vào địa chỉ MAC
    Địa chỉ MAC : port thuộc bridge nào có địa chỉ MAC thấp hơn sẽ được chọn làm DP
    B. Phần cấu hình
    Sơ đồ và yêu cầu
    Yêu cầu: cần có 3 switch 2950 ( hoặc 3550)



    Cấu hình
    Trong phần cấu hình này, các port sẽ nằm chung trong một VLAN (VLAN1).
    Lựa chọn Root Bridge (RB)
    Lựa chọn RB dựa vào priority
    Bước 1: Nối cáp theo sơ đồ, khởi động các Switch
    Bước 2: Kiểm tra STP trên các Switch
    Switch1:
    Switch>enable
    Switch#conf t
    Switch(config)#hostname Switch1

    Switch1(config)#exit
    Switch1#show spanning-tree

    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 32769
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000d.299a.7e00
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300

    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch1(config)#spanning-tree vlan 1 priority 10
    Switch2:
    Switch>enable
    Switch#conf t
    Switch(config)#hostname Switch2
    Switch2(config)#exit
    Switch2#show spanning-tree

    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 32769
    Address 000c.854f.f9c0
    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 000c.854f.f9c0
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ----- ---- --------- -------- --------------------------------
    Fa0/1 Desg FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch3:
    Switch>enable
    Switch#conf t
    Switch(config)#hostname Switch3
    Switch3(config)#exit
    Switch3#show spanning-tree
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 32769
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000d.bd29.d080
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Altn BLK 19 128.2 P2p
    Sơ đồ chi tiết của mô hình trên:



    Cả 3 Switch trên đều có priority là 32769 và Switch2 đóng vai trò làm RB. Bây giờ để cấu hình cho Switch1 là RB thì chỉ cần cấu hình cho priority của Switch1 thấp hơn của hai Switch kia.
    Bước 3: Cấu hình priority của Switch1 là 4096
    Switch1#conf t
    Switch1(config)#spanning-tree vlan 1 priority 4096
    Bước 4: Kiểm tra việc chọn lựa
    Switch1#show spanning-tree

    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000d.299a.7e00
    This bridge is the root
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

    Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
    Address 000d.299a.7e00
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300

    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Desg FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch2#show spanning-tree

    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000d.299a.7e00
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000c.854f.f9c0
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300

    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch3#show spanning-tree

    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000d.299a.7e00
    Cost 19
    Port 2 (FastEthernet0/2)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000d.bd29.d080
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300

    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Altn BLK 19 128.1 P2p
    Fa0/2 Root FWD 19 128.2 P2p
    Bây giờ Switch1 đã được bầu chọn làm RB
    Cấu hình RB trực tiếp
    Giữ kết quả của phần 2.1.1, bây giờ ta sẽ lựa chọn Switch2 làm RB theo phương pháp cấu hình trực tiếp.
    Bước 1: Cấu hình cho Switch2:
    Switch2#conf t
    Switch2(config)#spanning-tree vlan 1 root primary
    Bước 2 : Kiểm tra việc chọn lựa
    Switch1#show spanning-tree
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

    Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
    Address 000d.299a.7e00
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch2#show spanning-tree
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000c.854f.f9c0
    This bridge is the root
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
    Address 000c.854f.f9c0
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 15
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Desg FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch3#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000d.bd29.d080
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Altn BLK 19 128.2 P2p
    Cấu hình RB thông qua địa chỉ MAC
    Trước khi làm phần này bạn cần chú ý: phần lab 2.1.3 chỉ có ý nghĩa tham khảo, bạn không thể cấu hình giống 100% như trong phần hướng dẫn này. Lý do rất đơn giản, các switch có địa chỉ MAC không giống nhau. Các switch được sử dụng để tạo ra phần hướng dẫn này sẽ khác các switch mà bạn sử dụng để thực hành. Do đó bạn không cần phải cố gắng để làm cho thật giống phần này mà hãy đọc để hiểu và làm theo các switch mà bạn đang có.
    Bước 1: Kiểm tra địa chỉ MAC trên các switch
    Switch1#show version
    The password-recovery mechanism is enabled.
    384K bytes of flash-simulated non-volatile configuration memory.
    Base ethernet MAC Address: 00:0D:29:9A:7E:00
    Motherboard assembly number: 73-5700-10
    Power supply part number: 34-0966-03
    Motherboard serial number: CAT07500BH0
    Power supply serial number: DTH074627YE
    Switch2#show version
    32K bytes of flash-simulated non-volatile configuration memory.
    Base ethernet MAC Address: 00:0C:85:4F:F9:C0
    Motherboard assembly number: 73-5781-11
    Power supply part number: 34-0965-01
    Motherboard serial number: FOC071200J4
    Power supply serial number: DAB07081XE8
    Switch3#show version
    384K bytes of flash-simulated non-volatile configuration memory.
    Base ethernet MAC Address: 00:0D:BD:29:D0:80
    Motherboard assembly number: 73-5700-10
    Power supply part number: 34-0966-03
    Motherboard serial number: CAT073101R3
    Power supply serial number: DTH07280HNB
    Với địa chỉ MAC này ,trong trường hợp Bridge priority bằng nhau thì Switch 2 được chọn làm RB. Để chọn theo địa chỉ MAC thì phải đảm bảo rằng thông số priority của các Switch bằng nhau. Theo kết quả của phần trên thì priority của Switch1 và Switch2 có giá trị là 4097. Bây giờ sẽ cấu hình priority của Switch3 là 4097 ,bằng với priority của hai Switch kia.
    Bước 2: Cấu hình cho priority trên các switch giống nhau:
    Switch3#conf t
    Switch3(config)#spanning-tree vlan 1 priority 4096
    Bước 3: Kiểm tra việc chọn lựa RB
    Switch1#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
    Address 000d.299a.7e00
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch2#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000c.854f.f9c0
    This bridge is the root
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
    Address 000c.854f.f9c0
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Desg FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p

    Switch3#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 4097
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
    Address 000d.bd29.d080
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300

    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Altn BLK 19 128.2 P2p
    Lựa chọn Root Port (RP)
    Bước 1 : Giữ sơ đồ cáp như phần 2.1, tiến hành trả priority về mặc định.
    Switch1#config terminal
    Switch1(config)#spanning-tree vlan 1 priority 32768

    Switch2#config terminal
    Switch2(config)#spanning-tree vlan 1 priority 32768

    Switch#config terminal
    Switch3(config)#spanning-tree vlan 1 priority 32768
    Bước 2 : Kiểm tra cấu hình STP ban đầu:
    Switch1#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 32769
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000d.299a.7e00
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300

    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p

    Switch2#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 32769
    Address 000c.854f.f9c0
    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 000c.854f.f9c0
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Desg FWD 19 128.1 P2p
    Fa0/2 Desg FWD 19 128.2 P2p
    Switch3#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 32769
    Address 000c.854f.f9c0
    Cost 19
    Port 1 (FastEthernet0/1)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000d.bd29.d080
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Root FWD 19 128.1 P2p
    Fa0/2 Altn BLK 19 128.2 P2p
    Bước 3: Kiểm tra RP trên các Switch
    Switch1#show spanning-tree root port
    VLAN0001 FastEthernet0/1
    Switch2#show spanning-tree root port
    VLAN0001 This bridge is root
    Switch3#show spanning-tree root port
    VLAN0001 FastEthernet0/1
    Sơ đồ các RP



    Theo sơ đồ trên Switch3 có hai đường về RB : đường thứ nhất có Root path cost là 38 và đường thứ hai là 19. Theo cách lựa chọn RP thì tất nhiên đường thứ hai sẽ được chọn để về RB và port f0/1 sẽ là RP. Bây giờ sẽ cấu hình cho con đường thứ 2 có root path cost là 50 (lớn hơn đường thú nhất và xem sự lựa chọn RP).
    Bước 4 : Thay đổi giá trị Root Path Cost để thay đổi RP
    Switch3#conf t
    Switch3#interface f0/1
    Switch3(config-if)#spanning-tree vlan 1 cost 50
    Bạn nên chú ý khi bạn cấu hình bất cứ một sự thay đổi nào liên quan đến việc lựa chọn trong STP thì bạn cũng sẽ thấy rằng giao diện cũng đứng một lúc rồi mới hoạt động lại bình thường. Điều này là vì các Switch cần một khoảng thời gian để tiến hành bầu chọn lại theo thuật toán STP.
    Bước 4 : Kiểm tra
    Switch3#show spanning-tree root
    VLAN0001
    Spanning tree enabled protocol ieee
    Root ID Priority 32769
    Address 000c.854f.f9c0
    Cost 38
    Port 2 (FastEthernet0/2)
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

    Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
    Address 000d.bd29.d080
    Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
    Aging Time 300
    Interface Role Sts Cost Prio.Nbr Type
    ---------------- ---- --- --------- -------- --------------------------------
    Fa0/1 Altn BLK 50 128.1 P2p
    Fa0/2 Root FWD 19 128.2 P2p
    Switch3#show spanning-tree root port
    VLAN0001 FastEthernet0/2
    Như vậy đường về RB của Switch3 đã thay đổi.



    Lựa chọn Designated Port (DP)
    Bước 1: Giữ sơ đồ cáp như phần 2.3, trả giá trị path cost từ Switch2 đến Switch3 về mặc định (19)
    Switch3#config terminal
    Switch3(config)#interface f0/1
    Switch3(config-if)#spanning-tree vlan 1 cost 19
    Bước 2: Kiểm tra DP trên các kết nối
    Switch1#show spanning-tree detail
    Port 1 (FastEthernet0/1) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.1.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.1, designated path cost 0
    Timers: message age 1, forward delay 0, hold 0
    Number of transitions to forwarding state: 5
    Link type is point-to-point by default
    BPDU: sent 494, received 3008
    Port 2 (FastEthernet0/2) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000d.299a.7e00
    Designated port id is 128.2, designated path cost 19

    Switch2#show spanning-tree detail
    Port 1 (FastEthernet0/1) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.1.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.1, designated path cost 0
    Timers: message age 0, forward delay 0, hold 0
    Number of transitions to forwarding state: 1
    Link type is point-to-point by default
    BPDU: sent 3031, received 257
    Port 2 (FastEthernet0/2) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.2, designated path cost 0

    Switch3#show spanning-tree root
    Port 1 (FastEthernet0/1) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.1.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.2, designated path cost 0
    Timers: message age 2, forward delay 0, hold 0
    Number of transitions to forwarding state: 5
    Link type is point-to-point by default
    BPDU: sent 826, received 2810
    Port 2 (FastEthernet0/2) of VLAN0001 is blocking
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000d.299a.7e00
    Designated port id is 128.2, designated path cost 19
    Bước 3: Thay đổi các thông số để thay đổi DP
    Thay đổi Root Path Cost: Port f0/2 của Switch 1 làm DP, ta sẽ thay đổi đường về RB của Switch1 và xem sự thay đổi DP
    Switch1(config)#interface f0/1
    Switch1(config-if)#spanning-tree vlan 1 cost 50
    Xem DP
    Switch1#show spanning-tree detail
    Port 1 (FastEthernet0/1) of VLAN0001 is blocking
    Port path cost 50, Port priority 128, Port Identifier 128.1.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.1, designated path cost 0
    Timers: message age 1, forward delay 0, hold 0
    Number of transitions to forwarding state: 5
    Link type is point-to-point by default
    BPDU: sent 495, received 3340

    Port 2 (FastEthernet0/2) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000d.bd29.d080
    Designated port id is 128.2, designated path cost 19

    Switch3#show spanning-tree detail

    Port 1 (FastEthernet0/1) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.1.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.2, designated path cost 0
    Timers: message age 2, forward delay 0, hold 0
    Number of transitions to forwarding state: 6
    Link type is point-to-point by default
    BPDU: sent 829, received 3215

    Port 2 (FastEthernet0/2) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000d.bd29.d080
    Designated port id is 128.2, designated path cost 19
    Cấu hình cho Root Path Cost bằng nhau để lựa chọn DP theo Bridge ID
    Switch3#config terminal
    Switch3(config)#interface f0/1
    Switch3(config-if)#spanning-tree vlan 1 cost 38
    Switch3(config-if)#exit
    Switch3(config)#spanning-tree vlan 1 priority 20480
    Xem DP
    Switch1#show spanning-tree detail
    Port 1 (FastEthernet0/1) of VLAN0001 is blocking
    Port path cost 19, Port priority 128, Port Identifier 128.1.
    Designated root has priority 20481, address 000d.bd29.d080
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.1, designated path cost 19
    Timers: message age 3, forward delay 0, hold 0
    Number of transitions to forwarding state: 6
    Link type is point-to-point by default
    BPDU: sent 498, received 3660
    Port 2 (FastEthernet0/2) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 20481, address 000d.bd29.d080
    Designated bridge has priority 20481, address 000d.bd29.d080
    Designated port id is 128.2, designated path cost 0

    Switch3#show spanning-tree detail
    Port 1 (FastEthernet0/1) of VLAN0001 is forwarding
    Port path cost 38, Port priority 128, Port Identifier 128.1.
    Designated root has priority 20481, address 000d.bd29.d080
    Designated bridge has priority 20481, address 000d.bd29.d080
    Designated port id is 128.1, designated path cost 0
    Timers: message age 0, forward delay 0, hold 0
    Number of transitions to forwarding state: 6
    Link type is point-to-point by default
    BPDU: sent 902, received 3439

    Port 2 (FastEthernet0/2) of VLAN0001 is forwarding
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 20481, address 000d.bd29.d080
    Designated bridge has priority 20481, address 000d.bd29.d080
    Designated port id is 128.2, designated path cost 0
    Cấu hình cho Bridge ID giống nhau để lựa chọn DP theo MAC. Trả giá trị priority của Switch3 về lại giá trị mặc định 32769 (bằng với gía trị của Switch1 và Switch2)
    Switch3#config terminal
    Switch3(config)#spanning-tree vlan 1 priority 32768

    Xem DP:
    Switch3#show spanning-tree detail
    Port 1 (FastEthernet0/1) of VLAN0001 is forwarding
    Port path cost 38, Port priority 128, Port Identifier 128.1.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000c.854f.f9c0
    Designated port id is 128.2, designated path cost 0
    Timers: message age 2, forward delay 0, hold 0
    Number of transitions to forwarding state: 6
    Link type is point-to-point by default
    BPDU: sent 1097, received 3804

    Port 2 (FastEthernet0/2) of VLAN0001 is blocking
    Port path cost 19, Port priority 128, Port Identifier 128.2.
    Designated root has priority 32769, address 000c.854f.f9c0
    Designated bridge has priority 32769, address 000d.299a.7e00
    Designated port id is 128.2, designated path cost 19
    Email : vnpro@vnpro.org
    ---------------------------------------------------------------------------------------------------------------
Trung Tâm Tin Học VnPro
149/1D Ung Văn Khiêm P25 Q.Bình thạnh TPHCM
Tel : (08) 35124257 (5 lines)
Fax: (08) 35124314

Home page: http://www.vnpro.vn
Support Forum: http://www.vnpro.org
- Chuyên đào tạo quản trị mạng và hạ tầng Internet
- Phát hành sách chuyên môn
- Tư vấn và tuyển dụng nhân sự IT
- Tư vấn thiết kế và hỗ trợ kỹ thuật hệ thống mạng

Network channel: http://www.dancisco.com
Blog: http://www.vnpro.org/blog

  • #2
    Cho em xin hình sơ đồ với Thầy ơi.

    Comment


    • #3
      cám ơn thầy về bài viết

      Comment


      • #4
        1 bài viết hay cảm ơn bạn đã chia sẻ nhé chúc bạn có thêm nhiều bài viết hay hơn để chia sẻ nhé

        Comment

        • Working...
          X