Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

  • Be the first to comment

  • Be the first to like this


  1. 1. Chapter 4 – The Network Layer & Routing The network layer moves transport layer segments from host to host in the network, to deliver them to their destination. This layer involves each and every host and router in the network. We will study the key principles and algorithms of routing, with a focus on the Internet Protocol (IP) service model. network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical application transport network data link physical application transport network data link physical application transport network data link physical
  2. 2. Network layer functions <ul><li>transport packet from sending to receiving hosts </li></ul><ul><li>network layer protocols in every host, router </li></ul><ul><li>three important functions: </li></ul><ul><li>path determination: route taken by packets from source to destination - routing algorithms </li></ul><ul><li>switching: move packets from router’s input to appropriate router output </li></ul><ul><li>call setup: some network architectures require router call setup along path before data flows ( what types? ) </li></ul>network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical application transport network data link physical application transport network data link physical
  3. 3. Virtual circuits <ul><li>call setup, teardown for each call before data can flow </li></ul><ul><li>each packet carries VC identifier (not destination host ID) </li></ul><ul><li>every router/switch on source-destination path maintains a “state” for each passing connection </li></ul><ul><ul><li>Recall: transport-layer connection only involved two end systems </li></ul></ul><ul><li>link and router resources (bandwidth, buffers) may be dedicated to the VC </li></ul><ul><ul><li>to get circuit-like performance </li></ul></ul><ul><ul><li>but… what about start-up delay? </li></ul></ul><ul><li>the source-to-destination path behaves much like a telephone circuit </li></ul><ul><ul><li>performance-wise </li></ul></ul><ul><ul><li>network actions along source-to-destination path </li></ul></ul>
  4. 4. Virtual circuits: signaling protocols <ul><li>used to setup, maintain and teardown the VC </li></ul><ul><li>used in ATM, frame-relay and X.25 </li></ul><ul><li>not used in the Internet (why?) </li></ul>1. Initiate call 2. incoming call 3. Accept call 4. Call connected 5. Data flow begins 6. Receive data application transport network data link physical application transport network data link physical
  5. 5. Datagram networks: the Internet model <ul><li>no call setup at network layer </li></ul><ul><li>routers: do not maintain state for the end-to-end connections </li></ul><ul><ul><li>no network-level concept of a “connection” </li></ul></ul><ul><li>packets are typically routed using only destination host ID which is carried in the packet </li></ul><ul><ul><li>packets between same source-destination pair may take different paths </li></ul></ul>1. Send data 2. Receive data application transport network data link physical application transport network data link physical
  6. 6. Summary: Datagram or VC network… why? <ul><li>Internet </li></ul><ul><li>data exchange among computers </li></ul><ul><ul><li>“ elastic” service, no strict timing required (data delivery) </li></ul></ul><ul><li>“ smart” end systems (computers) </li></ul><ul><ul><li>can adapt, perform control, error recovery </li></ul></ul><ul><ul><li>complexity at “edge”, simple in network core </li></ul></ul><ul><li>many link types </li></ul><ul><ul><li>different characteristics </li></ul></ul><ul><ul><li>uniform service difficult </li></ul></ul><ul><li>ATM </li></ul><ul><li>evolved from telephony </li></ul><ul><li>human conversation: </li></ul><ul><ul><li>strict timing, reliability requirements </li></ul></ul><ul><ul><li>need for guaranteed service </li></ul></ul><ul><li>“ dumb” end systems </li></ul><ul><ul><li>telephones, “videophones” </li></ul></ul><ul><ul><li>complexity inside the network </li></ul></ul>Consider: IP over ATM (more later)
  7. 7. Routing <ul><li>Graph abstraction for routing algorithms: </li></ul><ul><li>graph nodes are routers </li></ul><ul><li>graph edges are physical links </li></ul><ul><ul><li>link cost : delay, distance, # of hops, rate structure or congestion level = $$ </li></ul></ul><ul><ul><li>Other costs?? </li></ul></ul>Goal: determine a “good” path (sequence of routers) thru the network from the source to the destination <ul><li>“ good” path: </li></ul><ul><ul><li>typically means minimum cost path </li></ul></ul><ul><ul><li>other definitions also possible </li></ul></ul>Routing protocol A E D C B F 2 2 1 3 1 1 2 5 3 5
  8. 8. A Link-State Routing Algorithm <ul><li>Dijkstra’s algorithm </li></ul><ul><li>net topology, link costs known to all nodes </li></ul><ul><ul><li>accomplished via “link state broadcast” </li></ul></ul><ul><ul><li>all nodes have same info </li></ul></ul><ul><li>computes least cost paths from one node (“source”) to all other nodes </li></ul><ul><ul><li>yields a routing table for that node </li></ul></ul><ul><li>iterative: after k iterations, know least cost path to k destinations </li></ul><ul><li>Notation: </li></ul><ul><li>c(i,j): link cost from node i to node j. Cost is initially infinite if not a direct neighbor </li></ul><ul><li>D(v): current computed value of cost of the path from the source to destination v </li></ul><ul><li>p(v): predecessor node, that is a neighbor of v , along the path from the source to v </li></ul><ul><li>N: set of nodes whose least cost path is definitively known </li></ul>
  9. 9. Dijsktra’s Algorithm 1 Initialization: 2 N = {A} // Source node is “A” 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) 6 else D(v) = infinity 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 A E D C B F 2 2 1 3 1 1 2 5 3 5
  10. 10. Dijkstra’s algorithm: example Step 0 1 2 3 4 5 start N A AD ADE ADEB ADEBC ADEBCF D(B),p(B) 2,A 2,A 2,A - - D(C),p(C) 5,A 4,D 3,E 3,E - D(D),p(D) 1,A - - - - D(E),p(E) infinity 2,D - - - D(F),p(F) infinity infinity 4,E 4,E 4,E A E D C B F 2 2 1 3 1 1 2 5 3 5
  11. 11. Distance Vector Routing Algorithm <ul><li>iterative: </li></ul><ul><li>continues until no nodes exchange info. </li></ul><ul><li>self-terminating : no “signal” to stop </li></ul><ul><li>asynchronous: </li></ul><ul><li>nodes need not exchange info/iterate in lock step! </li></ul><ul><li>distributed: </li></ul><ul><li>each node communicates only with directly-attached neighbors </li></ul><ul><li>Distance Table data structure </li></ul><ul><li>each node has its own </li></ul><ul><li>row for each possible destination </li></ul><ul><li>column for each directly-attached neighbor to node </li></ul><ul><li>example: in node X, for destination Y via neighbor Z: </li></ul>D X (Y,Z) distance from X to Y, via Z as next hop c(X,Z) + min w {D Z (Y, w )} = =
  12. 12. Distance Table: example loop back through E! loop back through E! A E D C B 7 8 1 2 1 2 D () A B C D A 1 7 6 4 B 14 8 9 11 D 5 5 4 2 E cost to destination via destination D (C,D) E c(E,D) + min {D (C,w)} D w = = 2+2 = 4 D (A,D) E c(E,D) + min {D (A,w)} D w = = 2+3 = 5 D (A,B) E c(E,B) + min {D (A,w)} B w = = 8+6 = 14
  13. 13. Distance table gives routing table A,1 D,5 D,4 D,2 Outgoing link to use, cost destination Distance table Routing table E A B C D D () A B C D A 1 7 6 4 B 14 8 9 11 D 5 5 4 2 E cost to destination via destination
  14. 14. Distance Vector Algorithm (Bellman-Ford) : 1 Initialization: 2 for all adjacent nodes v: 3 D (*,v) = infinity /* the * operator means &quot;for all rows&quot; */ 4 D (v,v) = c(X,v) 5 for all destinations, y 6 send min D (y,w) to each neighbor /* w over all X's neighbors */ X X X w At all nodes, X:
  15. 15. Distance Vector Algorithm (cont.): 8 loop 9 wait (until I see a link cost change to neighbor V 10 or until I receive update from neighbor V) 11 12 if (c(X,V) changes by d) 13 /* change cost to all dest's via neighbor v by d */ 14 /* note: d could be positive or negative */ 15 for all destinations y: D (y,V) = D (y,V) + d 16 17 else if (update received from V wrt destination Y) 18 /* shortest path from V to some Y has changed */ 19 /* V has sent a new value for its min D V (Y,w) */ 20 /* call this received new value is &quot;newval&quot; */ 21 for the single destination y: D (Y,V) = c(X,V) + newval 22 23 if we have a new min D (Y,w)for any destination Y 24 send new value of min D (Y,w) to all neighbors 25 26 forever w X X X X X w w
  16. 16. Distance Vector: link cost changes <ul><li>Link cost changes: </li></ul><ul><li>node detects local link cost change </li></ul><ul><li>updates distance table (line 15) </li></ul><ul><li>if cost change in least cost path, notify neighbors (lines 23,24) </li></ul>algorithm terminates “ good news travels fast” X Z 1 4 50 Y 1
  17. 17. Distance Vector: link cost changes <ul><li>Link cost changes: </li></ul><ul><li>good news travels fast </li></ul><ul><li>bad news travels slowly - “count to infinity” problem! </li></ul>algorithm continues on! X Z 1 4 50 Y 60 Y Y Y
  18. 18. Distance Vector: poisoned reverse <ul><li>If Z routes through Y to get to X : </li></ul><ul><li>Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) </li></ul><ul><li>will this completely solve count to infinity problem? </li></ul>algorithm terminates X Z 1 4 50 Y 60 Y Y Y Y
  19. 19. Comparison of LS and DV algorithms <ul><li>Message complexity </li></ul><ul><li>LS: with n nodes, E links, O(nE) msgs sent/broadcast </li></ul><ul><li>DV: exchange between neighbors only </li></ul><ul><ul><li>convergence time varies </li></ul></ul><ul><li>Speed of Convergence </li></ul><ul><li>LS: O(n 2 ) algorithm requires O(nE) msgs </li></ul><ul><ul><li>may have oscillations </li></ul></ul><ul><li>DV : convergence time varies </li></ul><ul><ul><li>may be routing loops </li></ul></ul><ul><ul><li>count-to-infinity problem </li></ul></ul><ul><ul><ul><li>poisoned reverse is sometimes successful </li></ul></ul></ul><ul><li>Robustness: what happens if router malfunctions? </li></ul><ul><li>LS: </li></ul><ul><ul><li>node can advertise incorrect link cost </li></ul></ul><ul><ul><li>each node computes only its own table </li></ul></ul><ul><li>DV: </li></ul><ul><ul><li>DV node can advertise incorrect path cost </li></ul></ul><ul><ul><li>each node’s table used by others </li></ul></ul><ul><ul><ul><li>errors propagate through the network </li></ul></ul></ul>
  20. 20. Hierarchical Routing <ul><li>scale: with 55 million+ destination hosts: </li></ul><ul><li>can’t store all destinations in routing tables! </li></ul><ul><li>routing table exchange would swamp links! </li></ul><ul><li>administrative autonomy </li></ul><ul><li>internet = network of networks </li></ul><ul><li>each network admin may want to control routing in its own network </li></ul><ul><li>Our routing study thus far – an idealization </li></ul><ul><li>all routers are identical </li></ul><ul><li>the network is “flat” </li></ul><ul><li>… not true in practice </li></ul><ul><li>Why? </li></ul>
  21. 21. Hierarchical Routing <ul><li>aggregate routers into regions, called “autonomous systems” (AS) </li></ul><ul><li>routers in same AS run same routing protocol </li></ul><ul><ul><li>“ intra-AS” routing protocol </li></ul></ul><ul><ul><li>routers in different AS can run different intra-AS routing protocol </li></ul></ul><ul><li>special routers in AS </li></ul><ul><li>run intra-AS routing protocol with all other routers in AS </li></ul><ul><li>also responsible for routing to destinations outside AS </li></ul><ul><ul><li>run inter-AS routing protocol with other gateway routers </li></ul></ul>gateway routers
  22. 22. Intra-AS and Inter-AS routing <ul><li>Gateways: </li></ul><ul><ul><li>perform inter-AS routing amongst themselves </li></ul></ul><ul><ul><li>perform intra-AS routers with other routers in their AS </li></ul></ul>inter-AS, intra-AS routing in gateway A.c network layer data link layer physical layer a b b a a C A B d A.a A.c C.b B.a c b c
  23. 23. Intra-AS and Inter-AS routing Host h2 Intra-AS routing within AS A Intra-AS routing within AS B <ul><li>We’ll examine specific inter-AS and intra-AS Internet routing protocols shortly (section 4.5) </li></ul>a b b a a C A B d c A.a A.c C.b B.a c b Host h1 Inter-AS routing between A and B
  24. 24. The Internet Network layer <ul><li>Host, router network layer functions… three major components: </li></ul>Transport layer: TCP, UDP Link layer Physical layer Network layer routing table <ul><li>Routing protocols </li></ul><ul><li>path selection </li></ul><ul><li>RIP, OSPF, BGP </li></ul><ul><li>IP protocol </li></ul><ul><li>addressing conventions </li></ul><ul><li>datagram format </li></ul><ul><li>packet handling conventions </li></ul><ul><li>ICMP protocol </li></ul><ul><li>error reporting </li></ul><ul><li>router “signaling” </li></ul>
  25. 25. IP Addressing: introduction <ul><li>IP address: 32-bit identifier for host or router interface </li></ul><ul><li>interface: connection between host or router and the physical link </li></ul><ul><ul><li>routers typically have multiple interfaces </li></ul></ul><ul><ul><li>hosts typically have only one </li></ul></ul><ul><ul><li>IP addresses are associated with the interface , not the host or the router </li></ul></ul> = 11011111 00000001 00000001 00000001 223 1 1 1 dotted-decimal notation:
  26. 26. IP Addressing <ul><li>IP address: </li></ul><ul><ul><li>network part (high order bits) </li></ul></ul><ul><ul><li>host part (low order bits) </li></ul></ul><ul><li>What’s a network ? ( from the IP address perspective) </li></ul><ul><ul><li>device interfaces with the same network part of their IP address </li></ul></ul><ul><ul><li>hosts can physically reach each other without an intervening router </li></ul></ul> Example: network consisting of 3 IP networks (for IP addresses starting with 223, the first 24 bits are the network address – more later) LAN
  27. 27. IP Addresses <ul><li>Given the notion of a “network”, let’s look closer at IP addresses: </li></ul>0 network 10 network host (16 bits) 110 network host (8 bits) A B C D class to to to to 32 bits “ classful” addressing - host (24 bits) What is the address space size (number of hosts) for each class? 1110 multicast address (28 bits) 2 7 = 127 networks 2 24 = 16.8 million+ hosts 2 14 = 16,384 networks 2 16 = 65,536 hosts 2 21 = 2 million+ networks 2 8 = 256 hosts 2 4 = 16 networks 2 28 = 268.4 million+ hosts
  28. 28. IP addressing: CIDR <ul><li>classful addressing: </li></ul><ul><ul><li>inefficient use of address space, address space exhaustion </li></ul></ul><ul><ul><li>e.g., class B network is allocated enough addresses for 65K hosts, even if only 2K hosts exist in that network </li></ul></ul><ul><li>CIDR: C lassless I nter D omain R outing </li></ul><ul><ul><li>network portion of address of arbitrary length </li></ul></ul><ul><ul><li>address format: a.b.c.d/x , where x is # bits in the network portion of an address </li></ul></ul>11001000 00010111 0001000 0 00000000 network part host part
  29. 29. IP addresses: how to get one? <ul><li>Hosts (host portion): </li></ul><ul><li>hard-coded by system admin in a file </li></ul><ul><li>DHCP: D ynamic H ost C onfiguration P rotocol: dynamically get address (RFC 2131): “plug-and-play” </li></ul><ul><ul><li>host broadcasts “ DHCP discover ” msg </li></ul></ul><ul><ul><li>DHCP server responds with “ DHCP offer ” msg </li></ul></ul><ul><ul><li>host requests IP address: “ DHCP request ” msg </li></ul></ul><ul><ul><li>DHCP server sends address: “ DHCP ack ” msg </li></ul></ul>
  30. 30. IP addresses: how to get one? <ul><li>Network (network portion): </li></ul><ul><li>get allocated portion of ISP’s address space: </li></ul>ISP's block 11001000 00010111 0001 0000 00000000 Organization 0 11001000 00010111 0001000 0 00000000 Organization 1 11001000 00010111 0001001 0 00000000 Organization 2 11001000 00010111 0001010 0 00000000 ... ….. …. …. Organization 7 11001000 00010111 0001111 0 00000000
  31. 31. Getting a datagram from source to dest. <ul><li>IP datagram: </li></ul><ul><li>addresses remain unchanged , as the datagram travels from source to destination </li></ul><ul><li>address fields of interest here (provided by the source host A) </li></ul>routing table* in A * Note – more on this later A B E misc. fields source IP addr dest IP addr data dest. net. next router #hops 223.1.1 1 223.1.2 2 223.1.3 2
  32. 32. Getting a datagram from source to dest. <ul><li>Starting at A, given an IP datagram addressed to B: </li></ul><ul><li>look up network address of B </li></ul><ul><li>find B is on same network as A </li></ul><ul><li>link layer will send datagram directly to B inside link-layer frame </li></ul><ul><ul><li>B and A are directly connected </li></ul></ul> A B E dest. net. next router #hops 223.1.1 1 223.1.2 2 223.1.3 2 misc fields data
  33. 33. Getting a datagram from source to dest. <ul><li>Starting at A, destination E: </li></ul><ul><li>look up network address of E </li></ul><ul><li>E on different network </li></ul><ul><ul><li>A, E not directly attached </li></ul></ul><ul><li>routing table: next hop router to E is </li></ul><ul><li>link layer sends datagram to router inside link-layer frame </li></ul><ul><li>datagram arrives at </li></ul><ul><li>continued….. </li></ul>misc fields data A B E dest. net. next router #hops 223.1.1 1 223.1.2 2 223.1.3 2
  34. 34. Getting a datagram from source to dest. <ul><li>Arriving at, destined for </li></ul><ul><li>look up network address of E </li></ul><ul><li>E on same network as router’s interface </li></ul><ul><ul><li>router, E directly attached </li></ul></ul><ul><li>link layer sends datagram to inside link-layer frame via interface </li></ul><ul><li>datagram arrives at !!! </li></ul>misc fields data A B E network router #hops interface 223.1.1 - 1 223.1.2 - 1 223.1.3 - 1 dest. next
  35. 35. IP datagram format ver. datagram length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier header checksum time to live 32 bit source IP address IP protocol version number header length (bytes) max number of remaining hops (decremented at each router) for fragmentation/ reassembly total datagram length (bytes) upper layer protocol to deliver payload to (e.g. TCP, UDP, … see RFC 1700) head. len. type of service “ type” of data flgs fragment offset upper layer 32 bit destination IP address Options (if any) e.g. timestamp, record route taken, specify list of routers to visit (field is rarely used in practice).
  36. 36. IP Fragmentation & Reassembly <ul><li>network links have MTU (Max. Transfer Unit) size - largest possible link-level frame. </li></ul><ul><ul><li>different link types, different MTUs </li></ul></ul><ul><li>large IP datagram divided (“fragmented”) within net </li></ul><ul><ul><li>one datagram becomes several datagrams </li></ul></ul><ul><ul><li>“ reassembled” only at final destination </li></ul></ul><ul><ul><li>IP header bits used to identify and order related fragments </li></ul></ul>fragmentation: in: one large datagram out: 3 smaller datagrams reassembly
  37. 37. IP Fragmentation and Reassembly One large datagram becomes several smaller datagrams ID =x offset =0 fragflag =0 length =4000 ID =x offset =0 fragflag =1 length =1500 ID =x offset =1480 fragflag =1 length =1500 ID =x offset =2960 fragflag =0 length =1040
  38. 38. Internet AS Hierarchy Inter-AS border (exterior gateway) routers Intra-AS interior (gateway) routers
  39. 39. Intra-AS Routing <ul><li>Also known as Interior Gateway Protocols (IGP) </li></ul><ul><li>Most common IGPs: </li></ul><ul><ul><li>RIP: Routing Information Protocol (legacy) </li></ul></ul><ul><ul><li>OSPF: Open Shortest Path First (common) </li></ul></ul><ul><ul><li>EIGRP: Enhanced Interior Gateway Routing Protocol (proprietary – Cisco Systems) </li></ul></ul>
  40. 40. RIP ( Routing Information Protocol) <ul><li>Distance vector algorithm </li></ul><ul><li>Included in BSD-UNIX Distribution in 1982 </li></ul><ul><ul><li>RFC 1058 (version 1), RFC 1723 (version 2) </li></ul></ul><ul><li>Distance metric: # of hops (max = 15 hops) </li></ul><ul><ul><li>Can you guess why? </li></ul></ul><ul><li>Distance vectors: exchanged every 30 seconds via Response Message (also called advertisement ) </li></ul><ul><li>Each advertisement: routing info for maximum of 25 destination nets within the AS </li></ul>
  41. 41. RIP Table processing <ul><li>RIP routing tables managed by a pplication-level process called route-d (UNIX daemon) </li></ul><ul><li>advertisements sent in UDP packets, periodically repeated </li></ul>
  42. 42. RIP Table example (continued) <ul><li>Router: </li></ul><ul><li>Three attached class C networks (LANs) </li></ul><ul><li>Router only knows routes to attached LANs </li></ul><ul><li>Default router used to “go up” to next logical level </li></ul><ul><li>Route multicast address: </li></ul><ul><li>Loopback interface (for debugging) </li></ul>Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ------ --------- UH 0 26492 lo0 192.168.2 . U 2 13 fa0 193.55.114 . U 3 58503 le0 192.168.3 . U 2 25 qaa0 U 3 0 le0 default UG 0 143454
  43. 43. OSPF “advanced” features (not in RIP) <ul><li>Security: all OSPF messages are authenticated (to prevent malicious intrusion); TCP connections used </li></ul><ul><li>Multiple same-cost paths allowed (only one path in RIP) </li></ul><ul><li>For each link, multiple cost metrics for different T ypes O f S ervice (e.g., satellite link cost set “low” for best effort; high for real time) </li></ul><ul><li>Integrated uni- and multicast support: </li></ul><ul><ul><li>Multicast OSPF (MOSPF) uses same topology data base as OSPF </li></ul></ul><ul><li>Hierarchical OSPF in large domains. </li></ul>
  44. 44. Hierarchical OSPF
  45. 45. Hierarchical OSPF <ul><li>Two-level hierarchy: local area and backbone. </li></ul><ul><ul><li>link-state advertisements only in local area </li></ul></ul><ul><ul><li>each node has detailed area topology; only know direction (shortest path) to nets in other areas. </li></ul></ul><ul><li>Area border routers: “summarize” distances to nets in own area, advertise to other Area Border routers. </li></ul><ul><li>Backbone routers: run OSPF routing, limited to backbone. </li></ul><ul><li>Boundary routers: connect to other ASs. (Note: synonymous with the “gateway routers” we discussed in section 4.3) </li></ul>
  46. 46. Internet inter-AS routing: BGP <ul><li>BGP (Border Gateway Protocol): the de facto standard </li></ul><ul><li>Path Vector protocol: </li></ul><ul><ul><li>similar to Distance Vector protocol </li></ul></ul><ul><ul><li>each Border Gateway broadcasts to neighbors (peers) the entire path (I.e, sequence of ASs) to destination </li></ul></ul><ul><ul><li>E.g., Gateway X may send its path to destination Z : </li></ul></ul><ul><li>Path (X,Z) = X,Y1,Y2,Y3,…,Z </li></ul>
  47. 47. Internet inter-AS routing: BGP <ul><li>Suppose: gateway X send its path to peer gateway W </li></ul><ul><li>W may or may not select a path offered by X </li></ul><ul><ul><li>cost, policy (don’t route via competitors AS), loop prevention reasons . </li></ul></ul><ul><li>If W selects a path advertised by X, then: </li></ul><ul><li>Path (W,Z) = W, Path (X,Z) </li></ul><ul><li>Note: X can control incoming traffic by controlling its route advertisements to peers: </li></ul><ul><ul><li>e.g., don’t want to route traffic to Z -> don’t advertise any routes to Z </li></ul></ul>
  48. 48. Internet inter-AS routing: BGP <ul><li>BGP messages exchanged using TCP . </li></ul><ul><li>BGP messages: </li></ul><ul><ul><li>OPEN: opens TCP connection to peer and authenticates sender </li></ul></ul><ul><ul><li>UPDATE: advertises new path (or withdraws old) </li></ul></ul><ul><ul><li>KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request </li></ul></ul><ul><ul><li>NOTIFICATION: reports errors in previous message; also used to close connection </li></ul></ul>
  49. 49. Why different Intra- and Inter-AS routing ? <ul><li>Policy: </li></ul><ul><li>Inter-AS: admin wants control over how its traffic is routed, who routes through its net. </li></ul><ul><li>Intra-AS: single admin, so no policy decisions needed </li></ul><ul><li>Scale: </li></ul><ul><li>hierarchical routing saves table size, reduces update traffic </li></ul><ul><li>Performance: </li></ul><ul><li>Intra-AS: can focus on performance </li></ul><ul><li>Inter-AS: policy may dominate over performance </li></ul>
  50. 50. Router Architecture Overview <ul><li>Two key router functions: </li></ul><ul><li>run routing algorithms/protocol (RIP, OSPF, BGP) </li></ul><ul><li>switch datagrams from incoming to outgoing link </li></ul>
  51. 51. Input Port Functions <ul><li>Decentralized switching : </li></ul><ul><li>given datagram dest., lookup output port using routing table in input port memory </li></ul><ul><li>goal: complete input port processing at ‘line speed’ </li></ul><ul><li>queuing: if datagrams arrive faster than forwarding rate into switch fabric (i.e., the packet is “blocked”) </li></ul>Physical layer: bit-level reception Data link layer: e.g., Ethernet see chapter 5 Problem: how long does it take to perform a lookup?
  52. 52. Input Port Queuing <ul><li>If routing fabric is slower than input ports combined -> queuing may occur at input queues </li></ul><ul><li>Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward </li></ul><ul><li>queuing delay and loss due to input buffer overflow! </li></ul>
  53. 53. Three types of switching fabrics (interconnection network)
  54. 54. Switching Via Memory <ul><li>First generation routers: </li></ul><ul><li>packet copied by system’s (single) CPU </li></ul><ul><li>speed limited by memory bandwidth (2 system bus accesses per datagram) </li></ul><ul><li>Modern routers: </li></ul><ul><li>input port processor performs lookup, copy into shared memory </li></ul><ul><li>Cisco Catalyst 8500 </li></ul>Input Port Output Port Memory System Bus DMA DMA
  55. 55. Switching Via Bus <ul><li>datagram from input port memory </li></ul><ul><li>to output port memory via a shared bus </li></ul><ul><li>bus contention: switching speed limited by bus bandwidth (only one packet at a time can use bus) </li></ul><ul><li>1 Gbps bus - Cisco 1900: sufficient speed for access and enterprise routers (not regional or backbone) </li></ul>
  56. 56. Switching Via An Interconnection Network (commonly: Crossbar) <ul><li>overcomes bus bandwidth </li></ul><ul><li>limitations </li></ul><ul><li>Banyan networks, other </li></ul><ul><li>interconnection nets initially </li></ul><ul><li>developed to connect processors </li></ul><ul><li>in multiprocessor design </li></ul><ul><li>advanced design: fragments </li></ul><ul><li>datagram into fixed length cells, switches cells </li></ul><ul><li>through the fabric. </li></ul><ul><li>Cisco 12000: switches up to 60 Gbps through the </li></ul><ul><li>interconnection network </li></ul>
  57. 57. Output Ports <ul><li>Buffering required when datagrams arrive from the fabric faster than the transmission rate </li></ul><ul><li>Scheduling discipline chooses among queued datagrams for transmission </li></ul>
  58. 58. Output port queuing <ul><li>buffering when arrival rate via switching fabric exceeds output line speed </li></ul><ul><li>queuing (delay) and loss due to output port buffer overflow! </li></ul>Question: where is queuing most likely to occur?
  59. 59. IPv6 <ul><li>Initial motivation: 32-bit address space completely allocated (gone!) by 2008 (maybe sooner… maybe later!). </li></ul><ul><li>Additional motivation: </li></ul><ul><ul><li>header format changes were needed to improve speed of processing and forwarding </li></ul></ul><ul><ul><li>header changes were required to facilitate QoS </li></ul></ul><ul><ul><li>a new “anycast” address was needed: route to “best” of several replicated servers </li></ul></ul><ul><li>IPv6 datagram format: </li></ul><ul><ul><li>fixed-length 40 byte header ( 32 for addresses ) </li></ul></ul><ul><ul><li>no fragmentation allowed </li></ul></ul>
  60. 60. IPv6 Header 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 8 bytes 32 bytes ver. class flow label
  61. 61. Other Changes from IPv4 <ul><li>Fragmentation: not allowed/supported </li></ul><ul><li>Checksum : removed entirely to reduce processing time at each hop </li></ul><ul><li>Options: allowed, but outside of header , indicated by “Next Header” field </li></ul><ul><li>ICMPv6: new version of ICMP </li></ul><ul><ul><li>additional message types, e.g. “Packet Too Big” </li></ul></ul><ul><ul><li>multicast group management functions (IGMP) </li></ul></ul>
  62. 62. Transition From IPv4 To IPv6 <ul><li>Not all routers can be upgraded simultaneous </li></ul><ul><ul><li>no “flag days” (e.g. NCP to TCP attempt in c. 1981) </li></ul></ul><ul><ul><li>How will the network operate with mixed IPv4 and IPv6 routers? </li></ul></ul><ul><li>Two proposed approaches (RFC 1933): </li></ul><ul><ul><li>Dual Stack : some routers with dual stack (v6, v4) can “translate” between formats </li></ul></ul><ul><ul><li>Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers </li></ul></ul>
  63. 63. Dual Stack Approach
  64. 64. Tunneling IPv6 inside IPv4 where needed
  65. 65. Multicast routing <ul><li>IGMP message types: </li></ul><ul><ul><li>membership queries: general or specific </li></ul></ul><ul><ul><li>membership report: host wants to join </li></ul></ul><ul><ul><li>leave group: host leaves a specific group </li></ul></ul><ul><li>message format: </li></ul><ul><ul><li>Carried in IP datagram </li></ul></ul><ul><ul><li>IP protocol # of 2 </li></ul></ul><ul><li>Internet multicast routing algorithms: </li></ul><ul><ul><li>DVMRP – distance vector </li></ul></ul><ul><ul><li>MOSPF – open shortest path first </li></ul></ul><ul><ul><li>CBT – core-based trees </li></ul></ul><ul><ul><li>PIM – protocol independent </li></ul></ul><ul><li>Inter-autonomous routing: </li></ul><ul><ul><li>DVMRP – de facto standard for multicast </li></ul></ul>
  66. 66. Chapter 5 – Link Layer & Local Area Networks The link layer is responsible for the transport of network layer datagrams from node to node via established physical links. In this chapter we’ll study the principal services of this layer, and look at specific protocols employed in the LANs, hubs, bridges and switches in the Internet. We’ll also investigate Ethernet, ATM, X.25 and Frame Relay. network data link physical application transport network data link physical application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical
  67. 67. Link Layer: setting the context <ul><li>two physically connected devices: </li></ul><ul><ul><li>host-router, router-router, host-host </li></ul></ul><ul><li>unit of data: frame </li></ul>frame phys. link data link protocol adapter card application transport network link physical network link physical M M M M H t H t H n H t H n H l M H t H n H l
  68. 68. Link Layer: Implementation <ul><li>implemented in “adapter” </li></ul><ul><ul><li>e.g., PCMCIA card, Ethernet card </li></ul></ul><ul><ul><li>typically includes: RAM, DSP chips, host bus interface, and physical link interface </li></ul></ul>network link physical M frame phys. link data link protocol adapter card application transport network link physical M M M M H t H t H n H t H n H l H t H n H l
  69. 69. Error Detection <ul><li>EDC= Error Detection and Correction bits (redundancy) </li></ul><ul><li>D = Data protected by error checking, may include header fields </li></ul><ul><li>Error detection not 100% reliable! </li></ul><ul><ul><li>protocol may miss some errors, but rarely </li></ul></ul><ul><ul><li>larger EDC field yields better detection and correction </li></ul></ul>
  70. 70. Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity : Detect and correct single bit errors What’s the problem with this method? What else can we do with this method? 0 0
  71. 71. Checksumming: Cyclic Redundancy Check <ul><li>view data bits, D , as a binary number </li></ul><ul><li>choose r+1 bit pattern (generator), G </li></ul><ul><li>goal: choose r CRC bits, R , such that </li></ul><ul><ul><li><D,R> exactly divisible by G (modulo 2) </li></ul></ul><ul><ul><li>receiver knows G, divides <D,R> by G. </li></ul></ul><ul><ul><ul><li>non-zero remainder => error detected! </li></ul></ul></ul><ul><ul><li>can detect all burst errors less than r+1 bits (Hamming) </li></ul></ul><ul><ul><li>ATM 5-byte header uses 8-bit CRC </li></ul></ul><ul><ul><li>IEEE G CRC-32 , 32-bit CRC for Ethernet, etc. </li></ul></ul><ul><li>widely used in practice (ATM, HDLC) </li></ul>
  72. 72. CRC Example <ul><li>Want: </li></ul><ul><ul><li>D . 2 r XOR R = nG </li></ul></ul><ul><li>equivalently: </li></ul><ul><ul><li>D . 2 r = nG XOR R </li></ul></ul><ul><li>equivalently: </li></ul><ul><li>if we divide D . 2 r by G, want reminder R </li></ul>R = remainder[ ] D . 2 r G Must be r+1 bits long. High and low-order bits must be 1’s. Yields: 101110011
  73. 73. Multiple Access Links and Protocols <ul><li>Three types of “links”: </li></ul><ul><li>point-to-point (single wire, e.g. PPP, SLIP, HDLC) </li></ul><ul><li>broadcast (shared wire or medium; e.g, Ethernet, Wavelan, etc.) </li></ul><ul><li>switched (e.g., switched Ethernet, ATM, etc.) </li></ul>
  74. 74. Multiple Access protocols <ul><li>single shared communication channel </li></ul><ul><li>two or more simultaneous transmissions by nodes… interference </li></ul><ul><ul><li>generally, only one node can send successfully at a time </li></ul></ul><ul><li>multiple access protocol: </li></ul><ul><ul><li>distributed algorithm that determines how stations share channel, i.e., determine when a station can transmit </li></ul></ul><ul><ul><li>communication about channel sharing must use channel itself! </li></ul></ul><ul><ul><li>what to look for in multiple access protocols: </li></ul></ul><ul><ul><ul><li>synchronous or asynchronous </li></ul></ul></ul><ul><ul><ul><li>information needed about other stations </li></ul></ul></ul><ul><ul><ul><li>robustness (e.g., tolerance of channel errors) </li></ul></ul></ul><ul><ul><ul><li>performance and efficiency </li></ul></ul></ul>
  75. 75. Multiple Access protocols <ul><li>Desirable characteristics of a MAP channel of rate R bps: </li></ul><ul><ul><li>only one node sending… throughput is R bps </li></ul></ul><ul><ul><li>M nodes sending… average throughput is R/M bps </li></ul></ul><ul><ul><li>decentralized control… no master nodes that control sending/receiving </li></ul></ul><ul><ul><li>the protocol is simple and inexpensive to implement </li></ul></ul><ul><li>MAC protocols: M edia A ccess C ontrol </li></ul><ul><ul><li>often called the MAC sub-layer (of the data link layer) </li></ul></ul>
  76. 76. MAC Protocols: a taxonomy <ul><li>Three broad classes: </li></ul><ul><li>Channel Partitioning </li></ul><ul><ul><li>divide channel into smaller “pieces” (time slots, frequency) </li></ul></ul><ul><ul><li>allocate piece to node for exclusive use </li></ul></ul><ul><li>Random Access </li></ul><ul><ul><li>allow transmitted frames to collide </li></ul></ul><ul><ul><li>“ recover” from collisions </li></ul></ul><ul><li>“ Taking turns ” </li></ul><ul><ul><li>tightly coordinate shared access to avoid collisions </li></ul></ul>Goal: efficient, fair, simple, decentralized
  77. 77. Channel Partitioning MAC protocols: TDMA <ul><li>TDMA: time division multiple access </li></ul><ul><li>access to channel in &quot;rounds&quot; </li></ul><ul><li>each station gets fixed length slot (length = pkt transmission time) in each round </li></ul><ul><li>unused slots go idle </li></ul><ul><li>example: 6-station LAN – hosts 1,3,4 have packets, time slots 2,5,6 idle </li></ul>efficient? simple? fair? decentralized?
  78. 78. Channel Partitioning MAC protocols: FDMA <ul><li>FDMA: frequency division multiple access </li></ul><ul><li>channel spectrum divided into frequency bands </li></ul><ul><li>each station assigned fixed frequency band </li></ul><ul><li>unused transmission time in frequency bands goes idle </li></ul><ul><li>example: 6-station LAN - hosts 1,3,4 have packets, frequency bands 2,5,6 idle </li></ul>frequency bands time 1 2 3 4 5 6
  79. 79. Channel Partitioning (CDMA) <ul><li>CDMA (Code Division Multiple Access) </li></ul><ul><li>unique “code” assigned to each user; i.e., code set partitioning </li></ul><ul><li>used mostly in wireless broadcast channels (cellular, satellite,etc) </li></ul><ul><li>all users share same frequency/medium, but each user has own “chipping” sequence (i.e., code) to encode data </li></ul><ul><li>encoded signal = (original data) X (chipping sequence) </li></ul><ul><li>decoding: inner-product of encoded signal and chipping sequence </li></ul><ul><li>allows multiple users to “coexist” and transmit simultaneously with minimal interference (if codes are pairwise “orthogonal”) </li></ul>
  80. 80. CDMA: two-sender interference
  81. 81. CDMA: 4-sender example Chipping Sequences for 4 nodes: A: 00011011 A: (-1 –1 –1 +1 +1 –1 +1 +1) B: 00101110 B: (-1 –1 +1 –1 +1 +1 +1 –1) C: 01011100 C: (-1 +1 –1 +1 +1 +1 –1 –1) D: 01000010 D: (-1 +1 –1 –1 –1 –1 +1 –1) Note: for all S and T, S  T = 0 Example recovery of node C’s signal: S 1  C = (+1 +1 +1 +1 +1 +1 +1 +1 )/8 = 1 S 2  C = (+2 +0 +0 +0 +2 +2 +0 +2)/8 = 1 S 3  C = (0 +0 +2 +2 +0 –2 +0 -2)/8 = 0 S 4  C = (+1 +1 +3 +3 +1 –1 +1 -1)/8 = 1 S 5  C = (+4 +0 +2 +0 +2 +0 –2 +2)/8 = 1 S 6  C = (+2 –2 +0 –2 +0 –2 –4 +0)/8 = -1 Example transmissions: - - 1 - C S 1 : (-1 +1 –1 +1 +1 +1 –1 –1) - 1 1 - B + C S 2 : (-2 0 0 0 +2 +2 0 -2) 1 0 - - A + B S 3 : (0 0 –2 +2 0 –2 0 +2) 1 0 1 - A + B + C S 4 : (-1 +1 –3 +3 +1 –1 –1 +1) 1 1 1 1 A + B + C + D S 5 : (-4 0 –2 0 +2 0 +2 -2) 1 1 0 1 A + B + C + D S 6 : (-2 –2 0 –2 0 –2 +4 0)
  82. 82. Slotted Aloha efficiency <ul><li>Q: what is max fraction of slots successful? </li></ul><ul><li>A: Suppose N stations have packets to send </li></ul><ul><ul><li>each transmits in slot with probability p </li></ul></ul><ul><ul><li>probability of successful transmission S is: </li></ul></ul><ul><li>by single node: S= p (1-p) (N-1) </li></ul><ul><li> S = Prob (only one transmits) </li></ul><ul><li>by any arbitrary node of the N nodes: </li></ul><ul><li> = N p (1-p) (N-1) </li></ul><ul><li>… choosing optimum p as N -> infinity ... </li></ul><ul><li>= 1/e = .37 as N -> infinity </li></ul>At best: channel is available for successful (useful) transmissions 37% of time!
  83. 83. CSMA: Carrier Sense Multiple Access <ul><li>CSMA : listen before transmit: </li></ul><ul><li>If channel sensed as idle: transmit entire packet </li></ul><ul><li>If channel sensed as busy: defer transmission </li></ul><ul><ul><li>Persistent CSMA: retry immediately with probability p when channel becomes idle (may cause instability) </li></ul></ul><ul><ul><li>Non-persistent CSMA: retry after random interval </li></ul></ul><ul><li>human analogy: be polite and wait your turn, don’t interrupt others! </li></ul>
  84. 84. CSMA collisions collisions can occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted spatial layout of nodes along Ethernet note: role of distance and propagation delay in determining collision prob.
  85. 85. CSMA/CD (Collision Detection) <ul><li>CSMA/CD: carrier sensing, deferral as in CSMA </li></ul><ul><ul><li>collisions detected within short time </li></ul></ul><ul><ul><li>colliding transmissions aborted, reducing wasted channel bandwidth </li></ul></ul><ul><ul><li>persistent or non-persistent retransmission </li></ul></ul><ul><li>collision detection: </li></ul><ul><ul><li>easy in wired LANs: measure signal strengths, compare transmitted, received signals </li></ul></ul><ul><ul><li>difficult in wireless LANs: receiver shut off while transmitting </li></ul></ul><ul><li>human analogy: the polite conversationalist </li></ul>
  86. 86. CSMA/CD collision detection
  87. 87. “Taking Turns” MAC protocols <ul><li>channel partitioning MAC protocols: </li></ul><ul><ul><li>share channel efficiently at high load </li></ul></ul><ul><ul><li>inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! </li></ul></ul><ul><li>random access MAC protocols </li></ul><ul><ul><li>efficient at low load: single node can fully utilize channel </li></ul></ul><ul><ul><li>high load: collision overhead </li></ul></ul><ul><li>“ taking turns” protocols </li></ul><ul><ul><li>look for best of both worlds! </li></ul></ul>
  88. 88. “Taking Turns” MAC protocols <ul><li>Polling: </li></ul><ul><li>master node “invites” slave nodes to transmit in turn </li></ul><ul><li>Request to Send, Clear to Send msgs </li></ul><ul><li>concerns: </li></ul><ul><ul><li>polling overhead </li></ul></ul><ul><ul><li>latency </li></ul></ul><ul><ul><li>single point of failure (master) </li></ul></ul><ul><li>Token passing: </li></ul><ul><li>control token passed from one node to next sequentially. </li></ul><ul><li>token message </li></ul><ul><li>concerns: </li></ul><ul><ul><li>token overhead </li></ul></ul><ul><ul><li>latency </li></ul></ul><ul><ul><li>single point of failure (token) </li></ul></ul>
  89. 89. Summary of MAC protocols <ul><li>What do you do with a shared media? </li></ul><ul><ul><li>Channel Partitioning, by time, frequency or code </li></ul></ul><ul><ul><ul><li>Time Division,Code Division, Frequency Division </li></ul></ul></ul><ul><ul><li>Random partitioning (dynamic), </li></ul></ul><ul><ul><ul><li>ALOHA, S-ALOHA, CSMA, CSMA/CD </li></ul></ul></ul><ul><ul><ul><li>carrier sensing: easy in some technologies (wire), hard in others (wireless) </li></ul></ul></ul><ul><ul><ul><li>CSMA/CD used in Ethernet </li></ul></ul></ul><ul><ul><li>Taking Turns </li></ul></ul><ul><ul><ul><li>polling from a central cite, token passing </li></ul></ul></ul>
  90. 90. LAN Addresses and ARP <ul><li>32-bit IP address: </li></ul><ul><li>network-layer address </li></ul><ul><li>used to get a datagram to a destination network (recall IP network definition) </li></ul><ul><li>LAN (or MAC, or physical ) address: </li></ul><ul><li>used to get datagram from one interface to another physically-connected interface ( same network ) </li></ul><ul><li>48 bit MAC address (for most LANs): permanent address, burned into the adapter ROM </li></ul>How many possible LAN/Physical addresses?
  91. 91. LAN Address (more) <ul><li>MAC address allocation administered by IEEE </li></ul><ul><li>manufacturer buys a portion of the MAC address space (to assure uniqueness) see current assignments </li></ul><ul><li>Analogy: </li></ul><ul><li>(a) MAC address: like Social Security Number </li></ul><ul><li>(b) IP address: like postal address </li></ul><ul><li>MAC flat address => portability </li></ul><ul><ul><li>can move LAN card from one LAN to another </li></ul></ul><ul><li>IP hierarchical address NOT portable </li></ul><ul><ul><li>depends on network to which one attaches </li></ul></ul>
  92. 92. Recall earlier routing discussion <ul><li>Starting at A, given an IP datagram addressed to B: </li></ul><ul><li>look up network address of B, find B on same network as A </li></ul><ul><li>link layer sends a datagram to B inside link-layer frame </li></ul>B’s MAC address A’s MAC address A’s IP address B’s IP address IP payload datagram frame frame source, destination address datagram source, destination address A B E
  93. 93. ARP: A ddress R esolution P rotocol <ul><li>Each IP node (Hosts & Routers) on a LAN has an ARP module and table </li></ul><ul><li>ARP Table: IP/MAC address mappings for some LAN nodes </li></ul><ul><li>< IP address; MAC address; TTL> </li></ul><ul><ul><li>TTL (Time To Live): time after which address mapping will be forgotten (typically < 20 minutes) </li></ul></ul>Question: how can we determine the MAC address of B given B’s IP address?
  94. 94. ARP protocol (RFC 826) <ul><li>A knows B's IP address, wants to learn physical address of B </li></ul><ul><li>A broadcasts ARP query packet, containing B's IP address </li></ul><ul><ul><li>all machines on LAN receive ARP query </li></ul></ul><ul><li>B receives the ARP packet, replies to A with its (B's) physical layer (MAC) address </li></ul><ul><li>A caches (saves) IP-to-physical address pairs until information becomes old (times out: TTL) </li></ul><ul><ul><li>soft state: information that times out (goes away) unless refreshed </li></ul></ul>Side effects… performance implications?
  95. 95. Ethernet Frame Structure <ul><li>Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame </li></ul><ul><li>Preamble: </li></ul><ul><li>7 bytes with pattern 10101010, followed by one byte with pattern 10101011 (frame delimiter) </li></ul><ul><li>used to synchronize receiver, sender clock rates </li></ul>(802.3 Data Length) Note: IEEE 802.3 specifies that frame length, excluding preamble, must be between 64 and 1518 bytes. Data is padded, if necessary, to ensure minimum length achieved
  96. 96. Ethernet Frame Structure (more) <ul><li>Addresses: 6 bytes , frame is received by all adapters on a LAN and dropped if address does not match </li></ul><ul><li>Type (Length): 2 bytes , indicates the higher layer protocol, mostly IP but others may be supported such as Novell IPX and AppleTalk). If 802.3 compliant, this field is length of data segment (min. 46 bytes) </li></ul><ul><li>CRC: 4 bytes , checked at receiver, if error detected, the frame is simply dropped </li></ul>
  97. 97. Ethernet: uses CSMA/CD <ul><li>A : sense channel, if idle (+96 clock ticks/bit times) </li></ul><ul><ul><li>then { </li></ul></ul><ul><ul><li> transmit and monitor the channel; </li></ul></ul><ul><ul><ul><ul><li>If detect another transmission </li></ul></ul></ul></ul><ul><ul><ul><ul><li>then { </li></ul></ul></ul></ul><ul><ul><ul><ul><li>abort and send jam signal; </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>update # collisions; </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>delay as required by exponential backoff algorithm; </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>goto A </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>} </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><li>else {done with the frame; set collisions to zero} </li></ul></ul></ul></ul><ul><ul><ul><li>} </li></ul></ul></ul><ul><ul><li>else {wait until ongoing transmission is over and goto A } </li></ul></ul>
  98. 98. Ethernet’s CSMA/CD Efficiency <ul><li>Recall that the probability of successful transmission in a slot is: P = Np(1-p) (N-1) </li></ul><ul><ul><li>which yields a mean probability of success (efficiency) of P = 1/e , for an optimal p=1/N as N -> infinity. </li></ul></ul><ul><li>Note that each 802.3 slot has a duration of the one-bit RTT (max) for the LAN (51.2  sec) = 2 *t prop </li></ul><ul><li>The average contention interval length (i.e., how long you must wait) is the duration of the interval divided by the probability, or: 2 *t prop / 1/e = 2e*t prop </li></ul><ul><li>Taking t trans to be the time it takes to transmit an average frame, channel efficiency can then be expressed as: </li></ul>t trans t trans + 2e t prop 1 1 + 5.4 t prop /t trans 
  99. 99. Ethernet’s CSMA/CD Efficiency Channel Efficiency Number of Stations Trying to Send 0 1 2 4 8 16 32 64 128 256 512 1.0 0.9 0.8 0,7 0.6 0.5 0.4 0.3 0.2 0.1 1024 byte frames 512 byte frames 128 byte frames 256 byte frames 64 byte frames
  100. 100. Ethernet Technologies: 10Base2 <ul><li>10: 10Mbps; 2: under 200 meters (actually 185) max. cable length per segment </li></ul><ul><li>thin coaxial cable in a bus topology </li></ul><ul><li>repeaters used to connect up to multiple segments </li></ul><ul><li>repeater repeats bits it hears on one interface to its other interfaces: physical layer device only! </li></ul>
  101. 101. 10BaseT and 100BaseT <ul><li>10/100 Mbps rate; latter called “fast ethernet” </li></ul><ul><li>T stands for Twisted Pair </li></ul><ul><li>Nodes are connected to hubs by twisted pair, thus “star topology” </li></ul><ul><li>CSMA/CD monitoring can be implemented at hub </li></ul>
  102. 102. 10BaseT and 100BaseT (more) <ul><li>Max. distance from node to Hub is 100 meters </li></ul><ul><ul><li>max. between any two nodes is 200 meters </li></ul></ul><ul><li>Hub can disconnect “jabbering” adapter </li></ul><ul><li>Hub can gather monitoring information, statistics for display to LAN administrators </li></ul><ul><li>Fiber links can be used to expand geographical reach (per IEEE 802) </li></ul>Q: How do you calculate the time it takes to send a datagram from one node to another via a hub?
  103. 103. Token Passing: IEEE802.5 standard <ul><li>4 Mbps </li></ul><ul><li>max token holding time: 10 ms, limiting frame length </li></ul><ul><li>SD, ED mark start, end of packet (each 8 bits) </li></ul><ul><li>AC: access control byte (8bits): </li></ul><ul><ul><li>token bit: value 0 means token can be seized, value 1 means data follows FC </li></ul></ul><ul><ul><li>priority bits: priority of packet </li></ul></ul><ul><ul><li>reservation bits: station can write these bits to prevent stations with lower priority packet from seizing token after token becomes free </li></ul></ul>ED
  104. 104. Interconnecting LANs <ul><li>Q: Why not just one big LAN? </li></ul><ul><li>Limited amount of supportable traffic: on single LAN, all stations must share bandwidth </li></ul><ul><li>limited length: 802.3 specifies maximum cable length </li></ul><ul><li>large “collision domain” (can collide with many stations) </li></ul><ul><li>limited number of stations: 802.5 have token passing delays at each station </li></ul>
  105. 105. Devices for Interconnecting LANs <ul><li>Hubs (repeaters) </li></ul><ul><ul><li>physical-layer bit-level repeaters </li></ul></ul><ul><ul><li>extend physical reach of a LAN </li></ul></ul><ul><ul><li>10/100BaseT interconnection (repeaters for 10Base2) </li></ul></ul><ul><li>Bridges </li></ul><ul><ul><li>link-layer, frame switches </li></ul></ul><ul><ul><li>extend physical reach and scale of a LAN </li></ul></ul><ul><ul><li>allow logical segregation of a LAN </li></ul></ul><ul><li>Switches </li></ul><ul><ul><li>Link-layer, high performance bridge </li></ul></ul>
  106. 106. Hub limitations <ul><li>single collision domain results in no increase in max throughput </li></ul><ul><ul><li>multi-tier throughput same as single segment throughput </li></ul></ul><ul><li>individual LAN restrictions pose limits on number of nodes in same collision domain and on total allowed geographical coverage </li></ul><ul><li>cannot connect different Ethernet types (e.g., 10BaseT and 100baseT </li></ul>Hub: “Bit In, Bit Out”
  107. 107. Bridges <ul><li>Link Layer devices: operate on Ethernet frames, examining frame header and selectively forwarding frame based on its destination </li></ul><ul><li>Bridge isolates collision domains since it buffers frames </li></ul><ul><li>When frame is to be forwarded on segment, bridge uses CSMA/CD to access segment and transmit </li></ul>
  108. 108. Bridges: frame filtering, forwarding <ul><li>bridges filter packets </li></ul><ul><ul><li>same-LAN -segment frames not forwarded onto other LAN segments </li></ul></ul><ul><li>forwarding: </li></ul><ul><ul><li>how to know which LAN segment on which to forward frame? </li></ul></ul><ul><ul><li>looks like a routing problem (more shortly!) </li></ul></ul>
  109. 109. Bridge Filtering <ul><li>bridges learn which hosts can be reached through which interfaces: maintain filtering tables </li></ul><ul><ul><li>when frame received, bridge “learns” location of sender: incoming LAN segment </li></ul></ul><ul><ul><li>records sender location in filtering table </li></ul></ul><ul><li>filtering table entry: </li></ul><ul><ul><li>( Node LAN Address, Bridge Interface, Time Stamp ) </li></ul></ul><ul><ul><li>stale entries in Filtering Table dropped (TTL can be 60 minutes) </li></ul></ul>
  110. 110. Bridge Filtering <ul><li>filtering procedure: </li></ul><ul><ul><li>if destination is on LAN on which frame was received </li></ul></ul><ul><ul><ul><li>then drop the frame </li></ul></ul></ul><ul><ul><ul><li>else { lookup filtering table </li></ul></ul></ul><ul><ul><ul><li>if entry found for destination </li></ul></ul></ul><ul><ul><ul><ul><ul><li>then forward the frame on interface indicated; </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>else flood; /* forward on all but the interface </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>on which the frame arrived*/ </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><li>} </li></ul></ul></ul></ul>
  111. 111. Bridge Learning: example <ul><li>Suppose C sends frame to D and D replies back with frame to C </li></ul><ul><li>C sends frame, bridge has no info about D, so floods to other attached LANs (on ports 2 and 3): </li></ul><ul><ul><li>bridge notes that C is on port 1 </li></ul></ul><ul><ul><li>frame ignored on upper LAN (port 3) </li></ul></ul><ul><ul><li>frame received by D (port 2) </li></ul></ul>C 1 <<< added
  112. 112. Bridge Learning: example <ul><li>D generates reply to C, sends </li></ul><ul><ul><li>bridge sees frame from D </li></ul></ul><ul><ul><li>bridge notes that D is on interface 2 </li></ul></ul><ul><ul><li>bridge knows C on interface 1, so selectively forwards frame out via interface 1 </li></ul></ul>C 1 D 2 <<< added
  113. 113. Bridges vs. Routers (or layer-3 switches) <ul><li>both are store-and-forward devices </li></ul><ul><ul><li>routers: network layer devices (examine network layer headers) </li></ul></ul><ul><ul><li>bridges are link layer devices </li></ul></ul><ul><li>routers maintain routing tables, implement routing algorithms </li></ul><ul><li>bridges maintain filtering tables, implement filtering, learning and spanning tree algorithms </li></ul>
  114. 114. Ethernet Switches <ul><li>cut-through switching: frame forwarded from input to output port without awaiting for assembly of entire frame </li></ul><ul><ul><li>not a store-and-forward operation </li></ul></ul><ul><ul><li>slight reduction in latency over store-and-forward </li></ul></ul><ul><li>combinations of shared/dedicated, 10/100/1000 Mbps interfaces </li></ul>
  115. 115. IEEE 802.11 Wireless LAN <ul><li>wireless LANs: untethered (often mobile) networking </li></ul><ul><li>IEEE 802.11 standard: </li></ul><ul><ul><li>MAC protocol </li></ul></ul><ul><ul><li>unlicensed frequency spectrum: 900Mhz, 2.4Ghz </li></ul></ul><ul><li>Basic Service Set (BSS) (a.k.a. “cell”) contains: </li></ul><ul><ul><li>wireless hosts </li></ul></ul><ul><ul><li>access point (AP): base station </li></ul></ul><ul><li>BSS’s combined to form distribution system (DS) </li></ul>
  116. 116. Ad Hoc Networks <ul><li>Ad hoc network: IEEE 802.11 stations can dynamically form network without AP </li></ul><ul><li>Applications: </li></ul><ul><ul><li>“ laptop” meeting in conference room, car! </li></ul></ul><ul><ul><li>interconnection of “personal” devices </li></ul></ul><ul><ul><li>battlefield </li></ul></ul><ul><li>IETF MANET (Mobile Ad hoc Networks) working group </li></ul>
  117. 117. IEEE 802.11 MAC Protocol: CSMA/CA <ul><li>802.11 CSMA: sender </li></ul><ul><li>- if sense channel idle for DIFS sec. </li></ul><ul><li>then transmit entire frame (no collision detection) </li></ul><ul><li>-if sense channel busy then exponential backoff (like Ethernet) </li></ul><ul><li>802.11 CSMA receiver: </li></ul><ul><li>if received OK </li></ul><ul><li>return ACK after SIFS </li></ul>
  118. 118. IEEE 802.11 MAC Protocol <ul><li>802.11 CSMA Protocol: others </li></ul><ul><li>NAV : Network Allocation Vector </li></ul><ul><li>802.11 frame has transmission time field </li></ul><ul><li>others (hearing data) defer access for NAV time units </li></ul>
  119. 119. Hidden Terminal effect <ul><li>hidden terminals: A, C cannot hear each other </li></ul><ul><ul><li>obstacles, signal attenuation </li></ul></ul><ul><ul><li>collisions at B </li></ul></ul><ul><li>goal: avoid collisions at B </li></ul><ul><li>CSMA/CA: CSMA with C ollision Avoidance </li></ul>
  120. 120. Collision Avoidance: RTS-CTS exchange <ul><li>CSMA/CA: explicit channel reservation </li></ul><ul><ul><li>sender: send short RTS: request to send </li></ul></ul><ul><ul><li>receiver: reply with short CTS: clear to send </li></ul></ul><ul><li>CTS reserves channel for sender, notifying (possibly hidden) stations </li></ul><ul><li>avoid hidden station collisions </li></ul>
  121. 121. Collision Avoidance: RTS-CTS exchange <ul><li>RTS and CTS short: </li></ul><ul><ul><li>collisions less likely, of shorter duration </li></ul></ul><ul><ul><li>end result similar to collision detection </li></ul></ul><ul><li>IEEE 802.11 allows: </li></ul><ul><ul><li>CSMA </li></ul></ul><ul><ul><li>CSMA/CA: reservations </li></ul></ul><ul><ul><li>polling from AP </li></ul></ul>
  122. 122. Point to Point Data Link Control <ul><li>one sender, one receiver, one link: easier than broadcast link: </li></ul><ul><ul><li>bit-oriented transmission stream </li></ul></ul><ul><ul><li>no Media Access Control </li></ul></ul><ul><ul><li>no need for explicit MAC addressing </li></ul></ul><ul><ul><ul><li>e.g., dialup link, ISDN line </li></ul></ul></ul><ul><li>popular point-to-point DLC protocols: </li></ul><ul><ul><li>PPP (point-to-point protocol) </li></ul></ul><ul><ul><li>HDLC: High-level data link control </li></ul></ul><ul><ul><ul><li>Data link used to be considered a “high layer” in the protocol stack! </li></ul></ul></ul><ul><ul><ul><li>also: SDLC, ADCCP, LAP, LAPB </li></ul></ul></ul>
  123. 123. PPP Design Requirements [RFC 1557] <ul><li>packet framing: encapsulation of network-layer datagram in data link frame </li></ul><ul><ul><li>carry network layer data of any network layer protocol (not just IP) at same time </li></ul></ul><ul><ul><li>ability to demultiplex upwards </li></ul></ul><ul><li>bit transparency: must carry any bit pattern in the data field </li></ul><ul><li>error detection (no correction) </li></ul><ul><li>connection liveness: detect, signal link failure to network layer </li></ul><ul><li>network layer address negotiation: endpoint can learn/configure each other’s network address </li></ul>
  124. 124. PPP non -requirements ( explicit in the specification ) <ul><li>no error correction/recovery </li></ul><ul><li>no flow control </li></ul><ul><li>no ordering … out of order delivery OK </li></ul><ul><li>no need to support multipoint links (e.g., polling) </li></ul>Error recovery, flow control, data re-ordering/sequencing all relegated to higher layers!|
  125. 125. PPP Data Frame <ul><li>Flag: delimiter (framing) </li></ul><ul><li>Address: does nothing (only one option in PPP) </li></ul><ul><li>Control: does nothing; in the future possible multiple control fields </li></ul><ul><li>Protocol: upper layer protocol to which frame delivered (e.g., C021x = PPP-LCP, 8021x = IPCP, 0021x = IP, 0029x = AppleTalk, etc.) </li></ul>
  126. 126. PPP Data Frame <ul><li>info: upper layer data being carried </li></ul><ul><li>check: cyclic redundancy check (CRC) for error detection </li></ul>* *Maximum payload length is negotiated by link control protocol at link establishment, or default is 1500 bytes.
  127. 127. Byte Stuffing <ul><li>“ data transparency” requirement: data/info field must be allowed to contain “special” bit patterns, such as flag <01111110> </li></ul><ul><ul><li>Q: is received <01111110> data or flag? </li></ul></ul><ul><li>Sender: adds (“stuffs”) a special control escape byte < 01111101> byte before each < 01111110> data byte </li></ul><ul><ul><li>Q: what about <01111101> in the data? </li></ul></ul><ul><li>Receiver: </li></ul><ul><ul><li>when <01111101> received: discard it, then continue data reception </li></ul></ul><ul><ul><li>single 01111110: flag byte </li></ul></ul>
  128. 128. ATM architecture <ul><li>adaptation layer: only at edge of ATM network </li></ul><ul><ul><li>data segmentation/reassembly </li></ul></ul><ul><ul><li>roughly analogous to Internet transport layer </li></ul></ul><ul><li>ATM layer: “network” layer </li></ul><ul><ul><li>cell switching, routing </li></ul></ul><ul><li>physical layer </li></ul>
  129. 129. ATM Layer <ul><li>Service: transport cells across ATM network </li></ul><ul><li>analogous to IP network layer </li></ul><ul><li>very different services than IP network layer </li></ul>Network Architecture Internet ATM ATM ATM ATM Service Model best effort CBR VBR ABR UBR Bandwidth none constant rate guaranteed rate guaranteed minimum none Loss no yes yes no no Order no yes yes yes yes Timing no yes yes no no Congestion feedback no (inferred via loss) no congestion no congestion yes no Guarantees ?
  130. 130. ATM Layer: ATM cell <ul><li>Core of ATM standard </li></ul><ul><li>5-byte ATM cell header </li></ul><ul><li>48-byte payload </li></ul><ul><ul><li>Why?: small payload -> short cell-creation delay for digitized voice </li></ul></ul><ul><ul><li>halfway between 32 and 64 (compromise!) </li></ul></ul>Cell header Cell format
  131. 131. ATM cell header <ul><li>VCI: virtual channel ID </li></ul><ul><ul><li>will change from link to link thru net </li></ul></ul><ul><li>PT: Payload type (e.g. RM cell, idle cell, data cell) </li></ul><ul><li>CLP: Cell Loss Priority bit </li></ul><ul><ul><li>CLP = 1 implies low priority cell, can be discarded if congestion </li></ul></ul><ul><li>HEC: Header Error Checksum (8-bit) </li></ul><ul><ul><li>cyclic redundancy check </li></ul></ul>
  132. 132. IP-Over-ATM <ul><li>Issues: </li></ul><ul><li>Conversion of IP datagrams into ATM AAL5 PDUs </li></ul><ul><li>Conversion from IP addresses to ATM addresses </li></ul><ul><ul><li>just like IP addresses to 802.3 MAC addresses! </li></ul></ul>ATM backbone network Ethernet LANs
  133. 133. Datagram Journey in IP-over-ATM Network <ul><li>at Source Host/Gateway: </li></ul><ul><ul><li>IP layer finds mapping between IP and ATM destination address (using ARP) </li></ul></ul><ul><ul><li>passes datagram to AAL5 </li></ul></ul><ul><ul><li>AAL5 encapsulates data, segments to cells, passes to ATM layer </li></ul></ul><ul><li>ATM network: moves cell along Virtual Circuit (permanent?) to destination </li></ul><ul><li>at Destination Host/Gateway: </li></ul><ul><ul><li>AAL5 reassembles cells into original datagram </li></ul></ul><ul><ul><li>if CRC OK, datagram is passed to IP </li></ul></ul>