CPS-356- Computer Networks Class 9: IP-Continued Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis, John Jannotti Administrivia • Slides Updates – Class slides 08 updated – Class slides 06 updated – Class slides 07 uploaded – • HW #1 put up on site • Can we move exams? Distance Vector Recap A 4 A C 1 C B 4 B 4 B C 1 0 C 1 A C 10 A 10 A B 1 B • Neighbor information is preconfigured – The link cost to a neigh and the link to that neighbor • Nodes exchange message with neighbors – (cost, dest) • Pick the shortest paths Distance Vector Recap A 4 A C 1 C (A,4) (C,1) B (B,4) (C,10) 4 B 4 B C 1 0 C (A,10) (B,1) 1 A C 10 A 10 A B 1 B • Neighbor information is preconfigured – The link cost to a neigh and the link to that neighbor • Nodes exchange message with neighbors – (cost, dest) • Pick the shortest paths Distance Vector Recap From A (B,4), (C,10) From C (A,10), (B,1) 4 C 1 C B 4 B C 1 0 C A B 4 From C (A,10), (B,1) From B (A,4), (C,1) A From B (A,4), (C,1) From A (B,4), (C,10) 1 A C 10 • Pick the shortest paths A 10 A B 1 B Distance Vector Recap From A (B,4), (C,10) From C (A,10), (B,1) 4 C 1 C B 4 B C 1 0 C A B 4 From C (A,10), (B,1) From B (A,4), (C,1) A From B (A,4), (C,1) From A (B,4), (C,10) 1 A C 10 • Pick the shortest paths A 10 A B 1 B Distance Vector Recap From A (B,4), (C,10) From C (A,10), (B,1) 4 C 1 C B 4 B C 5 B A B 4 From C (A,10), (B,1) From B (A,4), (C,1) A From B (A,4), (C,1) From A (B,4), (C,10) 1 A C 10 • Pick the shortest paths A 5 B B 1 B Distance Vector Recap A 4 A C 1 C B (B,4) (C,5) 4 B 4 B C 5 B (A,5) (B,1) 1 A C 10 A 5 B B 1 B • Pick the shortest paths • Update message are triggered by – Change in Routing Table – Or periodically every N seconds, by a timer Good news travels fast A 4 A C 1 C B 1 B 4 B C 5 B 4 1 A C 10 A 5 B B 1 B • A decrease in link cost has to be fresh information • Network converges at most in O(diameter) steps Good news travels fast A 1 A C 1 C (A,1) (C,1) B 1 (B,1) (C,10) B 1 B C 5 B 4 1 A C 10 A 5 B B 1 B • A decrease in link cost has to be fresh information • Network converges at most in O(diameter) steps Good news travels fast A 1 A C 1 C B 1 B 1 B C 5 B 4 1 A (A,1) (C,1) C 10 (B,1) (C,10) A 5 B B 1 B • A decrease in link cost has to be fresh information • Network converges at most in O(diameter) steps Good news travels fast A 1 A C 1 C B 1 B 1 B C 5 B 4 1 A (A,1) (C,1) C 10 (B,1) (C,10) A 2 B B 1 B • A decrease in link cost has to be fresh information • Network converges at most in O(diameter) steps Good news travels fast A 1 A C 1 C B 1 (B,1) (C,2) B 1 B C 2 B 4 (A,2) (B,1) 1 A C 10 A 2 B B 1 B • A decrease in link cost has to be fresh information • Network converges at most in O(diameter) steps Bad news travels slowly A 1 A C 1 C B 4 B 1 B C 5 B 1 A C 10 A 5 B B 1 B • An increase in cost may cause confusion with old information, may form loops • Consider routes to A • Initially, B:A,4,A; C:A,5,B • Then B:A,12,A, selects C as next hop -> B:A,6,C • C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; • C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly A 6 C 12 B 1 B C 5 B A 4 A C 1 C B 4 1 A C 10 A 5 B B 1 B • An increase in cost may cause confusion with old information, may form loops • Consider routes to A • Initially, B:A,4,A; C:A,5,B • Then B:A,12,A, selects C as next hop -> B:A,6,C • C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; • C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 2 B A 12 A C 1 C B 4 1 A C 10 A 5 B • B 1 B C 1 B An increase in cost may cause confusion with old information, may form loops 3 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 2 B A 12 A C 1 C B 4 (A,5) (B,1) 1 A C 10 A 5 B • B 1 B C 1 B An increase in cost may cause confusion with old information, may form loops 3 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 6 C C 1 C B 4 (A,5) (B,1) 1 A C 10 A 5 B • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 6 C C 1 C (A,6) (C,1) B 4 1 A C 10 A 5 B • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 6 C C 1 C (A,6) (C,1) B 4 1 A C 10 A 7 B • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 6 C C 1 C B 4 (A,7) (B,1) 1 A C 10 A 7 B • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 8 C C 1 C (A,8) (C,1) B 4 1 A C 10 A 7 B • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 8 C C 1 C B 4 (A,9) (B,1) 1 A C 10 A 9 B • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 10 C C 1 C (A,10) (C,1) B 4 1 A C 10 A 9 B • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! Bad news travels slowly 12 B 1 1 C A 10 C C 1 C (A,10) (C,1) B 4 (A,10) (B,1) 1 A C 10 A 10 A • B 1 B C 1 C An increase in cost may cause confusion with old information, may form loops 0 • • • • • Consider routes to A Initially, B:A,4,A; C:A,5,B Then B:A,12,A, selects C as next hop -> B:A,6,C C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C; C finally chooses C:A,10,A, and B -> A,11,C! How to avoid loops • IP TTL field prevents a packet from living forever – Does not repair a loop • Simple approach: consider a small cost n (e.g., 16) to be infinity – After n rounds decide node is unavailable – But rounds can be long, this takes time • Problem: distance vector based only on local information Bad news travels slowly 12 B 1 1 C C 1 0 C A 6 C C 1 C (A,6) (C,1) B 4 (A,5) (B,1) 1 A C 10 A 5 B B 1 B • Why did it take a while to converge? – Nodes are unknowingly using each other Better loop avoidance • Split Horizon – When sending updates to node A, don’t include routes you learned from A – Prevents B and C from sending cost 2 to A • Split Horizon with Poison Reverse – Rather than not advertising routes learned from A, explicitly include cost of ∞. – Faster to break out of loops, but increases advertisement sizes Split Horizon A 4 A C 1 C (A,4) (C,1) B (B,4) (C,10) 4 B 4 B C 1 0 C (A,10) (B,1) 1 A C 10 A 10 A B 1 • Why did it take a while to converge? – Nodes are unknowingly using each other B Split Horizon A 4 A C 1 C B (B,4) (C,10) 4 B 4 B C 5 B (A,10) (B,1) 1 A C 10 (B,4) (C,5) (A,5) (B,1) A 5 B B 1 B • Why did it take a while to converge? – Nodes are unknowingly using each other Split Horizon 12 (B,4) (C,10) B 1 2 B C 1 3 B A 12 A C 1 C B 4 (A,10) (B,1) 1 A C 10 (B,4) (C,5) (A,5) (B,1) A 5 B B 1 B • Why did it take a while to converge? – Nodes are unknowingly using each other Split Horizon 12 (B,4) (C,10) B 1 1 C C 1 0 C A 12 A C 1 C B 4 (A,10) (B,1) 1 A C 10 (B,4) (C,5) (A,5) (B,1) A 5 B B 1 B • Why did it take a while to converge? – Nodes are unknowingly using each other Split Horizon 12 B 1 1 C C 1 0 C A 12 A C 1 C (A,12) (C,1) B 4 (A,10) (B,1) 1 A C 10 A 5 B B 1 B • Why did it take a while to converge? – Nodes are unknowingly using each other Split Horizon 12 B 1 1 C C 1 0 C A 12 A C 1 C (A,12) (C,1) B 4 (A,10) (B,1) 1 A C 10 A 10 B B 1 • Why did it take a while to converge? – Nodes are unknowingly using each other B Split Horizon 12 B 1 1 C C 1 0 C A 12 A C 1 C (A,12) (C,1) B 4 (A,10) (B,1) 1 A C 10 A 10 B B 1 • Why did it take a while to converge? – Nodes are unknowingly using each other B Split Horizon 12 B 1 1 C C 1 0 C A 11 A C 1 C (A,12) (C,1) B 4 (A,10) (B,1) 1 A C 10 A 10 B B 1 • Why did it take a while to converge? – Nodes are unknowingly using each other B Warning • Split horizon/split horizon with poison reverse only help between two nodes – Can still get loop with three nodes involved – Might need to delay advertising routes after changes, but affects convergence time Other approaches • DSDV: destination sequenced distance vector – Uses a ‘version’ number per destination message – Avoids loops by preventing nodes from using old information from descendants – But, you can only update when new version comes from root • Path Vector: (BGP) – Replace ‘distance’ with ‘path’ – Avoids loops with extra cost Link State Routing • Strategy: – send to all nodes information about directly connected neighbors • Link State Packet (LSP) – ID of the node that created the LSP – Cost of link to each directly connected neighbor – Sequence number (SEQNO) – TTL Time 0: Generate LSP from Config File and Send out Updates B 4 C 1 5 B 4 A C 1 6 10 D • Directly Connected Neighbors are preconfigured into the device Time 0: Generate LSP from Config File and Send out Updates B 4 C 1 5 B 4 A C 1 6 10 D • Directly Connected Neighbors are preconfigured into the device Reliable Flooding • Store most recent LSP from each node – Ignore earlier versions of the same LSP • Forward LSP to all nodes but the one that sent it • Generate new LSP periodically – Increment SEQNO • Start at SEQNO=0 when reboot – If you hear your own packet with SEQNO=n, set your next SEQNO to n+1 • Decrement TTL of each stored LSP – Discard when TTL=0 Time 1: Receive LSPs B 4 C 1 B 4 C 1 5 B 4 A C 1 6 10 D • When a node gets an LSA, it floods it on all ports except the port it received it from. Time 1: Receive LSPs B 4 C 1 B 4 C 1 5 B 4 A C 1 6 10 D • When a node gets an LSA, it floods it on all ports except the port it received it from. Time 10: Regenerate LSP and send out 5 B 4 A C 1 6 10 D • Generate new LSP periodically – Increment SEQNO Calculating best path • Djikstra’s single-source shortest path algorithm – Each node computes shortest paths from itself • Let: – N denote set of nodes in the graph – l(i,j) denote the non-negative link between i,j • ∞ if there is no direct link between i and j – C(n) denote the cost of path from s to n – s denotes yourself (node computing paths) • Initialize variables – M = {s} (set of nodes incorporated thus far) – For each n in N-{s}, C(n) = l(s,n) – Next(n) = n if l(s,n) < ∞, – otherwise Djikstra’s Algorithm • While N≠M – Let w ∈(N-M) be the node with lowest C(w) – M = M {w} – Foreach n ∈ (N-M), if C(w) + l(w,n) < C(n) then C(n) = C(w) + l(w,n), Next(n) = Next(w) • Example: D: (D,0,-) (C,2,C) (B,5,C) (A,10,C) Draw Backs of Link State Protocols Draw Backs of Link State Protocols • Scalability – A lot of Network packets (Flooding of LSPs) – A lot computation overhead, for each router: • Router Memory: to store entire network • Router CPU: to calculate Dijkstra To Scale Add Areas (Hierarchy) Backbone (Area 0) B C A D X Area 1 Z F Y E Area 2 • Divide into backbone and other areas To Scale Add Areas (Hierarchy) Backbone (Area 0) B C A D X Area 1 Z F Y E Area 2 • Divide into backbone and other areas • An area must know how to route within itself – LSPs are contained to an area: never flood outside of your area – This provides scaling properties • To route between two areas, you must go through the backbone To Scale Add Areas (Hierarchy) Backbone (Area 0) B C A Area 1 Area 2 • Divide into backbone and other areas • An area must know how to route within itself – LSPs are contained to an area: never flood outside of your area – This provides scaling properties in all areas except Area 0 • To route between two areas, you must go through the backbone • Backbone know how to route between areas but not how to route within other areas. – Backbone views each area as one node – Allows scaling in the backbones Distance Vector vs. Link State Distance Vector Link State # of Messages O(d), where d is degree of node O(nd) for n nodes in system Computation convergence time varies (e.g., countto-infinity) O(n2) with O(nd) messages Robustness: what happens with malfunctioning router? Nodes can advertise incorrect path cost Nodes can advertise incorrect link cost Others can use the cost, propagates through network May get correct link information from another node Metrics • Original ARPANET metric – measures number of packets enqueued in each link – neither latency nor bandwidth in consideration • New ARPANET metric – Stamp arrival time (AT) and departure time (DT) – When link-level ACK arrives, compute Delay = (DT – AT) + Transmit + Latency – If timeout, reset DT to departure time for retransmission – Link cost = average delay over some time period • Fine Tuning – Compressed dynamic range – Replaced Delay with link utilization • Today: commonly set manually to achieve specific goals Examples of Distance Vector & Link State • Distance Vector: RIPv2 – Fairly simple implementation of DV – RFC 2453 (38 pages) • Link State: OSPF (Open Shortest Path First) – More complex link-state protocol – Adds notion of areas for scalability – RFC 2328 (244 pages) RIPv2: Default on Several Cisco Routers • Runs on UDP port 520 • Link cost = 1 • Periodic updates every 30s, plus triggered updates • Relies on count-to-infinity to resolve loops – Maximum diameter 15 (∞ = 16) – Supports split horizon, poison reverse • Deletion – If you receive an entry with metric = 16 from parent OR – If a route times out OSPFv2: Costs more to activate on Several Cisco Routers • Link state protocol • Runs directly over IP (protocol 89) – Has to provide its own reliability • All exchanges are authenticated • Adds notion of areas for scalability Other Routing Protocols Routing Protocol Name Type of Protocol IS-IS (intermediate system –to- intermediate system) Link State Protocol IGRP (Interior Gateway Routing Protocol) Distance Vector Protocol BGP (border Gateway Protocol) Distance-Vector (with Paths) “Path-Vector” Now You Have Your Routes, what next? Bring it All Together: Ethernet + IP Step 0: Operator preconfigures routers with IP addresses 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 Router C 128.35.6.*/24 Router B 128.35.9.*/24 128.35.7.*/24 G H G H Bring it All Together: Ethernet + IP Step 1: Router builds Routing Table using Routing Protocol 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 Router B 128.35.9.*/24 128.35.7.*/24 G H G H Bring it All Together: Ethernet + IP Step 2: Get Your IP Address (DHCP) 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 Router B 128.35.7.*/24 G 128.35.9.*/24 H G H Bring it All Together: Ethernet + IP Step 2: Bonus Switch Learns (Learning Switch) 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.7.*/24 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H Bring it All Together: Ethernet + IP Step 2: Bonus Switch Learns (Learning Switch) 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 3: Get Dest-IP Address (DNS) Source: MAC_A:128.35.7.2 Dest:UNKnown MAC: 128.35.5 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 4: Get Dest MAC Address (ARP) Source: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.5 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 4: Get Dest MAC Address (ARP) Source: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.5 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.9.*/24 128.35.8.*/24 128.35.8.*/24 128.35.7.*/24 your IP address with destination IP address128.35.6.*/24 128.35.7.*/24 128.35.8.*/24 Compare Source IP: 128.35.7.2 Router C Router B You netmaskMAC_Y is 128.35.7.*/24 so you network has: 128.35.7.0-128.35.7.255 MAC_Z Dest IP: 128.35.7.5 Destination is in your network range, so you have to send to the destination!!! MAC_ASo you ARPMAC_A for the MAC address of the destination. 128.35.9.*/24 MAC_E MAC_B MAC_E MAC_B MAC_Z MAC_Y MAC_Z MAC_Y G H G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 4: Get Dest MAC Address (ARP) Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.35.5 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 5: Send packets Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.35.5 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y IP: A->B MAC: A->B 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 5: Send packets Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.35.5 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.7.*/24 MAC_A: 128.35.7.2 IP: A->B MAC: A->B MAC_B: 128.35.7.5 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 3: Get Dest-IP Address (DNS) Alice to Eve Source: MAC_A:128.35.7.2 Dest:UNKnown MAC: 128.35.9.9 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 4: Get Dest MAC Address (ARP) Alice to Eve Source: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.9.9 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 4: Get Dest MAC Address (ARP) Alice to Eve Source: MAC_A:128.35.7.2 Dest:UnKnown MAC: 128.35.9.9 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.9.*/24 128.35.8.*/24 128.35.8.*/24 128.35.7.*/24 your IP address with destination IP address128.35.6.*/24 128.35.7.*/24 128.35.8.*/24 Compare Source IP: 128.35.7.2 Router C Router B You netmaskMAC_Y is 128.35.7.*/24 so you network has: 128.35.7.0-128.35.7.255 MAC_Z Dest IP: 128.35.9.9 Destination is not in your network range, so you have to send to router!!! MAC_A So you ARP for the MAC address of the router. 128.35.9.*/24 MAC_A MAC_E MAC_B MAC_E MAC_B MAC_Z MAC_Y MAC_Z MAC_Y G H G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 4: Get Dest MAC Address (ARP) Source: MAC_A:128.35.7.2 Dest: MAC_Y: 128.35.9.9 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 5: Send packets Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5 128.35.8.*/24 Router Y MAC_Y IP: A->E MAC: A->Y 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 MAC_A MAC_B MAC_Y G Router Z MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 5: Send packets Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 IP: A->E Router C MAC: A->Z MAC_Y MAC_A MAC_B MAC_Y G 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 5: Send packets Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 IP: A->E Router B MAC_Z MAC: A->E MAC_A MAC_B MAC_Y H 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 MAC_E: 128.35.9.9 Bring it All Together: Ethernet + IP Step 5: Send packets Source: MAC_A:128.35.7.2 Dest: MAC_B: 128.357.5 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.6.*/24 128.35.6.*/24 128.35.9.*/24 128.35.8.*/24 128.35.7.*/24 128.35.8.*/24 Router C MAC_Y MAC_A MAC_B MAC_Y G Router B MAC_Z MAC_A MAC_B MAC_Y H 128.35.7.*/24 MAC_A: 128.35.7.2 MAC_B: 128.35.7.5 128.35.9.*/24 MAC_E MAC_E MAC_Z MAC_Z G H IP: A->E MAC: A-> MAC_E: 128.35.9.9 What Limitations Does Ethernet Have? • Minimum Packet Size – 64Bytes (512 bits): To ensure that collisions are detected! – Bandwidth-Delay-Product*2 • Maximum Ethernet LAN size – 2500 meters: Due to signal decay, any longer and packets would not be delivered A Router Does Two Things Forwarding (per-node operation): – how to pass a packet from an input interface to the output interface of a router – Destination based forwarding • Check destination IP and look it up in your forwarding table Routing (distributed algorithm): – how to find and setup a route? Implemented by dynamic routing protocols – OSPF, RIP Forwarding • Due to CIDR, Routers use longest prefix match Router Forwarding Table After OSPF or RIP 128.35.6.*/24, fwd port 1 128.35.*.*/16, fwd port 3 128.35.6.3/32, fwd port 6 128.35.7.*/24, fwd port 18 From From From From 128.35.6.0 128.35.0.0 128.35.6.3 128.35.7.0 To: 123.35.6.255 To: 123.35.255.255 To: 123.35.6.3 To: 128.35.7.255 Forwarding • Due to CIDR, Routers use longest prefix match Router Forwarding Table After OSPF or RIP 128.35.6.*/24, fwd port 1 128.35.*.*/16, fwd port 3 128.35.6.3/32, fwd port 6 128.35.7.*/24, fwd port 18 From From From From 128.35.6.0 128.35.0.0 128.35.6.3 128.35.7.0 To: 123.35.6.255 To: 123.35.255.255 To: 123.35.6.3 To: 128.35.7.255 Forwarding • Due to CIDR, Routers use longest prefix match Router Forwarding Table After OSPF or RIP 128.35.6.*/24, fwd port 1 128.35.*.*/16, fwd port 3 128.35.6.3/32, fwd port 6 128.35.7.*/24, fwd port 18 From From From From Packet with destination: 128.35.6.3. Which entry does it match? What port does it get forwarded on? 128.35.6.0 128.35.0.0 128.35.6.3 128.35.7.0 To: 123.35.6.255 To: 123.35.255.255 To: 123.35.6.3 To: 128.35.7.255 Forwarding • Due to CIDR, Routers use longest prefix match Router Forwarding Table After OSPF or RIP 128.35.6.*/24, fwd port 1 128.35.*.*/16, fwd port 3 128.35.6.3/32, fwd port 6 128.35.7.*/24, fwd port 18 From From From From Packet with destination: 128.35.6.8 Which entry does it match? What port does it get forwarded on? 128.35.6.0 128.35.0.0 128.35.6.3 128.35.7.0 To: 123.35.6.255 To: 123.35.255.255 To: 123.35.6.3 To: 128.35.7.255 Router Versus Switches Router Switches • Runs multiple switching protocols: Ethernet, ATM • Runs one switching protocol – Switches between techs • Runs routing protocols • Runs DHCP • Needs a common address across techs: IP address – E.g. Ethernet addresses make no sense to ATM hosts – Can only work with same tech • Dictates how bits become signals • Dictates how bits becomes a packet/frame • Needs hardware addresses to identify hosts/switches Summary • This Class – Link State protocols – Link State V. Distance Vector – Routing V Forwarding – How routing works within one ISP/AS • Next Class – Inter-Domain routing – Routing over the Wide Area Network