1 / 19

CS4231 Local Area Networks HW3 – Spanning Tree Algrithm

CS4231 Local Area Networks HW3 – Spanning Tree Algrithm. Overview. Overview. 區域網路 1. 埠 1. 埠 1. 橋接器 2. 橋接器 3. 埠 1. 埠 2. 埠 2. 橋接器 1. 區域網路 2. 埠 2. 埠 1. 橋接器 4. 埠 2. 區域網路 3. Spanning Tree Algorithm. Bridges Each bridge is assigned a unique identifier (8 octets):

ferris
Download Presentation

CS4231 Local Area Networks HW3 – Spanning Tree Algrithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS4231Local Area NetworksHW3 – Spanning Tree Algrithm

  2. Overview

  3. Overview 區域網路1 埠1 埠1 橋接器2 橋接器3 埠1 埠2 埠2 橋接器1 區域網路2 埠2 埠1 橋接器4 埠2 區域網路3

  4. Spanning Tree Algorithm • Bridges • Each bridge is assigned a unique identifier (8 octets): • Priority part (two octets): programmable • address part (six octets) • A special group MAC address for all bridges : 01-80-C2-00-00-00 (Multicast address) • Each port of a bridge has a unique port identifier.

  5. Spanning Tree Algorithm • Root Bridge: The bridge with the lowest value of bridge identifier. • Path Cost: For each port, the cost of transmitting a frame onto a LAN. • Root Port: For each bridge, the port on the minimum-cost path to the root bridge. • Root Path Cost: For each bridge, the cost of the path to the root bridge with minimum cost. • Designated Bridge: For each LAN, the bridge that provides the minimum cost path to the root bridge. The only bridge allowed to forward frames to and from the LAN. • Designated Port: The port of the designated bridge that attaches the bridge to the LAN. All internet traffic to and from the LAN pass through the designated port.

  6. Spanning Tree Algorithm • Three Steps: • 1. Determine the root bridge. • 2. Determine the root porton all other bridges. • 3. Determine the designated port on each LAN. • The port with the minimum root path cost. • In the case of two or more bridges with the same root path cost, the highest-priority bridge is selected. • If the designated bridge has two or more ports attached to this LAN, then the port with the lowest value of identifier is selected.

  7. Determine Root Bridge • 每個橋接器送出 BPDU 至所有與其相連之區網 • 將 ’根橋接器ID’ 設為自己的 ID; RPC 設為 0 • 當橋接器自埠 i 收到 BPDU • 若收到 BPDU 上之 ’根橋接器ID’ 比較小 • 認定 BPDU 上之 ‘根橋接器ID’ 方為正確 • 設定 i為根埠 • 更新 RPC 值 (=RPC(BPDU)+TC(i)) • 送出新的 BPDU 至除 i 外的所有埠 • 帶有更新後之 ‘根橋接器ID’ 與 RPC 值 • 否則,捨棄此BPDU • 在兩個 “轉送延遲時間” 內可確定是否為根橋接器

  8. Determine Designated Port • 橋接器 X設定埠 i為根埠後,將其 RPC 值送至除 i外之所有埠,測試是否可為代理埠 • 當 Y 由埠k收到 BPDU: • 若 RPC(X)<RPC(Y) 則放棄競爭.埠 k不為代理埠 • 若 RPC(X)>RPC(Y) 則將 RPC(Y) 送入埠 k • 若 RPC(X)=RPC(Y) 則以 ID 小的擁有代理權

  9. Spanning Tree Algorithm Example 9 RPC = 25 RPC = 20 5 埠 l 埠 i TC=5 RPC = 53, 根埠 = k 4 TC=15 RPC = 58, 根埠 = j 4 橋接器 Y 8 RPC = 40, 根埠 = k 橋接器 X 6 RPC = 35, 根埠 = i, D(W) = j 埠 k 10 RPC = 30, 根埠 = l, D(W) = k 埠 j TC=5 RPC = 35, 根埠 = i 12 TC=10 RPC = 35 7 11 RPC = 30 區域網路 W 3 RPC = 48 埠 m TC=10 RPC = 48, 根埠 = n, D(W) = m D(W): 區域網路W 的代理埠 橋接器 Z RPC = 45, 根埠 = m 埠 n RPC = 40, 根埠 = m TC=10 1 RPC = 38

  10. Spanning Tree Algorithm Example R R 埠l 埠i TC=5 TC=15 橋接器Y 橋接器X 埠k 埠j TC=5 TC=10 D 區域網路W R 埠 m TC=15 橋接器Z D: 代理埠 R: 根埠 埠n TC=10

  11. Bridge Port State Diagram 停滯狀態 被選為 代理埠或根埠 被取消為 代理埠或根埠 被取消為 代理埠或根埠 被取消為 代理埠或根埠 轉送狀態 學習狀態 傾聽狀態 經過一個轉送延遲時間 經過一個轉送延遲時間

  12. Bridge ProtocolData Unit 802.3:Ethernet 802.2: LLC

  13. Bridge ProtocolData Unit • http://www.banalyzer.de/ban/HTML/P_LAYER2/Eng/P_lay120.html

  14. Use libnet to send a BPDU • libnet_ptag_t libnet_build_stp_conf (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t * root_id, u_int32_t root_pc, u_int8_t * bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag) • libnet_ptag_t libnet_build_802_3 (u_int8_t * dst, u_int8_t * src, u_int16_t len, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag) • libnet_ptag_t libnet_build_802_2 (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t * payload, u_int32_t payload_s, libnet_t * l, libnet_ptag_t ptag)

  15. Use libnet to send a BPDU u_int8_t root_id[8] = {0x80, 0x00, 0x00, 0x10, 0x14, 0x23, 0xA4, 0x08}, bridge_id[8] = {0x80, 0x00, 0x00, 0x10, 0x14, 0x23, 0xA4, 0x08}; u_int8_t payload[1] = {0x00}; libnet_build_stp_conf (0, 0, 0, 0, root_id, 0, bridge_id, 2, 0, 20, 2, 15, NULL, 0, l, 0); libnet_build_802_2 (0x42, 0x42, 0, NULL, 0, l, 0); libnet_build_802_3 (BPDU_MC, my_mac, 38, NULL, 0, l, 0);

  16. ABPDUPacket

  17. Requirement • 封包依建立的 Spanning Tree 傳送 frame • 想一個可以驗證建立的 Spanning Tree 是正確的方法 • 例如 show 出每一個 bridge 的收/送封包的狀況

  18. Grading • Correctness (60%) • Report (30%) • How to run your program. • What you’ve learned? • What are you suffer from this HW? • Any feedback? • Coding Style (10%)

  19. Hand in your program • Deadline: 2010/6/18 PM 23:59:59 • Demo: 2010/6/18 AM 10:00~12:00 at 資電326 • Write a simple report in text file. • Please tar/zip/rar your files (including code and report) named as 組別.tar (ex: group_1.tar) and login to • ftp:// 140.114.71.48:4231, cs4231/cs4231s10 Change directory to “Final Project” and create a directory named your 組別, then upload your file in this directory.

More Related