1 / 37

EE122: Discussion #4

EE122: Discussion #4. Link-State Routing Distance Vector Routing. Routing: What to keep in mind. Many ways to route: flooding, link-state, distance-vector, path-vector… Main considerations for a routing algorithm Scale Message complexity – How many messages sent in… Speed of Convergence

elsu
Download Presentation

EE122: Discussion #4

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. EE122: Discussion #4 Link-State Routing Distance Vector Routing

  2. Routing: What to keep in mind • Many ways to route: flooding, link-state, distance-vector, path-vector… • Main considerations for a routing algorithm • Scale • Message complexity – How many messages sent in… • Speed of Convergence • Robustness – What happens if a router…

  3. Link-State (LS) Algorithm • Broadcast link-state packets • All routers know entire graph • Run Dijkstra’s Algorithm (this is in the textbook!)

  4. Distance Vector (DV) Routing 6 D B Each node maintains 2 things • Routing table • Cost of going to every destination, through every neighbor • Forwarding information • Next hop neighbor for every destination 1 2 1 C A 5 Neighbors Destinations

  5. Distance Vector Routing • Three “functions” • Initialization • Neighbor update message • Link update

  6. Distance Vector Routing 6 6 D D B B Initialization • For all neighbor nodes, • Set routing table entry to cost of link with neighbor • For all other nodes in network, • Set routing table entry to infinity (or “?”) • Notify neighbors 1 2 1 1 C C A 5

  7. Distance Vector Routing 6 D B Neighbor Update Msg • Whenever a node gets forwarding information from neighbor (say X) • Update cost to every destination through neighbor X • Update forwarding information 1 C C->D: {(A, 5), (B, 1), (D, 1)}

  8. Distance Vector Routing 6 D B Neighbor Update Msg • Whenever I get a message from neighbor (say X) about their forwarding information • Update cost to every destination through neighbor X • Update forwarding information 1 C 1 D’s cost of reaching A thru C = D’s cost of reaching C + C’s cost of reaching A A 5 C->D: {(A, 5), (B, 1), (D, 1)}

  9. Distance Vector Routing 6 D B Neighbor Update Msg • Whenever a node gets forwarding information from neighbor (say X) • Update cost to every destination through neighbor X • Update forwarding information 1 C 1 A 5 C->D: {(A, 5), (B, 1), (D, 1)}

  10. Distance Vector Routing 6 D B Neighbor Update Msg • Whenever a node gets forwarding information from neighbor (say X) • Update cost to every destination through neighbor X • Update forwarding information • If forwarding information changed, send it to all neighbors 1 C 1 A 5 D->BC: {(A, 6), (B, 2), (C, 1)}

  11. Distance Vector Routing 6 D 1 B Link Update • Whenever a link updates • Update cost in table • Update forwarding information • If forwarding information changed, send it to all neighbors 1 C 1 A 5

  12. Distance Vector Routing 6 D 1 B Link Update • Whenever a link updates • Update cost in table • Update forwarding information • If forwarding information changed, send it to all neighbors 1 C 1 A 5 D->BC: {(A, 6), (B, 1), (C, 1)}

  13. Distance Vector (DV) Routing /* Distance to node u through neighbor n. Initialized all to infinity. */ d[n][u] = infinity; /* Distance to neighbor n. Know from beginning. */ c[n] = {…}; /* Best distances, initialize all as infinity. */ b[u] = infinity; initialize() { /* Set all values can from known neighbor distances. */ foreachn in Neighbor d[n][n] = c[n]; b[n] = c[n]; send_to_neighbors(b); } link_update(l, n) { // Diff between old and new a = c[n] – l; c[n] = l; change = false; foreachu in Graph // Update distance to u through n d[n][u] += a; // If new min distance, update if b[u] != min(d[*][u]) b[u] = min(d[*][u]); change = true; if change send_to_neighbors(b); } recv_update(v, n) { change = false; foreach u in Graph // Update distance to u through n d[n][u] = c[n] + v[u]; // If new min distance, update if b[u] != min(d[*][u]) b[u] = min(d[*][u]); change = true; if change send_to_neighbors(b); }

  14. Group Work: DV Routing “Game” • Groups of 5-10 • Pair up so there are 5 nodes • Worksheet • Node name • Link state: (neighbor, cost) • Rules • No talking • You can tell your group what node you are • Can ask questions • Communicate via pieces of paper • Write and hand messages only to neighbors • Message format: (A - __ B - __ C - __ D - __ E - __) • After converge route a piece of paper from A to B • Write your node on the paper before forwarding, to show the path • Node B bring paper to me • First group to finish get a prize!

  15. Distance Vector (DV) Routing /* Distance to node u through neighbor n. Initialized all to infinity. */ d[n][u] = infinity; /* Distance to neighbor n. Know from beginning. */ c[n] = {…}; /* Best distances, initialize all as infinity. */ b[u] = infinity; initialize() { /* Set all values can from known neighbor distances. */ foreachn in Neighbor d[n][n] = c[n]; b[n] = c[n]; send_to_neighbors(b); } link_update(l, n) { // Diff between old and new a = c[n] – l; c[n] = l; change = false; foreachu in Graph // Update distance to u through n d[n][u] += a; // If new min distance, update if b[u] != min(d[*][u]) b[u] = min(d[*][u]); change = true; if change send_to_neighbors(b); } recv_update(v, n) { change = false; foreach u in Graph // Update distance to u through n d[n][u] = c[n] + v[u]; // If new min distance, update if b[u] != min(d[*][u]) b[u] = min(d[*][u]); change = true; if change send_to_neighbors(b); } • After converge route a piece of paper from A to B • Write your node on the paper before forwarding, to show the path • Node B bring paper to me • First group to finish get a prize!

  16. DV Routing: Scenario 1 1 D E 1 8 A->B path = A –> D –> E –> C –> B 1 4 A C B 6 1

  17. DV: initialize() 6 D B 1 2 1 C A 5 initialize() { foreach u in Graph b[u] = nil; foreach n in Neighbor foreachu in Graph d[n][u] = infinity; d[n][n] = c[n]; send_vector_to_neighbors(); } B->ACD: {(A, 2), (C, 1), (D, 6)} n n n n u u u u

  18. DV: Message 1 6 B->ACD: {(A, 2), (C, 1), (D, 6)} D B 1 2 1 C A 5 recv_update(v, n) { change = false; foreach u in Graph d[n][u] = c[n] + v[u]; if d[b[u]][u] > d[n][u] b[u] = n; change = true; if change send_vector_to_neighbors(); } C->ABD: {(A, 3), (B, 1), (D, 1)} n n n n u u u u

  19. DV: Message 2 6 B->ACD: {(A, 2), (C, 1), (D, 6)} C->ABD: {(A, 3), (B, 1), (D, 1)} D B 1 2 1 C A 5 recv_update(v, n) { change = false; foreach u in Graph d[n][u] = c[n] + v[u]; if d[b[u]][u] > d[n][u] b[u] = n; change = true; if change send_vector_to_neighbors(); } A->BC: {(B, 2), (C, 3), (D, 6)} n n n n u u u u

  20. DV: Message 3 6 B->ACD: {(A, 2), (C, 1), (D, 6)} C->ABD: {(A, 3), (B, 1), (D, 1)} A->BC: {(B, 2), (C, 3), (D, 6)} D B 1 2 1 C A 5 recv_update(v, n) { change = false; foreach u in Graph d[n][u] = c[n] + v[u]; if d[b[u]][u] > d[n][u] b[u] = n; change = true; if change send_vector_to_neighbors(); } No change D->BC: {(A, 4), (B, 2), (C, 1)} n n n n u u u u

  21. DV: Message 4 6 B->ACD: {(A, 2), (C, 1), (D, 6)} C->ABD: {(A, 3), (B, 1), (D, 1)} A->BC: {(B, 2), (C, 3), (D, 6)} D->BC: {(A, 4), (B, 2), (C, 1)} D B 1 2 1 C A 5 recv_update(v, n) { change = false; foreach u in Graph d[n][u] = c[n] + v[u]; if d[b[u]][u] > d[n][u] b[u] = n; change = true; if change send_vector_to_neighbors(); } No change B->ACD: {(A, 2), (C, 1), (D, 2)} n n n n u u u u

  22. DV: Message 5 6 B->ACD: {(A, 2), (C, 1), (D, 6)} C->ABD: {(A, 3), (B, 1), (D, 1)} A->BC: {(B, 2), (C, 3), (D, 6)} D->BC: {(A, 4), (B, 2), (C, 1)} B->ACD: {(A, 2), (C, 1), (D, 2)} D B 1 2 1 C A 5 recv_update(v, n) { change = false; foreach u in Graph d[n][u] = c[n] + v[u]; if d[b[u]][u] > d[n][u] b[u] = n; change = true; if change send_vector_to_neighbors(); } A->BC: {(B, 2), (C, 3), (D, 4)} n n n n u u u u

  23. DV: Message 6 6 B->ACD: {(A, 2), (C, 1), (D, 6)} C->ABD: {(A, 3), (B, 1), (D, 1)} A->BC: {(B, 2), (C, 3), (D, 6)} D->BC: {(A, 4), (B, 2), (C, 1)} B->ACD: {(A, 2), (C, 1), (D, 2)} A->BC: {(B, 2), (C, 3), (D, 4)} D B 1 2 1 C A 5 recv_update(v, n) { change = false; foreach u in Graph d[n][u] = c[n] + v[u]; if d[b[u]][u] > d[n][u] b[u] = n; change = true; if change send_vector_to_neighbors(); } Converged! n n n n u u u u

  24. DV Routing: Scenario 2 • Flip paper to other side • Same node • But new forwarding table! • Something happens to your network! • Same Rules • No talking • You can tell your group what node you are (but that’s it!) • Can ask me questions • Communicate via pieces of paper • Write and hand messages only to neighbors • Go!

  25. Distance Vector (DV) Routing /* Distance to node u through neighbor n. Initialized all to infinity. */ d[n][u] = infinity; /* Distance to neighbor n. Know from beginning. */ c[n] = {…}; /* Best distances, initialize all as infinity. */ b[u] = infinity; initialize() { /* Set all values can from known neighbor distances. */ foreachn in Neighbor d[n][n] = c[n]; b[n] = c[n]; send_to_neighbors(b); } link_update(l, n) { // Diff between old and new a = c[n] – l; c[n] = l; change = false; foreachu in Graph // Update distance to u through n d[n][u] += a; // If new min distance, update if b[u] != min(d[*][u]) b[u] = min(d[*][u]); change = true; if change send_to_neighbors(b); } recv_update(v, n) { change = false; foreach u in Graph // Update distance to u through n d[n][u] = c[n] + v[u]; // If new min distance, update if b[u] != min(d[*][u]) b[u] = min(d[*][u]); change = true; if change send_to_neighbors(b); }

  26. DV Routing: Scenario 2 2 C->ABE: (E, 6) A->CD: (E, 8) B->CD: (E, 8) D->AB: (E, 10) C->ABE: (E, 10) A->CD: (E, 12) B->CD: (E, 12) D->AB: (E, 14) C->ABE: (E, 14) A->CD: (E, 16) B->CD: (E, 16) D->AB: (E, 18) C->ABE: (E, 18) A->CD: (E, 20) B->CD: (E, 20) D->AB: (E, 22) C->ABE: (E, 19) A->CD: (E, 21) B->CD: (E, 21) D->AB: (E, 23) D B 2 2 A C 2 2 19 E Count to Infinity!

  27. Count to infinity [1] A 1 B 1 C

  28. Count to infinity [2] A ∞ B 1 C

  29. Count to infinity [2] A ∞ B 1 B->C: { (A, 3), … } C

  30. Count to infinity [3] A ∞ B 1 C C->B: { (A, 4), … }

  31. Count to infinity [4] A ∞ B 1 B->C: { (A, 5), … } C …and they counted happily ever after to infinity!

  32. Why does this occur? • Routers B and C don’t know that their paths to A are through each other! • Poison Reverse: To the neighbor who is providing me my best path, I advertise a cost of infinity

  33. DV Routing: Poison Reverse send_to_neighbors(b) { foreachn in Neighbors send(b); } send_to_neighbors_poison_reverse(b) { foreachn in Neighbors c = copy(b); foreach u in Graph // If use neighbor to get u, say cost is infinity if n == min_neighbor(d[*][u]) // Tie-breaker: alphabetic c[u] = infinity; send(c); }

  34. Count to infinity [1] A 1 B 1 C

  35. DV Routing: Scenario 2 2 D B 2 2 A C 2 2 19 E Before link change with Poison Reverse

  36. DV Routing: Scenario 2 2 C-> A: (E, 19) B: (E, 19) E: (E, ?) A-> C: (E, ?) D: (E, 21) B-> C: (E, 8) D: (E, ?) D-> A: (E, 23) B: (E, ?) C-> A: (E, 10) B: (E, ?) E: (E, 10) A-> C: (E, ?) D: (E, 12) B-> C: (E, ?) D: (E, ?) D-> A: (E, ?) B: (E, 16) C-> A: (E, 19) B: (E, 19) E: (E, ?) A-> C: (E, ?) D: (E, 21) D-> A: (E, ?) B: (E, 23) B-> C: (E, ?) D: (E, 21) D B 2 2 A C 2 2 19 E

  37. Link-State vs. Distance Vector Link-State Distance Vector Message complexity Messages only between neighbors Link cost change -> notify only if changes the cost of the min path Speed of convergence Can be slow Potential of loops Count-to-infinity Robustness Node’s table dependent on other nodes’ calculations • Message complexity • O(|N||E|) messages sent • Link cost change -> everyone notified • Speed of convergence • O(|N|2) with O(|N||E|) messages • Robustness • Table calculation semi-separated between nodes

More Related