computer communication networks network
play

Computer Communication Networks Network ICEN/ICSI 416 Fall 2016 - PowerPoint PPT Presentation

Computer Communication Networks Network ICEN/ICSI 416 Fall 2016 Prof. Dola Saha 1 Network Layer Goals: understand principles behind network layer services, focusing on data plane: network layer service models forwarding


  1. Scheduling policies: priority priority scheduling: send highest high priority queue (waiting area) priority queued packet arrivals departures Ø multiple classes , with different priorities classify link (server) low priority queue § class may depend on marking or (waiting area) other header info, e.g. IP 2 5 1 4 3 source/dest, port numbers, etc. arrivals § real world example? packet in 1 3 2 4 5 service departures 1 3 2 4 5 25

  2. Scheduling policies: still more Round Robin (RR) scheduling: Ø multiple classes Ø cyclically scan class queues, sending one complete packet from each class (if available) Ø real world example? 2 5 4 1 3 arrivals packet in 1 3 2 4 service 5 departures 1 3 3 4 5 26

  3. Scheduling policies: still more Weighted Fair Queuing (WFQ): Ø generalized Round Robin Ø each class gets weighted amount of service in each cycle Ø real-world example? 27

  4. The Internet network layer host, router network layer functions: transport layer: TCP, UDP IP protocol routing protocols • addressing conventions • path selection • datagram format • RIP, OSPF, BGP network • packet handling conventions layer forwarding ICMP protocol table • error reporting • router “ signaling ” link layer physical layer 28

  5. IP datagram format IP protocol version 32 bits total datagram number length (bytes) header length type of head. ver length (bytes) service len for “ type ” of data fragment fragmentation/ flgs 16-bit identifier offset reassembly max number upper time to header remaining hops layer live checksum (decremented at 32 bit source IP address each router) 32 bit destination IP address upper layer protocol to deliver payload to e.g. timestamp, options (if any) record route data taken, specify how much overhead? (variable length, list of routers v 20 bytes of TCP typically a TCP to visit. v 20 bytes of IP or UDP segment) v = 40 bytes + app layer overhead 29

  6. IP fragmentation, reassembly network links have MTU (max. Ø transfer size) - largest possible link-level frame fragmentation: § different link types, different … in: one large datagram MTUs out: 3 smaller datagrams large IP datagram divided Ø ( “ fragmented ” ) within net reassembly § one datagram becomes several datagrams § “ reassembled ” only at final … destination § IP header bits used to identify, order related fragments 30

  7. IP fragmentation, reassembly length ID fragflag offset example: =4000 =x =0 =0 v 4000 byte datagram one large datagram becomes v MTU = 1500 bytes several smaller datagrams 1480 bytes in length ID fragflag offset data field =1500 =x =1 =0 offset = length ID fragflag offset 1480/8 =1500 =x =1 =185 length ID fragflag offset =1040 =x =0 =370 31

  8. IP Fragmentation and Reassembly IP datagrams traversing the sequence of physical networks 32

  9. IP Fragmentation and Reassembly Header fields used in IP fragmentation. (a) Unfragmented packet; (b) fragmented packets. 33

  10. IP addressing: introduction Ø IP address: 32-bit 223.1.1.1 identifier for host, router 223.1.2.1 interface 223.1.1.2 223.1.1.4 223.1.2.9 Ø interface: connection between host/router and 223.1.3.27 physical link 223.1.1.3 223.1.2.2 § router ’ s typically have multiple interfaces § host typically has one or two 223.1.3.2 223.1.3.1 interfaces (e.g., wired Ethernet, wireless 802.11) IP addresses associated with 223.1.1.1 = 11011111 00000001 00000001 00000001 Ø each interface 223 1 1 1 34

  11. IP addressing: introduction Q: how are interfaces 223.1.1.1 actually connected? 223.1.2.1 A: we’ll learn about 223.1.1.2 223.1.1.4 223.1.2.9 that later. 223.1.3.27 223.1.1.3 223.1.2.2 A: wired Ethernet interfaces connected by Ethernet switches 223.1.3.2 223.1.3.1 For now: don’t need to worry about how one interface is connected to another (with no intervening router) A: wireless WiFi interfaces connected by WiFi base station 35

  12. Subnets Ø IP address: 223.1.1.1 § subnet part - high order bits § host part - low order bits 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 Ø what ’ s a subnet ? 223.1.2.2 § device interfaces with same 223.1.3.27 223.1.1.3 subnet part of IP address subnet § can physically reach each other 223.1.3.2 without intervening router 223.1.3.1 network consisting of 3 subnets 36

  13. Subnets recipe 223.1.1.0/24 223.1.2.0/24 § to determine the subnets, 223.1.1.1 detach each interface from 223.1.2.1 223.1.1.2 its host or router, creating 223.1.1.4 223.1.2.9 islands of isolated 223.1.2.2 223.1.3.27 223.1.1.3 networks subnet § each isolated network is 223.1.3.2 called a subnet 223.1.3.1 223.1.3.0/24 subnet mask: /24 37

  14. Global Addresses Properties Ø § globally unique § hierarchical: network + host § 4 Billion IP address, half are A type, ¼ is B type, and 1/8 is C type Format Ø Class A Class B Dot notation Ø § 10.3.2.4 Class C § 128.96.33.81 § 192.12.69.77 38

  15. Subnetting Add another level to address/routing hierarchy: subnet Ø Subnet masks define variable partition of host part of class A and B Ø addresses Subnets visible only within site Ø 39

  16. Subnetting Forwarding Table at Router R1 Ø 40

  17. Subnetting Forwarding Algorithm D = destination IP address for each entry < SubnetNum, SubnetMask, NextHop> D1 = SubnetMask & D if D1 = SubnetNum if NextHop is an interface deliver datagram directly to destination else deliver datagram to NextHop (a router) 41

  18. Subnets how many? 223.1.1.2 223.1.1.1 223.1.1.4 223.1.1.3 223.1.9.2 223.1.7.0 223.1.9.1 223.1.7.1 223.1.8.1 223.1.8.0 223.1.2.6 223.1.3.27 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 42

  19. Classless Addressing Ø Classless Inter-Domain Routing § A technique that addresses two scaling concerns in the Internet The growth of backbone routing table as more and more network numbers need to o be stored in them Potential exhaustion of the 32-bit address space o § Address assignment efficiency Arises because of the IP address structure with class A, B, and C addresses o Forces us to hand out network address space in fixed-size chunks of three very o different sizes ü A network with two hosts needs a class C address Address assignment efficiency = 2/255 = 0.78 § ü A network with 256 hosts needs a class B address Address assignment efficiency = 256/65535 = 0.39 § 43

  20. Classless Addressing Exhaustion of IP address space centers on exhaustion of the class B Ø network numbers Solution Ø § Say “NO” to any Autonomous System (AS) that requests a class B address unless they can show a need for something close to 64K addresses § Instead give them an appropriate number of class C addresses § For any AS with at least 256 hosts, we can guarantee an address space utilization of at least 50% What is the problem with this solution? Ø 44

  21. Classless Addressing Ø Problem with this solution § Excessive storage requirement at the routers. Ø If a single AS has, say 16 class C network numbers assigned to it, § Every Internet backbone router needs 16 entries in its routing tables for that AS § This is true, even if the path to every one of these networks is the same Ø If we had assigned a class B address to the AS § The same routing information can be stored in one entry § Efficiency = 16 × 255 / 65, 536 = 6.2% 45

  22. Classless Addressing Ø CIDR tries to balance the desire to minimize the number of routes that a router needs to know against the need to hand out addresses efficiently. Ø CIDR uses aggregate routes § Uses a single entry in the forwarding table to tell the router how to reach a lot of different networks § Breaks the rigid boundaries between address classes 46

  23. Classless Addressing Consider an AS with 16 class C network numbers. Ø Instead of handing out 16 addresses at random, hand out a block of Ø contiguous class C addresses Suppose we assign the class C network numbers from 192.4.16 through Ø 192.4.31 Observe that top 20 bits of all the addresses in this range are the same Ø (11000000 00000100 0001) § We have created a 20-bit network number (which is in between class B network number and class C number) Requires to hand out blocks of class C addresses that share a common Ø prefix 47

  24. Classless Addressing Requires to hand out blocks of class C addresses that share a common Ø prefix The convention is to place a /X after the prefix where X is the prefix Ø length in bits For example, the 20-bit prefix for all the networks 192.4.16 through Ø 192.4.31 is represented as 192.4.16/20 By contrast, if we wanted to represent a single class C network number, Ø which is 24 bits long, we would write it 192.4.16/24 48

  25. Classless Addressing Ø How do the routing protocols handle this classless addresses § It must understand that the network number may be of any length Ø Represent network number with a single pair <length, value> Ø All routers must understand CIDR addressing 49

  26. Classless Addressing Route aggregation with CIDR 50

  27. IP Forwarding Revisited Ø IP forwarding mechanism assumes that it can find the network number in a packet and then look up that number in the forwarding table Ø We need to change this assumption in case of CIDR Ø CIDR means that prefixes may be of any length, from 2 to 32 bits 51

  28. IP Forwarding Revisited It is also possible to have prefixes in the forwarding tables that overlap Ø § Some addresses may match more than one prefix For example, we might find both 171.69 (a 16 bit prefix) and 171.69.10 Ø (a 24 bit prefix) in the forwarding table of a single router A packet destined to 171.69.10.5 clearly matches both prefixes. Ø § The rule is based on the principle of “longest match” 171.69.10 in this case o A packet destined to 171.69.20.5 would match 171.69 and not Ø 171.69.10 52

  29. IP addressing: CIDR CIDR: Classless InterDomain Routing • subnet portion of address of arbitrary length • address format: a.b.c.d/x, where x is # bits in subnet portion of address host subnet part part 11001000 00010111 0001000 0 00000000 200.23.16.0/23 53

  30. IP addresses: how to get one? Q: How does a host get IP address? Ø hard-coded by system admin in a file § Windows: control-panel->network->configuration->tcp/ip->properties § UNIX: /etc/rc.config Ø DHCP: Dynamic Host Configuration Protocol: dynamically get address from server § “ plug-and-play ” 54

  31. DHCP: Dynamic Host Configuration Protocol goal: allow host to dynamically obtain its IP address from network server when it joins network § can renew its lease on address in use § allows reuse of addresses (only hold address while connected/ “ on ” ) § support for mobile users who want to join network (more shortly) DHCP overview: § host broadcasts “ DHCP discover ” msg [optional] § DHCP server responds with “ DHCP offer ” msg [optional] § host requests IP address: “ DHCP request ” msg § DHCP server sends address: “ DHCP ack ” msg 55

  32. DHCP client-server scenario DHCP 223.1.1.0/24 server 223.1.2.1 223.1.1.1 arriving DHCP 223.1.1.2 223.1.1.4 223.1.2.9 client needs address in this network 223.1.2.2 223.1.3.27 223.1.1.3 223.1.2.0/24 223.1.3.1 223.1.3.2 223.1.3.0/24 56

  33. DHCP client-server scenario DHCP server: 223.1.2.5 arriving DHCP discover client src : 0.0.0.0, 68 Broadcast: is there a DHCP server dest.: 255.255.255.255,67 out there? yiaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 223.1.2.5, 67 Broadcast: I’m a DHCP server! dest: 255.255.255.255, 68 Here’s an IP address you can use yiaddrr: 223.1.2.4 transaction ID: 654 lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 Broadcast: OK. I’ll take that IP yiaddrr: 223.1.2.4 address! transaction ID: 655 lifetime: 3600 secs DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 Broadcast: OK. You’ve got that IP yiaddrr: 223.1.2.4 address! transaction ID: 655 lifetime: 3600 secs 57

  34. DHCP: more than IP addresses DHCP can return more than just allocated IP address on subnet: • address of first-hop router for client • name and IP address of DNS sever • network mask (indicating network versus host portion of address) 58

  35. DHCP: example § connecting laptop needs its IP DHCP DHCP address, addr of first-hop router, UDP DHCP addr of DNS server: use DHCP IP DHCP Eth DHCP Phy DHCP § DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in 802.1 Ethernet DHCP 168.1.1.1 DHCP DHCP UDP DHCP IP DHCP § Ethernet frame broadcast (dest: Eth router with DHCP DHCP FFFFFFFFFFFF ) on LAN, received at Phy server built into router running DHCP server router § Ethernet demuxed to IP demuxed, UDP demuxed to DHCP 59

  36. DHCP: example Ø DCP server formulates DHCP ACK DHCP DHCP containing client ’ s IP address, IP address UDP DHCP IP DHCP of first-hop router for client, name & IP Eth DHCP address of DNS server Phy § encapsulation of DHCP server, frame forwarded to client, DHCP DHCP demuxing up to DHCP at client UDP DHCP IP DHCP Eth router with DHCP DHCP § client now knows its IP Phy server built into DHCP address, name and IP address router of DSN server, IP address of its first-hop router 60

  37. IP addresses: how to get one? Q: how does network get subnet part of IP addr? A: gets allocated portion of its provider ISP ’ s address space ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23 61

  38. IP addressing: the last word... Q: how does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers http://www.icann.org/ • allocates addresses • manages DNS • assigns domain names, resolves disputes 62

  39. NAT: network address translation rest of local network Internet (e.g., home network) 10.0.0.1 10.0.0/24 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 all datagrams leaving local datagrams with source or network have same single source destination in this network NAT IP address: have 10.0.0/24 address for 138.76.29.7,different source port source, destination (as usual) numbers 63

  40. NAT: network address translation motivation: local network uses just one IP address as far as outside world is concerned: § range of addresses not needed from ISP: just one IP address for all devices § can change addresses of devices in local network without notifying outside world § can change ISP without changing addresses of devices in local network § devices inside local net not explicitly addressable, visible by outside world (a security plus) 64

  41. NAT: network address translation implementation : NAT router must: § outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #) . . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr § remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair § incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table 65

  42. NAT: network address translation NAT translation table 1: host 10.0.0.1 2: NAT router WAN side addr LAN side addr sends datagram to changes datagram 128.119.40.186, 80 138.76.29.7, 5001 10.0.0.1, 3345 source addr from …… …… 10.0.0.1, 3345 to 138.76.29.7, 5001, updates table S: 10.0.0.1, 3345 D: 128.119.40.186, 80 10.0.0.1 1 S: 138.76.29.7, 5001 2 10.0.0.4 D: 128.119.40.186, 80 10.0.0.2 138.76.29.7 S: 128.119.40.186, 80 4 D: 10.0.0.1, 3345 S: 128.119.40.186, 80 3 10.0.0.3 D: 138.76.29.7, 5001 4: NAT router 3: reply arrives changes datagram dest. address: dest addr from 138.76.29.7, 5001 138.76.29.7, 5001 to 10.0.0.1, 3345 66

  43. NAT: network address translation Ø 16-bit port-number field: § 60,000 simultaneous connections with a single LAN-side address! Ø NAT is controversial: § routers should only process up to layer 3 § address shortage should be solved by IPv6 § violates end-to-end argument o NAT possibility must be taken into account by app designers, e.g., P2P applications 67

  44. IPv6: motivation Ø initial motivation: 32-bit address space soon to be completely allocated. Ø additional motivation: § header format helps speed processing/forwarding § header changes to facilitate QoS IPv6 datagram format: § fixed-length 40 byte header § no fragmentation allowed 68

  45. IPv6 datagram format priority: identify priority among datagrams in flow flow Label: identify datagrams in same “flow.” (concept of “flow” not well defined). next header: identify upper layer protocol for data pri ver flow label hop limit payload len next hdr source address (128 bits) destination address (128 bits) data 32 bits 69

  46. Other changes from IPv4 Ø checksum : removed entirely to reduce processing time at each hop Ø options: allowed, but outside of header, indicated by “Next Header” field Ø ICMPv6: new version of ICMP § additional message types, e.g. “Packet Too Big” § multicast group management functions 70

  47. Transition from IPv4 to IPv6 Ø not all routers can be upgraded simultaneously § no “flag days” § how will network operate with mixed IPv4 and IPv6 routers? Ø tunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers IPv6 header fields IPv4 header fields IPv4 payload IPv6 source dest addr IPv4 source, dest addr UDP/TCP payload IPv6 datagram IPv4 datagram 71

  48. Tunneling IPv4 tunnel A B E F connecting IPv6 routers logical view: IPv6 IPv6 IPv6 IPv6 C A B D E F physical view: IPv6 IPv6 IPv6 IPv4 IPv4 IPv6 72

  49. Tunneling IPv4 tunnel A B E F connecting IPv6 routers logical view: IPv6 IPv6 IPv6 IPv6 C A B D E F physical view: IPv6 IPv6 IPv6 IPv4 IPv4 IPv6 src:B src:B flow: X flow: X src: A dest: E src: A dest: E dest: F dest: F Flow: X Flow: X Src: A Src: A Dest: F Dest: F data data data data A-to-B: E-to-F: B-to-C: B-to-C: IPv6 IPv6 IPv6 inside IPv6 inside IPv4 IPv4 73

  50. IPv6: adoption Google: 11% of clients access services via IPv6 § NIST: 1/3 of all US government domains are IPv6 capable § Long (long!) time for deployment, use § • More than 20 years and counting! [IETF initiated standardization of IPv6 in 1994] • think of application-level changes in last 20 years: WWW, Facebook, streaming media, Skype, … https://www.google.com/intl/en/ipv6/statistics.html 74

  51. Internet Control Message Protocol (ICMP) Defines a collection of error messages that are sent back to the source Ø host whenever a router or host is unable to process an IP datagram successfully § Destination host unreachable due to link /node failure § Reassembly process failed § TTL had reached 0 (so datagrams don't cycle forever) § IP header checksum failed ICMP-Redirect Ø § From router to a source host § With a better route information 75

  52. Internet Control Message Protocol (ICMP) Defines a collection of error messages that are sent back to the source Ø host whenever a router or host is unable to process an IP datagram successfully § Destination host unreachable due to link /node failure § Reassembly process failed § TTL had reached 0 (so datagrams don't cycle forever) § IP header checksum failed ICMP-Redirect Ø § From router to a source host § With a better route information 76

  53. ICMP: internet control message protocol used by hosts & routers to Ø communicate network-level Type Code description information 0 0 echo reply (ping) § error reporting: unreachable host, 3 0 dest. network unreachable 3 1 dest host unreachable network, port, protocol 3 2 dest protocol unreachable § echo request/reply (used by ping) 3 3 dest port unreachable network-layer “above” IP: Ø 3 6 dest network unknown 3 7 dest host unknown § ICMP msgs carried in IP datagrams 4 0 source quench (congestion ICMP message: type, code plus Ø control - not used) first 8 bytes of IP datagram 8 0 echo request (ping) 9 0 route advertisement causing error 10 0 router discovery 11 0 TTL expired 12 0 bad IP header 77

  54. Traceroute and ICMP Ø source sends series of UDP segments when ICMP message arrives, to destination source records RTTs § first set has TTL =1 § second set has TTL=2, etc. stopping criteria: § unlikely port number § UDP segment eventually Ø when datagram in n th set arrives to arrives at destination host nth router: § destination returns ICMP “port unreachable” message (type 3, § router discards datagram and sends source code 3) ICMP message (type 11, code 0) § source stops § ICMP message include name of router & IP address 3 probes 3 probes 3 probes 78

  55. Routing protocols Routing protocol goal: determine “good” paths (equivalently, routes), from sending hosts to receiving host, through network of routers Ø path: sequence of routers packets will traverse in going from given initial source host to given final destination host Ø “good”: least “cost”, “fastest”, “least congested” Ø routing: a “top-10” networking challenge! 79

  56. Graph abstraction of the network 5 3 v w 5 2 u z 2 1 3 1 2 x y 1 graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } aside: graph abstraction is useful in other network contexts, e.g., P2P, where N is set of peers and E is set of TCP connections 80

  57. Graph abstraction: costs 5 c(x,x’) = cost of link (x,x’) e.g., c(w,z) = 5 3 v w 5 2 u z cost could always be 1, or 2 1 3 inversely related to bandwidth, 1 2 x y or inversely related to 1 congestion cost of path (x 1 , x 2 , x 3 ,…, x p ) = c(x 1 ,x 2 ) + c(x 2 ,x 3 ) + … + c(x p-1 ,x p ) key question: what is the least-cost path between u and z ? routing algorithm: algorithm that finds that least cost path 81

  58. Routing algorithm classification Q: global or decentralized Q: static or dynamic? information? static: global: routes change slowly over time Ø all routers have complete Ø • It does not deal with node or link topology, link cost info failures “link state” algorithms Ø • It does not consider the addition of new nodes or links decentralized: • It implies that edge costs cannot router knows physically- Ø change connected neighbors, link costs dynamic: to neighbors routes change more quickly Ø iterative process of computation, Ø § periodic update exchange of info with neighbors § in response to link cost changes “distance vector” algorithms Ø 82

  59. Link State Routing Algorithm 83

  60. A link-state routing algorithm notation: Dijkstra’s algorithm net topology, link costs known Ø c(x, y): link cost from node x to y; Ø to all nodes = ∞ if not direct neighbors § accomplished via “link state broadcast” D(v): current value of cost of Ø path from source to dest. v § all nodes have same info computes least cost paths from Ø p(v): predecessor node along Ø one node (‘source”) to all other path from source to v nodes § gives forwarding table for that node N': set of nodes whose least cost Ø path definitively known iterative: after k iterations, know Ø least cost path to k dest.’s 84

  61. Dijsktra’s algorithm 1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 7 8 Loop 9 find w not in N' such that D(w) is a minimum 10 add w to N' 11 update D(v) for all v adjacent to w and not in N' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N' 85

  62. Dijkstra’s algorithm: example D( v ) D( w ) D( x ) D( y ) D( z ) Step N' p(v) p(w) p(x) p(y) p(z) 0 u 7,u 3,u 5,u ∞ ∞ uw 1 6,w 5,u 11 ,w ∞ uwx 11, w 14 ,x 2 6,w uwxv 10, v 14 ,x 3 uwxvy 4 12 ,y x uwxvyz 5 9 notes: 7 5 4 v construct shortest path tree by 8 tracing predecessor nodes 3 w z v ties can exist (can be broken y u 2 arbitrarily) 3 4 7 v 86

  63. Dijkstra’s algorithm: another example D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) Step N' D(z),p(z) 2,u 5,u 1,u ∞ 0 u ∞ ∞ 2,u 4,x 2,x 1 ux 4,y 2,u 3,y 2 uxy 4,y 3,y 3 uxyv 4,y 4 uxyvw 5 uxyvwz 5 3 v w 5 2 u z 2 1 3 1 2 x y 1 87

  64. Dijkstra’s algorithm: example (2) resulting shortest-path tree from u: v w u z x y resulting forwarding table in u: destination link (u,v) v x (u,x) y (u,x) w (u,x) z (u,x) 88

  65. Dijkstra’s algorithm, discussion algorithm complexity: n nodes each iteration: need to check all nodes, w, not in N Ø n(n+1)/2 comparisons: O(n 2 ) Ø more efficient implementations possible: O(nlogn) Ø oscillations possible: e.g., support link cost equals amount of carried traffic: Ø A A A A 1 1+e 2+e 2+e 0 2+e 0 0 D B D B D D B B 0 0 1+e 1 1+e 1 0 0 e 0 0 0 C 0 1 0 C C C 1+e 1 1 e given these costs, given these costs, given these costs, initially find new routing…. find new routing…. find new routing…. resulting in new costs resulting in new costs resulting in new costs Execute the algorithm at same period, but start at different times. 89

  66. Link State Routing Strategy: Send to all nodes (not just neighbors) information about directly connected links (not entire routing table). Link State Packet (LSP) Ø § id of the node that created the LSP § cost of link to each directly connected neighbor § sequence number (SEQNO) § time-to-live (TTL) for this packet Reliable Flooding Ø § store most recent LSP from each node § forward LSP to all nodes but one that sent it § generate new LSP periodically (timer); increment SEQNO § start SEQNO at 0 when reboot § decrement TTL of each stored LSP; discard when TTL=0 90

  67. Link State Reliable Flooding Flooding of link-state packets. LSP arrives at node X; (a) X floods LSP to A and C; (b) A and C flood LSP to B (but not X); (c) flooding is complete (d) 91

  68. Distance Vector Routing Algorithm 92

  69. Distance vector algorithm Bellman-Ford equation (dynamic programming) let d x (y) := cost of least-cost path from x to y then d x (y) = min {c(x,v) + d v (y) } v cost from neighbor v to destination y cost to neighbor v min taken over all neighbors v of x 93

  70. Bellman-Ford example 5 clearly, d v (z) = 5, d x (z) = 3, d w (z) = 3 3 v w 5 2 B-F equation says: u z 2 1 3 d u (z) = min { c(u,v) + d v (z), 1 2 x y c(u,x) + d x (z), 1 c(u,w) + d w (z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 node achieving minimum is next hop in shortest path, used in forwarding table 94

  71. Distance vector algorithm Ø D x (y) = estimate of least cost from x to y § x maintains distance vector D x = [D x (y): y є N ] Ø node x: § knows cost to each neighbor v: c(x,v) § maintains its neighbors’ distance vectors. For each neighbor v, x maintains D v = [D v (y): y є N ] 95

  72. Distance vector algorithm key idea: Ø from time-to-time, each node sends its own distance vector estimate to neighbors Ø when x receives new DV estimate from neighbor, it updates its own DV using B-F equation: D x (y) ← min v {c(x,v) + D v (y)} for each node y ∊ N v under minor, natural conditions, the estimate D x (y) converge to the actual least cost d x (y) 96

  73. Distance vector algorithm iterative, asynchronous: each local each node: iteration caused by: local link cost change Ø wait for (change in local link cost or DV update message from neighbor Ø msg from neighbor) distributed: each node notifies neighbors only Ø recompute estimates when its DV changes § neighbors then notify their neighbors if necessary if DV to any dest has changed, notify neighbors 97

  74. D x (z) = min{ c(x,y) + D x (y) = min{c(x,y) + D y (y),c(x,z) + D z (y)} D y (z),c(x,z) + D z (z) } = min{2+0 ,7+1} = 2 = min{2+1 ,7+0} = 3 node x cost to cost to table x y z x y z x 0 2 7 x 0 2 3 from from y y 2 0 1 ∞ ∞ ∞ z z 7 1 0 ∞ ∞ ∞ node y cost to y table x y z 2 1 x ∞ ∞ z ∞ x y 7 from 2 0 1 z ∞ ∞ ∞ node z cost to x y z table x ∞ ∞ ∞ from y ∞ ∞ ∞ z 7 1 0 time 98

  75. D x (z) = min{ c(x,y) + D x (y) = min{c(x,y) + D y (y),c(x,z) + D z (y)} D y (z),c(x,z) + D z (z) } = min{2+0 ,7+1} = 2 = min{2+1 ,7+0} = 3 node x cost to cost to cost to table x y z x y z x y z x 0 2 7 x 0 2 3 x 0 2 3 from from y y 2 0 1 ∞ ∞ ∞ y from 2 0 1 z z 7 1 0 ∞ ∞ ∞ z 3 1 0 node y cost to cost to cost to y table x y z x y z x y z 2 1 x ∞ ∞ x 0 2 7 ∞ z x 0 2 3 x y 2 0 1 from y 7 from 2 0 1 from y 2 0 1 z z ∞ ∞ ∞ 7 1 0 z 3 1 0 node z cost to cost to cost to x y z x y z x y z table x 0 2 7 x 0 2 3 x ∞ ∞ ∞ from from y y 2 0 1 from y 2 0 1 ∞ ∞ ∞ z z z 3 1 0 3 1 0 7 1 0 time time 99

  76. Distance vector: link cost changes link cost changes: 1 v node detects local link cost change y 4 1 v updates routing info, recalculates x z distance vector 50 v if DV changes, notify neighbors t 0 : y detects link-cost change, updates its DV, informs its “good neighbors. news t 1 : z receives update from y , updates its table, computes travels fast” new least cost to x , sends its neighbors its DV. t 2 : y receives z ’s update, updates its distance table. y ’s least costs do not change, so y does not send a message to z . 100

Recommend


More recommend