Lab 1.1 per VLan Spanning Tree

root

Leader IT/Architect
Dec 31, 2012
1,153
72
48
- Để làm bài lab này bạn có thể ôn lại lý thuyết STP tại đây: http://svuit.com/showthread.php?163-Bài-19-Spanning-tree

I. Mô hình

1. Mô hình




2. Yêu cầu

- Tạo VLAN 10,20,30,40 trên tất cả các SW
- Kiểm tra xem SW nào làm root-bridge của VLAN 10 và tại sao?
- Không được sử dụng lệnh priority để cấu hình
  • Cấu hình SW1 làm root-bridge cho VLAN 10 và SW2 làm backup khi SW1 fails
  • Cấu hình SW2 làm root-bridge cho VLAN 20 và SW1 làm Backup khi SW2 fails
- Không được sử dụng lệnh "spanning-tree root" để cấu hình
  • Cấu hình SW4 làm root-bridge cho VLAN 30 và SW3 làm backup khi SW1 fails
  • Cấu hình SW3 làm root-bridge cho VLAN 40 và SW4 làm Backup khi SW2 fails
- Thay đổi hello timer trên VLAN 10 trên tất cả các Switch thành 4s
- Cấu hình để f1/1 của SW3 không được kết nối đến root-bridge trên VLAN 10. Không được shutdown interface. Cấu hình trên SW3
- Cấu hình để f1/3 của SW3 kết nối đến root-bridge trên VLAN 20. Không được cấu hình trên SW3
- Cấu hình để khi 1 host cắm vào f1/0 của SW3 thì ngay lập tức f1/0 được lên trạng thái forwarding (lập tức lên đèn xanh thay vì chờ 30 từ đèn cam rồi mới lên được đèn xanh

II. Triển khai
1. Cấu hình VLAN trên các SW
- Tạo các VLAN 10, 20, 30, 40 trên các SW

// trên SW1
SW1(config-vlan)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#vlan 30
SW1(config-vlan)#vlan 40

// trên SW2
SW2(config)#vlan 10
SW2(config-vlan)#vlan 20
SW2(config-vlan)#vlan 30
SW2(config-vlan)#vlan 40

// trên SW3
SW3(config)#vlan 10
SW3(config-vlan)#vlan 20
SW3(config-vlan)#vlan 30
SW3(config-vlan)#vlan 40

// trên SW4
SW4(config-vlan)#vlan 10
SW4(config-vlan)#vlan 20
SW4(config-vlan)#vlan 30
SW4(config-vlan)#vlan 40

2. Show spanning chạy trên các VLAN của các SW
- SW1: Kết quả kiểm tra cho thấy SW1 làm Root SW cho các VLAN 10,20,30,40. Nó có Priority default là: 32769 và MAC address: aabb.cc00.0100

SW1#sh spanning-tree

VLAN0001
Spanning tree enabled protocol ieee
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


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 32778
Address aabb.cc00.0100
This bridge is the root
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.0100
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec

Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Desg FWD 100 128.7 Shr


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

Bridge ID Priority 32788 (priority 32768 sys-id-ext 20)
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Desg FWD 100 128.7 Shr


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

Bridge ID Priority 32798 (priority 32768 sys-id-ext 30)
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Desg FWD 100 128.7 Shr


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

Bridge ID Priority 32808 (priority 32768 sys-id-ext 40)
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Desg FWD 100 128.7 Shr

- Trên SW2

SW2#sh spanning-tree

VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address aabb.cc00.0100
Cost 100
Port 7 (Ethernet1/2)
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.0200
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec


VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 32778
Address aabb.cc00.0100
Cost 100
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Root FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr


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

Bridge ID Priority 32788 (priority 32768 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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Root FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr


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

Bridge ID Priority 32798 (priority 32768 sys-id-ext 30)
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Root FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr


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

Bridge ID Priority 32808 (priority 32768 sys-id-ext 40)
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Root FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr

- Kết quả tương tự trên các SW còn lại
=> Các SW1,2,3,4 có cùng số Priority mặc định là 32768, nhưng MAC address của SW1: aabb.cc00.0100 là nhỏ nhất nên nó được làm Root-SW

SW1#sh interfaces
Ethernet0/0 is up, line protocol is up (connected)
Hardware is AmdP2, address is aabb.cc00.0100 (bia aabb.cc00.0100)
MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Auto-duplex, Auto-speed, media type is unknown
input flow-control is off, output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 input packets with dribble condition detected
2957 packets output, 209841 bytes, 0 underruns
28 output errors, 28 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
 
3. Cấu hình Root-Bridge
- Cấu hình SW1 làm Root-bridge cho VLAN 10 và SW 2 làm backup cho VLAN 10.

//SW1 làm Root-bridge cho VLAN 10
SW1(config)#spanning-tree vlan 10 root primary

//SW2 làm Backup cho VLAN 10
SW2(config)#spanning-tree vlan 10 root secondary

- Show Spanning tree VLAN 10 trên SW1 ta thấy chỉ số priority của nó đã bị thay đổi thành 24586

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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Desg FWD 100 128.7 Shr

- Tương tự trên SW2 các bạn thấy priority của nó cũng bị thay đổi thành 28672. Chỉ số 28672 > 24586(priority của SW1) và 28672 < 32768 (của các Switch còn lại). Nên khi SW1 bị fails thì SW2 sẽ lên làm Root-SW thay thế thế.

SW2#sh spanning-tree vlan 10

VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 24586
Address aabb.cc00.0100
Cost 100
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Root FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr

- Các bạn cấu hình tương tự với VLAN 20

//SW1 làm Backup cho VLAN 20
SW1(config)#spanning-tree vlan 20 root secondary

//SW2 làm Root-bridge cho VLAN 20
SW2(config)#spanning-tree vlan 20 root primary

- Kiểm tra spanning-tree VLAN 20 trên SW1 và SW2 các bạn sẽ thấy SW2 đã làm root-bridge và SW1 làm Backup

SW1#sh spanning-tree vlan 20

VLAN0020
Spanning tree enabled protocol ieee
Root ID Priority 24596
Address aabb.cc00.0200
Cost 100
Port 7 (Ethernet1/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 28692 (priority 28672 sys-id-ext 20)
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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Root FWD 100 128.7 Shr
- SW2 làm root-bridge

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 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
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Desg FWD 100 128.7 Shr
Et1/3 Desg FWD 100 128.8 Shr
- Tương tự SW4 làm root-bridge cho VLAN 30 với điều kiện không sử dụng câu lệnh "spanning-tree root ...". Ở đây chúng ta sẽ sửa chỉ số priority của SW4 để cho nó làm root-SW.
- Lưu ý khi chỉnh priority là chỉ số priority phải là bội số của 4096.

//SW3 làm backup cho VLAN 30
SW3(config)#spanning-tree vlan 30 priority 16384

//SW4 làm root-bridge cho VLAN 30
SW4(config)#spanning-tree vlan 30 priority 8192

- Show spanning-tree vlan 30 trên SW3 các bạn thấy priority của SW3 đã bị thay đổi

SW3#sh spanning-tree vlan 30

VLAN0030
Spanning tree enabled protocol ieee
Root ID Priority 8222
Address aabb.cc00.0400
Cost 100
Port 5 (Ethernet1/0)
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
------------------- ---- --- --------- -------- --------------------------------
Et1/0 Root FWD 100 128.5 Shr
Et1/1 Desg FWD 100 128.6 Shr
Et1/3 Desg FWD 100 128.8 Shr
- Tương tự, các bạn thực hiện "Show spanning-tree vlan 30" trên SW4. Các bạn thấy SW4 đã làm root-bridge cho VLAN 30

SW4#sh spanning-tree vlan 30

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

Bridge ID Priority 8222 (priority 8192 sys-id-ext 30)
Address aabb.cc00.0400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/0 Desg FWD 100 128.5 Shr
Et1/1 Desg FWD 100 128.6 Shr

- Các bạn cấu hình tương tự cho VLAN 40

//SW3 làm Root-bridge cho VLAN 40
SW3(config)#spanning-tree vlan 40 priority 8192

// SW4 làm Backup cho VLAN 40
SW4(config)#spanning-tree vlan 40 priority 16384

 
4. Thay đổi hello-timer
- Thay đổi hello-timer của VLAN 10 trên tất cả các SW thành 4s (Mặc định hello timer là 2s). Hello time là thời gian gửi gói BPDU và khi đã bầu chọn xong root bridge thì chỉ có root-bridge mới được quyền gửi gói BPDU

SW1(config)#spanning-tree vlan 10 hello-time 4


SW2(config)#spanning-tree vlan 10 hello-time 4


SW3(config)#spanning-tree vlan 10 hello-time 4


SW4(config)#spanning-tree vlan 10 hello-time 4



- Show spanning-tree VLAN 10 trên SW1 các bạn sẽ thấy "Hello-time" của VLAN 10 trên SW1 đã thay đổi thành 4s

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 4 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 4 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec


Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/1 Desg FWD 100 128.6 Shr
Et1/2 Desg FWD 100 128.7 Shr
 
5. Cấu hình root-port
- Cấu hình interface f1/1 trên SW3 để nó không được tiếp cận với root-bridge
- Show spanning-tree vlan 10 của SW3 trước khi cấu hình

SW3#sh spanning-tree vlan 10 detail


VLAN0010 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, sysid 10, address aabb.cc00.0300
Configured hello time 2, max age 20, forward delay 15
Current root has priority 24586, address aabb.cc00.0100
Root port is 6 (Ethernet1/1), cost of root path is 200
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:14:56 ago
Times: hold 1, topology change 35, notification 4
hello 4, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300


Port 5 (Ethernet1/0) of VLAN0010 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.5.
Designated root has priority 24586, address aabb.cc00.0100
Designated bridge has priority 32778, address aabb.cc00.0400
Designated port id is 128.6, designated path cost 100
Timers: message age 5, forward delay 0, hold 0
Number of transitions to forwarding state: 0
Link type is shared by default
BPDU: sent 1, received 225


Port 6 (Ethernet1/1) of VLAN0010 is root forwarding
Port path cost 100, Port priority 128, Port Identifier 128.6.
Designated root has priority 24586, address aabb.cc00.0100
Designated bridge has priority 28682, address aabb.cc00.0200
Designated port id is 128.6, designated path cost 100
Timers: message age 5, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 1, received 226


Port 8 (Ethernet1/3) of VLAN0010 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.8.
Designated root has priority 24586, address aabb.cc00.0100
Designated bridge has priority 28682, address aabb.cc00.0200
Designated port id is 128.8, designated path cost 100
Timers: message age 5, forward delay 0, hold 0
Number of transitions to forwarding state: 0
Link type is shared by default
BPDU: sent 1, received 226
- Như các bạn thấy port f1/3 bị block mặc dù f1/1 và f1/3 có cùng path cost. Nhưng theo luật tie-break thì số thứ tự port f1/1 lớn hơn số thự tự port f1/3. Nên f1/3 sẽ bị block
- Bây giờ chúng ta sẽ chỉnh path cost trên f1/1 lớn hơn mặc định để nó không tiếp cận được với root-bridge

SW3(config)#interface e1/1
SW3(config-if)#spanning-tree vlan 10 cost 500

- Các bạn thấy với path cost = 500 trên port f1/1 thì lập tức lúc này f1/1 của SW3 sẽ chuyển sang thái blocking vì có path cost lớn nhất. Và port f1/3 sẽ chuyển từ trạng thái blockking -> listening -> learning -> forwarding

SW3#sh spanning-tree vlan 10 detail


VLAN0010 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, sysid 10, address aabb.cc00.0300
Configured hello time 2, max age 20, forward delay 15
Current root has priority 24586, address aabb.cc00.0100
Root port is 8 (Ethernet1/3), cost of root path is 200
Topology change flag not set, detected flag not set
Number of topology changes 1 last change occurred 00:00:40 ago
from Ethernet1/1
Times: hold 1, topology change 35, notification 4
hello 4, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300


Port 5 (Ethernet1/0) of VLAN0010 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.5.
Designated root has priority 24586, address aabb.cc00.0100
Designated bridge has priority 32778, address aabb.cc00.0400
Designated port id is 128.6, designated path cost 100
Timers: message age 3, forward delay 0, hold 0
Number of transitions to forwarding state: 0
Link type is shared by default
BPDU: sent 1, received 401


Port 6 (Ethernet1/1) of VLAN0010 is alternate blocking
Port path cost 500, Port priority 128, Port Identifier 128.6.
Designated root has priority 24586, address aabb.cc00.0100
Designated bridge has priority 28682, address aabb.cc00.0200
Designated port id is 128.6, designated path cost 100
Timers: message age 3, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 1, received 403


Port 8 (Ethernet1/3) of VLAN0010 is root forwarding
Port path cost 100, Port priority 128, Port Identifier 128.8.
Designated root has priority 24586, address aabb.cc00.0100
Designated bridge has priority 28682, address aabb.cc00.0200
Designated port id is 128.8, designated path cost 100
Timers: message age 3, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 2, received 404
 
6. Cấu hình port-priority
- Tương tự như câu 5 ở trên thì f1/3 của SW3 sẽ bị blocking. Bây giờ chúng ta sẽ chỉnh nó về thành port-forwarding với yêu cầu là không được chính sửa trên SW3.
- Sử dụng tie-break thì các bạn thấy "sender bridge ID" giữa f1/1 và f1/3 là bằng nhau. Tiếp đến là "Sender port-id" cũng có số port-priority bằng nhau nhưng số thứ tự port thì f1/3 bé hơn nên nó sẽ bị Blocking. Để thay đổi điều này chúng ta phải sửa port-priority trên SW2.
- Show cdp neighber các bạn thấy port f1/1 và f1/3 của SW3 đang nối với f1/1 và f1/3 của SW2. Vầy nên chúng ta sẽ chỉnh port-priority trên SW2

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
SW4 Eth 1/0 167 R S Linux Uni Eth 1/1
SW2 Eth 1/3 163 R S Linux Uni Eth 1/3
SW2 Eth 1/1 163 R S Linux Uni Eth 1/1
- "Show spanning vlan 20 detail" để biết trạng thái port f1/3 đang bị blocking

SW3#sh spanning-tree vlan 20 detail


VLAN0020 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, sysid 20, address aabb.cc00.0300
Configured hello time 2, max age 20, forward delay 15
Current root has priority 24596, address aabb.cc00.0200
Root port is 6 (Ethernet1/1), cost of root path is 100
Topology change flag not set, detected flag not set
Number of topology changes 1 last change occurred 00:47:03 ago
from Ethernet1/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300


Port 5 (Ethernet1/0) of VLAN0020 is designated forwarding
Port path cost 100, Port priority 128, Port Identifier 128.5.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 32788, address aabb.cc00.0300
Designated port id is 128.5, designated path cost 100
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 1425, received 0


Port 6 (Ethernet1/1) of VLAN0020 is root forwarding
Port path cost 100, Port priority 128, Port Identifier 128.6.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 24596, address aabb.cc00.0200
Designated port id is 128.6, designated path cost 0
Timers: message age 1, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 2, received 1425


Port 8 (Ethernet1/3) of VLAN0020 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.8.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 24596, address aabb.cc00.0200
Designated port id is 128.8, designated path cost 0
Timers: message age 1, forward delay 0, hold 0
Number of transitions to forwarding state: 0
Link type is shared by default
BPDU: sent 0, received 1423

- Trên SW2 thực hiện chỉnh port-priority trên f1/3 nhỏ hơn f1/1. Số này là bội số của 64 và nằm trong khoảng 0-192

SW2(config)#int e1/3
SW2(config-if)#spanning-tree vlan 20 port-priority 64
- Kiểm tra thì thấy VLAN 20 port f1/3 đã có priority nhỏ hơn f1/1 (64<128)

SW2#sh spanning-tree vlan 20 detail
Port 6 (Ethernet1/1) of VLAN0020 is designated forwarding
Port path cost 100, Port priority 128, Port Identifier 128.6.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 24596, address aabb.cc00.0200
Designated port id is 128.6, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 1819, received 2


Port 7 (Ethernet1/2) of VLAN0020 is designated forwarding
Port path cost 100, Port priority 128, Port Identifier 128.7.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 24596, address aabb.cc00.0200
Designated port id is 128.7, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 1821, received 3


Port 8 (Ethernet1/3) of VLAN0020 is designated forwarding
Port path cost 100, Port priority 64, Port Identifier 64.8.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 24596, address aabb.cc00.0200
Designated port id is 64.8, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 1819, received 2
- Kiểm tra trên SW3 các bạn sẽ thấy port f1/3 đã chuyển sang trạng thái forwarding và f1/1 chuyển thành blocking

SW3#sh spanning-tree vlan 20 detail | begin 1/1


Port 6 (Ethernet1/1) of VLAN0020 is alternate blocking
Port path cost 100, Port priority 128, Port Identifier 128.6.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 24596, address aabb.cc00.0200
Designated port id is 128.6, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 2, received 1886


Port 8 (Ethernet1/3) of VLAN0020 is root forwarding
Port path cost 100, Port priority 128, Port Identifier 128.8.
Designated root has priority 24596, address aabb.cc00.0200
Designated bridge has priority 24596, address aabb.cc00.0200
Designated port id is 64.8, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 1
Link type is shared by default
BPDU: sent 2, received 1886

7. Cấu hình Spanning tree port-fast
- Cấu hình port f1/0 trên SW2 làm port-fast. Để khi host cắm vào port f1/0 thì lập tức được lên trạng thái forwarding

SW2(config)#int e1/0
SW2(config-if)#spanning-tree portfast

 
- Để làm bài lab này bạn có thể ôn lại lý thuyết STP tại đây: http://svuit.com/showthread.php?163-Bài-19-Spanning-tree

I. Mô hình

1. Mô hình




2. Yêu cầu

- Tạo VLAN 10,20,30,40 trên tất cả các SW
- Kiểm tra xem SW nào làm root-bridge của VLAN 10 và tại sao?
- Không được sử dụng lệnh priority để cấu hình
  • Cấu hình SW1 làm root-bridge cho VLAN 10 và SW2 làm backup khi SW1 fails
  • Cấu hình SW2 làm root-bridge cho VLAN 20 và SW1 làm Backup khi SW2 fails
- Không được sử dụng lệnh "spanning-tree root" để cấu hình
  • Cấu hình SW4 làm root-bridge cho VLAN 30 và SW3 làm backup khi SW1 fails
  • Cấu hình SW3 làm root-bridge cho VLAN 40 và SW4 làm Backup khi SW2 fails
- Thay đổi hello timer trên VLAN 10 trên tất cả các Switch thành 4s
- Cấu hình để f1/1 của SW3 không được kết nối đến root-bridge trên VLAN 10. Không được shutdown interface. Cấu hình trên SW3
- Cấu hình để f1/3 của SW3 kết nối đến root-bridge trên VLAN 20. Không được cấu hình trên SW3
- Cấu hình để khi 1 host cắm vào f1/0 của SW3 thì ngay lập tức f1/0 được lên trạng thái forwarding (lập tức lên đèn xanh thay vì chờ 30 từ đèn cam rồi mới lên được đèn xanh

II. Triển khai
1. Cấu hình VLAN trên các SW
- Tạo các VLAN 10, 20, 30, 40 trên các SW

// trên SW1
SW1(config-vlan)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#vlan 30
SW1(config-vlan)#vlan 40

// trên SW2
SW2(config)#vlan 10
SW2(config-vlan)#vlan 20
SW2(config-vlan)#vlan 30
SW2(config-vlan)#vlan 40

// trên SW3
SW3(config)#vlan 10
SW3(config-vlan)#vlan 20
SW3(config-vlan)#vlan 30
SW3(config-vlan)#vlan 40

// trên SW4
SW4(config-vlan)#vlan 10
SW4(config-vlan)#vlan 20
SW4(config-vlan)#vlan 30
SW4(config-vlan)#vlan 40

2. Show spanning chạy trên các VLAN của các SW
- SW1: Kết quả kiểm tra cho thấy SW1 làm Root SW cho các VLAN 10,20,30,40. Nó có Priority default là: 32769 và MAC address: aabb.cc00.0100



- Trên SW2



- Kết quả tương tự trên các SW còn lại
=> Các SW1,2,3,4 có cùng số Priority mặc định là 32768, nhưng MAC address của SW1: aabb.cc00.0100 là nhỏ nhất nên nó được làm Root-SW



Chào bạn.
Mình có làm như thế này mà sao khác với của bạn mà mình chưa biết bị vấn đề gì? Mà chỉ có như thế nào thôi, nếu bạn biết thì chỉ giúp mình với.
ESW1#sh spanning-tre


VLAN1 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address c201.037c.0000
Configured hello time 2, max age 20, forward delay 15
We are the root of the spanning tree
Topology change flag not set, detected flag not set
Number of topology changes 1 last change occurred 00:02:43 ago
from FastEthernet1/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300


Port 42 (FastEthernet1/1) of VLAN1 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address c201.037c.0000
Designated bridge has priority 32768, address c201.037c.0000
Designated port id is 128.42, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 98, received 2


Port 43 (FastEthernet1/2) of VLAN1 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.43.
Designated root has priority 32768, address c201.037c.0000
Designated bridge has priority 32768, address c201.037c.0000
Designated port id is 128.43, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 98, received 2
 
Last edited by a moderator:
- Để làm bài lab này bạn có thể ôn lại lý thuyết STP tại đây: http://svuit.com/showthread.php?163-Bài-19-Spanning-tree

I. Mô hình

1. Mô hình




2. Yêu cầu

- Tạo VLAN 10,20,30,40 trên tất cả các SW
- Kiểm tra xem SW nào làm root-bridge của VLAN 10 và tại sao?
- Không được sử dụng lệnh priority để cấu hình
  • Cấu hình SW1 làm root-bridge cho VLAN 10 và SW2 làm backup khi SW1 fails
  • Cấu hình SW2 làm root-bridge cho VLAN 20 và SW1 làm Backup khi SW2 fails
- Không được sử dụng lệnh "spanning-tree root" để cấu hình
  • Cấu hình SW4 làm root-bridge cho VLAN 30 và SW3 làm backup khi SW1 fails
  • Cấu hình SW3 làm root-bridge cho VLAN 40 và SW4 làm Backup khi SW2 fails
- Thay đổi hello timer trên VLAN 10 trên tất cả các Switch thành 4s
- Cấu hình để f1/1 của SW3 không được kết nối đến root-bridge trên VLAN 10. Không được shutdown interface. Cấu hình trên SW3
- Cấu hình để f1/3 của SW3 kết nối đến root-bridge trên VLAN 20. Không được cấu hình trên SW3
- Cấu hình để khi 1 host cắm vào f1/0 của SW3 thì ngay lập tức f1/0 được lên trạng thái forwarding (lập tức lên đèn xanh thay vì chờ 30 từ đèn cam rồi mới lên được đèn xanh

II. Triển khai
1. Cấu hình VLAN trên các SW
- Tạo các VLAN 10, 20, 30, 40 trên các SW

// trên SW1
SW1(config-vlan)#vlan 10
SW1(config-vlan)#vlan 20
SW1(config-vlan)#vlan 30
SW1(config-vlan)#vlan 40

// trên SW2
SW2(config)#vlan 10
SW2(config-vlan)#vlan 20
SW2(config-vlan)#vlan 30
SW2(config-vlan)#vlan 40

// trên SW3
SW3(config)#vlan 10
SW3(config-vlan)#vlan 20
SW3(config-vlan)#vlan 30
SW3(config-vlan)#vlan 40

// trên SW4
SW4(config-vlan)#vlan 10
SW4(config-vlan)#vlan 20
SW4(config-vlan)#vlan 30
SW4(config-vlan)#vlan 40

2. Show spanning chạy trên các VLAN của các SW
- SW1: Kết quả kiểm tra cho thấy SW1 làm Root SW cho các VLAN 10,20,30,40. Nó có Priority default là: 32769 và MAC address: aabb.cc00.0100



- Trên SW2



- Kết quả tương tự trên các SW còn lại
=> Các SW1,2,3,4 có cùng số Priority mặc định là 32768, nhưng MAC address của SW1: aabb.cc00.0100 là nhỏ nhất nên nó được làm Root-SW



Chào bạn.
Mình có làm như thế này mà sao khác với của bạn mà mình chưa biết bị vấn đề gì? Mà chỉ có như thế nào thôi, nếu bạn biết thì chỉ giúp mình với.
ESW1#sh spanning-tre


VLAN1 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address c201.037c.0000
Configured hello time 2, max age 20, forward delay 15
We are the root of the spanning tree
Topology change flag not set, detected flag not set
Number of topology changes 1 last change occurred 00:02:43 ago
from FastEthernet1/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300


Port 42 (FastEthernet1/1) of VLAN1 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address c201.037c.0000
Designated bridge has priority 32768, address c201.037c.0000
Designated port id is 128.42, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 98, received 2


Port 43 (FastEthernet1/2) of VLAN1 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.43.
Designated root has priority 32768, address c201.037c.0000
Designated bridge has priority 32768, address c201.037c.0000
Designated port id is 128.43, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 98, received 2
 

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