* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Internet Design Principles (Cont.) and Link Layer
Zero-configuration networking wikipedia , lookup
Backpressure routing wikipedia , lookup
Distributed firewall wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Computer network wikipedia , lookup
Deep packet inspection wikipedia , lookup
Network tap wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Airborne Networking wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Routing in delay-tolerant networking wikipedia , lookup
Internet protocol suite wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Introduction to Communication Networks –67594 Dr. Michael Schapira Some of the slides were taken from Prof. Scott Shenker, UC Berkeley Physical Communication • Communication goes down to physical network • Then from network peer to peer • Then up to relevant layer Application Transport Network Datalink Physical Host A Protocol Network Datalink Physical Router Application Transport Network Datalink Physical Host B 2 Characterizing the Layers (OSI) • Service: what a layer does • Service interface: how to access the service – Interface for layer above • Protocol: how peers communicate – Protocol interface: set of rules and formats that govern the communication between network elements – Determines how the peers achieve the service – Does not govern implementation on a single machine, but how the layer is implemented between machines • Examples: layer can have many implementations – This allows innovation! 3 The Internet Hourglass SMTP HTTP DNS TCP Applications NTP Transport UDP IP Waist Data Link Ethernet Copper SONET Fiber 802.11 Radio Physical The Hourglass Model There is just one network-layer protocol, IP. The “narrow waist” facilitates interoperability. 4 Implications of Hourglass • Allows arbitrary L2 networks to interoperate – Any networks that support IP can exchange packets • Allows applications to function on all networks – Applications that can run on IP can use any network • Supports innovations above and below IP – Innovations can be independent, done in parallel • But changing IP itself, i.e., IPv6, very hard 5 Back to Modularity • Modularity in programming: – Set of abstractions • Modularity in networking: – Distributed nature of system requires deciding where abstractions are implemented 6 Three Basic Architectural Decisions • How to break system into modules • Where modules are implemented • Where state is stored 7 Breaking into Modules • That is described by layering 8 Placing Network Functionality • Hugely influential paper: “End-to-End Arguments in System Design” by Saltzer, Reed, and Clark (‘84) – End-to-end principle • Basic observation: some types of network functionality can only be correctly implemented end-to-end • Because of this, end hosts: – Can satisfy the requirement without network’s help – Must do so, since can’t rely on network’s help • Thus, don’t need to implement them in network 9 Example: Reliable File Transfer Host A Host B Appl. OS Appl. OK OS • Solution 1: make each step reliable, and string them together to make reliable end-to-end process • Solution 2: allow steps to be unreliable, but do end-to-end check and try again if necessary 10 Discussion • Solution 1 cannot be made perfectly reliable – What happens if a network element misbehaves? – Receiver has to do the check anyway! • Solution 2 can also fail, but only if the end system itself fails (i.e., doesn’t follow its own protocol) • Solution 2 only relies on what it can control – The endpoint behavior • Solution 1 requires endpoints trust other elements – That’s not what reliable means! 11 Robust (From Clark’s Paper) • As long as the network is not partitioned, two endpoints should be able to communicate • Failures (except network partition) should not interfere with endpoint semantics 12 Question? • Should you ever implement reliability in network? • Perhaps, if needed for reasonable efficiency – Don’t aim for perfect reliability, but ok to reduce error rate • If individual links fail 10% of the time, and are traversing 10 links, then E2E error rate is 65% • Implementing one retransmission on links – Link error rate reduced to 1%, E2E error rate is 9.5% 13 Back to the End-to-End Principle Implementing such functionality in the network: • Doesn’t reduce host implementation complexity • Does increase network complexity • Probably imposes delay and overhead on all applications, even if they don’t need functionality • However, implementing in network can enhance performance in some cases – E.g., very lossy link 14 Conservative Interpretation of E2E • Don’t implement a function at the lower levels of the system unless it can be completely implemented at this level • Unless you can relieve the burden from hosts, don’t bother 15 Radical Interpretation of E2E • Don’t implement anything in the network that can be implemented correctly by the hosts – E.g., multicast • Make network layer absolutely minimal – E2E principle trumps performance issues – Increases flexibility, since lower layers stay simple 16 Important life lessons (partial) • Flexibility often more important than performance • Architect for flexibility, engineer for performance 17 Moderate Interpretation • Think twice before implementing functionality in the network • If hosts can implement functionality correctly, implement it in a lower layer only as a performance enhancement • But do so only if it does not impose burden on applications that do not require that functionality 18 What Does E2E Principle Ignore? • There are other stakeholders besides users – ISP might care about the good operation of their network – Various commercial entities – Money-chain might require insertion into the network • The need for middlebox functionality – Some functions that, for management reasons, are more easily done in the network. 19 Three Basic Architectural Decisions • How to break system into modules • Where modules are implemented • Where state is stored 20 Fate-Sharing • Note that E2E principles relied on “fatesharing” – Invariants break only when endpoints themselves break – Minimize dependence on other network elements • This should dictate placement of storage 21 General Principle: Fate-Sharing • When storing state in a distributed system, colocate it with entities that rely on that state • Only way failure can cause loss of the critical state is if the entity that cares about it also fails ... – … in which case it doesn’t matter • Often argues for keeping network state at end hosts rather than inside routers – In keeping with End-to-End principle – E.g., packet-switching rather than circuit-switching – E.g., NFS file handles, HTTP “cookies” 22 Decisions and Their Principles • How to break system into modules – Dictated by Layering • Where modules are implemented – Dictated by End-to-End Principle • Where state is stored – Dictated by Fate-Sharing 23 Reminder: Tasks in Networking (bottom up) • • • • Electrons on wire Bits on wire Packets on wire Deliver packets across local network – Local addresses Not in this course (mostly) The following few weeks • Deliver packets across country – Global addresses • Ensure that packets get there • Do something with the data Later in the course 24 Chapter 5 Link Layer and LANs A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Computer Networking: A Top Down Approach 5th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. Thanks and enjoy! JFK/KWR All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights Reserved 5: DataLink Layer 5-25 The Data Link Layer Our goals: r understand principles behind data link layer services: m m m m error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control r instantiation and implementation of various link layer technologies 5: DataLink Layer 5-26 Link Layer r 5.1 Introduction and r r r r services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-layer Addressing 5.5 Ethernet r 5.6 Link-layer switches r 5.7 PPP r 5.8 Link virtualization: ATM, MPLS 5: DataLink Layer 5-27 Some Terminology r r hosts and routers are nodes communication channels that connect adjacent nodes along communication path are links m m m r wired links wireless links LANs layer-2 packet is a frame, encapsulates datagram data-link layer has responsibility of transferring datagram from one node to adjacent node over a link 5: DataLink Layer 5-28 Link layer: context r datagram transferred by different link protocols over different links: m e.g., Ethernet on first link, frame relay on intermediate links, 802.11 on last link r each link protocol provides different services m e.g., may or may not provide reliability over link transportation analogy r trip from Honolulu to Jerusalem m taxi: Honolulu to HNL m plane: HNL to EWR m plane: EWR to TLV m train☺: TLV to Jerusalem r passenger = datagram r transport segment = communication link r transportation mode = link layer protocol r travel agent = routing algorithm 5: DataLink Layer 5-29 Link Layer Services r framing, link access: m m m encapsulate datagram into frame, adding header, trailer channel access if shared medium “MAC” addresses used in frame headers to identify source, dest • different from IP address! r reliable delivery between adjacent nodes m seldom used on low bit-error link (fiber, some twisted pair) m wireless links: high error rates • Q: how this corresponds with the E2E principle? 5: DataLink Layer 5-30 Link Layer Services (more) r flow control: m pacing between adjacent sending and receiving nodes r error detection: m m errors caused by signal attenuation, noise. receiver detects presence of errors: • signals sender for retransmission or drops frame r error correction: m receiver identifies and corrects bit error(s) without resorting to retransmission r half-duplex and full-duplex m with half duplex, nodes at both ends of link can transmit, but not at same time 5: DataLink Layer 5-31 Where is the link layer implemented? r in each and every host r link layer implemented in “adaptor” (aka network interface card NIC) m m Ethernet card, PCMCI card, 802.11 card implements link, physical layer r attaches into host’s system buses r combination of hardware, software, firmware host schematic application transport network link cpu memory controller link physical host bus (e.g., PCI) physical transmission network adapter card 5: DataLink Layer 5-32 Adaptors Communicating datagram datagram controller controller receiving host sending host datagram frame r sending side: m encapsulates datagram in frame m adds error checking bits, rdt, flow control, etc. r receiving side m looks for errors, flow control, etc. m extracts datagram, passes to upper layer at receiving side 5: DataLink Layer 5-33 Link Layer r 5.1 Introduction and r r r r services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-layer Addressing 5.5 Ethernet r 5.6 Link-layer switches r 5.7 PPP r 5.8 Link Virtualization: ATM. MPLS 5: DataLink Layer 5-34 Error Detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, may include header fields • Error detection not 100% reliable! • protocol may miss some errors, but rarely • larger EDC field yields better detection and correction otherwise 5: DataLink Layer 5-35 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0 5: DataLink Layer 5-36 Internet checksum (review) Goal: detect “errors” (e.g., flipped bits) in transmitted packet (note: used at transport layer only) Receiver: Sender: r r r treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into a checksum field r r compute checksum of received segment check if computed checksum equals checksum field value: m NO - error detected m YES - no error detected. But maybe errors nonetheless? 5: DataLink Layer 5-37 Checksumming: Cyclic Redundancy Check r r r view data bits, D, as a binary number choose r+1 bit pattern (generator), G goal: choose r CRC bits, R, such that m m m r <D,R> exactly divisible by G (modulo 2) receiver knows G, divides <D,R> by G. If non-zero remainder: error detected! can detect all burst errors less than r+1 bits widely used in practice (Ethernet, 802.11 WiFi, ATM) 5: DataLink Layer 5-38 CRC Example Want: D.2r XOR R = nG equivalently: D.2r = nG XOR R equivalently: if we divide D.2r by G, want remainder R R = remainder[ D.2r G ] 5: DataLink Layer 5-39 Information Theory r Finding the optimal code under given constraints is a very well-researched area, which is part of Information Theory m r Pioneered by Claude Shannon 1916-2001; first information theory paper in 1948 Very active area of research even today m E.g., network coding r Beside what we saw so far, out of the scope of this course 5: DataLink Layer 5-40 Link Layer r 5.1 Introduction and r r r r services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-layer Addressing 5.5 Ethernet r 5.6 Link-layer switches r 5.7 PPP r 5.8 Link Virtualization: ATM, MPLS 5: DataLink Layer 5-41 Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host r broadcast (shared wire or medium) m old-fashioned Ethernet m upstream HFC m 802.11 wireless LAN shared wire (e.g., cabled Ethernet) shared RF (e.g., 802.11 WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical) 5: DataLink Layer 5-42 Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions by nodes: interference m collision if node receives two or more signals at the same time multiple access protocol r distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit r communication about channel sharing must use channel itself! m no out-of-band channel for coordination 5: DataLink Layer 5-43 Ideal Multiple Access Protocol Broadcast channel of rate R bps 1. when one node wants to transmit, it can send at rate R. 2. when M nodes want to transmit, each can send at average rate R/M 3. fully decentralized: m m no special node to coordinate transmissions no synchronization of clocks, slots 4. simple 5: DataLink Layer 5-44 MAC Protocols: a taxonomy Three broad classes: r Channel Partitioning m m divide channel into smaller “pieces” (time slots, frequency, code) allocate piece to node for exclusive use r Random Access m channel not divided, allow collisions m “recover” from collisions r “Taking turns” m nodes take turns, but nodes with more to send can take longer turns 5: DataLink Layer 5-45 Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access r access to channel in "rounds" r each station gets fixed length slot (length = packet transmission time) in each round r unused slots go idle r example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 6-slot frame 1 3 4 1 3 4 5: DataLink Layer 5-46 Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access r channel spectrum divided into frequency bands r each station assigned fixed frequency band r unused transmission time in frequency bands go idle r example: 6-station LAN, 1,3,4 have pkt, frequency FDM cable frequency bands bands 2,5,6 idle 5: DataLink Layer 5-47 Random Access Protocols r When node has packet to send m transmit at full channel data rate R. m no a priori coordination among nodes r two or more transmitting nodes ➜ “collision”, r random access MAC protocol specifies: m how to detect collisions m how to recover from collisions (e.g., via delayed retransmissions) r Examples of random access MAC protocols: m slotted ALOHA m ALOHA m CSMA, CSMA/CD, CSMA/CA 5: DataLink Layer 5-48 Slotted ALOHA Assumptions: r all frames same size r time divided into equal size slots (time to transmit 1 frame) r nodes start to transmit only at slot beginning r nodes are synchronized r if 2 or more nodes transmit in slot, all nodes detect collision Operation: r when node obtains fresh frame, transmits in next slot m if no collision: node can send new frame in next slot m if collision: node retransmits frame in each subsequent slot with prob. p until success 5: DataLink Layer 5-49 Slotted ALOHA Pros r single active node can continuously transmit at full rate of channel r highly decentralized: only slots in nodes need to be in sync r simple Cons r collisions, wasting slots r idle slots r nodes may be able to detect collision in less than time to transmit packet r clock synchronization 5: DataLink Layer 5-50 Goodput vs. Throughput r Goodput: long-run fraction of successful slots (many nodes, all with many frames to send) r Throughput: long- run fraction of slots in which there was a transmission (not necessarily successful) 5: DataLink Layer 5-51 Slotted Aloha Goodput Goodput: long-run fraction of successful slots (many nodes, all with many frames to send) r suppose: N nodes with many frames to send, each transmits in each slot with probability p r prob that given node succeeds in a slot = p(1-p)N-1 r prob that some node succeeds = Np(1-p)N-1 r max efficiency: find p* that maximizes Np(1-p)N-1 r for many nodes, taking limit of Np*(1-p*)N-1 as N goes to infinity, gives: Max efficiency = 1/e = .37 At best: channel used for useful transmissions 37% of time! 5: DataLink Layer ! 5-52 Pure (unslotted) ALOHA r Unslotted Aloha: simpler, no synchronization r Each host behaves as if it runs slotted ALOHA m Sends a frame with probability p on each of its own slots. r collision probability increases: m frame sent at a slot the starts in time t0 collides with other frames sent in slots that start in [t0-1,t0+1] 5: DataLink Layer 5-53 Pure Aloha Goodput P(success by given node) = Pr(node transmits) . Pr(no other node transmits in [t0-1,t0+1] = Pr(node transmits) . Pr(no other node transmits in [t0-1,t0] . Pr(no other node transmits in [t0,t0+1] = p . (1-p)N-1 . (1-p)N-1 = p . (1-p)2(N-1) … choosing optimum p and then letting n -> infty ... even worse than= .18 slotted Aloha! = 1/(2e) 5: DataLink Layer 5-54 CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame r If channel sensed busy, defer transmission r human analogy: don’t interrupt others! 5: DataLink Layer 5-55 CSMA collisions spatial layout of nodes collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted note: role of distance & propagation delay in determining collision probability 5: DataLink Layer 5-56 CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA m m collisions detected within short time colliding transmissions aborted, reducing channel wastage r collision detection: m easy in wired LANs: measure signal strengths, compare transmitted, received signals m difficult in wireless LANs: received signal strength overwhelmed by local transmission strength r human analogy: the polite conversationalist 5: DataLink Layer 5-57 CSMA/CD collision detection 5: DataLink Layer 5-58 “Taking Turns” MAC protocols channel partitioning MAC protocols: m share channel efficiently and fairly at high load m inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! Random access MAC protocols m efficient at low load: single node can fully utilize channel m high load: collision overhead “taking turns” protocols look for best of both worlds! 5: DataLink Layer 5-59 “Taking Turns” MAC protocols Polling: r master node “invites” slave nodes to transmit in turn r typically used with “dumb” slave devices r concerns: m m m data poll master data slaves polling overhead latency single point of failure (master) 5: DataLink Layer 5-60 “Taking Turns” MAC protocols Token passing: r control token passed from one node to next sequentially. r token message r concerns: m m m token overhead latency single point of failure (token) T (nothing to send) T data 5: DataLink Layer 5-61 Summary of MAC protocols r channel partitioning, by time, frequency or code m Time Division, Frequency Division r random access (dynamic), m ALOHA, S-ALOHA, CSMA, CSMA/CD m carrier sensing: easy in some technologies (wire), hard in others (wireless) m CSMA/CD used in Ethernet m CSMA/CA used in 802.11 r taking turns m polling from central site, token passing m Bluetooth, FDDI, IBM Token Ring 5: DataLink Layer 5-62