The Data Link Layer Data Link layer Link Layer services • Encoding • encode binary data into electromagnetic signals • Framing • encapsulate data into frame, adding header, trailer ‘physical addresses’ used in frame headers to identify • source, dest (different from IP address!) • Link access control • coordinate access for shared link • Flow control • pacing between sending and receiving nodes such that the sender does not overwhelm the receiver • nodes on each side of a link have a limited amount of packet buffering capacity Types of errors • An error occurs when a bit • Single bit error is altered between transmission and reception • Binary 1 is transmitted and binary 0 is received • Binary 0 is transmitted and binary 1 is received • Bit error – 2 or more bits changed Error detection process Parity checking • Single bit parity: Detects single bit errors Read about • Internet checksum • Cyclic Redundancy Check • Two Dimension Bit Parity Detects up to 3 bit errors Link Layer Multiple Access Protocols two types of “links”: • point-to-point • PPP for dial-up access • point-to-point link between Ethernet switch, host • broadcast (shared wire or medium) • Older Ethernet • upstream Hybrid fiber-coaxial (HFC) • 802.11 wireless LAN Multiple Access Protocol • Multiple access protocol: • distributed algorithm that determines how nodes share channel, i.e., • determine when node can transmit • communication about channel sharing must use channel itself! • Ideal multiple access protocol: For a multiple access 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: • no special node to coordinate transmissions • no synchronized clocks • fault-tolerant/robust Types of Multiple access Protocols • Three broad classes: • Channel partitioning • divide channel into smaller “pieces” (time slots, frequency, code) • allocate piece to node for exclusive use • Random access • channel not divided, allow collisions • “recover” from collisions • Centrally controlled/coordinated • tightly coordinate shared access to avoid collisions Channel partitioning • TDMA: Time Division Multiple Access • access to channel in "rounds" • each station gets fixed length slot (length = pkt trans time) in each round • unused slots go idle • FDMA: frequency division multiple access • channel spectrum divided into frequency bands • each station assigned fixed frequency band • unused transmission time in frequency bands go idle Channel portioning cont’d CDMA: Code division multiple access • Transmissions are combined on the same channel at the same time but are separated by codes • Uses coding to allow multiple simultaneous transmission without interference. • Each user has it’s unique code. Channel portioning cont’d • F/TDMA • 2G cellular network CDMA 3G cellular network How good are channel portioning protocols • Broadcast channel of rate R bps 1. When all M nodes want to transmit each can send at average rate R/M 2. When one node wants to transmit it can send at rate R/M. Inefficient! 3. Decentralization/fault tolerance: • • no special node to coordinate transmissions synchronized clocks for all but FDMA Random Access protocols • When node has data to send • transmit at full channel data rate R. • no a priori coordination among nodes • Two or more transmitting nodes -> “collision”, • Random access protocol specifies: • how to detect collisions • how to recover from collisions (e.g., via delayed retransmissions) • Examples of random access protocols: • slotted ALOHA • ALOHA • CSMA, CSMA/CD CSMA/CD Used in ethernet If the medium is idle, transmit; otherwis e, go to step 2 If the medium is busy, continue to listen until the channel is idle, then transmit immediately If a collision is detected, transmit a brief jamming signal to assure that all stations know that there has been a collision and cease transmission After transmittin g the jamming signal, wait a random amount of time, referred to as the backoff, then attempt to transmit again Ethernet • dominant” for local-area networks: • Developed at Xerox PARC in 1970s • First widely used LAN technology • Random access multiple access control • Ethernet Frame structure • Sending adapter encapsulates data payload in Ethernet frame Ethernet frame • Preamble: • 7 bytes with pattern 10101010 followed by one byte with pattern10101011 • indicating the beginning of a frame, synchronizing receiver/sender clocks • Addresses: • link layer addresses, different from IP addresses • Length: indicates the length of the body field (max 1500bytes) • CRC: checked at receiver • if error is detected, the frame is simply dropped Connectionless, Unreliable • Connectionless: • No handshaking between sending and receiving adapter. • Unreliable: • corrupted frames are simply dropped • no attempt is made on the receiver to detect and recover lost frames • corrupted or lost packets may be recovered by higher layer protocols, e.g. TCP Ethernet uses CDMA/CD • Random access, no • Before attempting a synchronized clocks retransmission, adapter waits a random • adapter doesn’t transmit if it senses that some other adapter is transmitting, that is, carrier sense • transmitting adapter aborts when it senses that another adapter is transmitting, that is, collision detection How good are random access protocols • Multiple channel of rate R bps 1. When one node wants to transmit, • it can send at full rate R. 2. When M nodes want to transmit, • each can send at average rate less than R/M. Not ideal! 3. Decentralization: • no special node to coordinate transmissions • no synchronized clocks except for slotted ALOHA Centrally Controlled MAC protocols • Polling: • Token passing: • master node “invites” • control token passed from one • slave nodes to transmit in turn • concerns: • polling overhead (bandwidth & latency) • single point of failure (master) • node to next sequentially. • transmit only when holding the token • concerns: • token overhead (bandwidth & latency) • single point of failure (token) LAN Interconnection • MAC addresses and ARP • MAC (or LAN or physical or Ethernet) address: • function: used ‘locally” to get frame from one interface to another physically-connected interface (same network, in IP-addressing sense) • 48 bit MAC address (for most LANs) burned in NIC ROM, also sometimes software settable • e.g.: 1A-2F-BB-76-09-AD • Universally unique Question • How do we determine node A’s link layer address knowing it’s IP address.? Address Resolution Protocol (ARP) • Specific to internet Architecture • Each node (Host, Router) on a LAN has an ARP table • ARP Table: IP/Link layer address mappings for some LAN nodes How ARP work? • A wants to send datagram to B with an IP address. • Suppose B’s link-layer address is not in A’s ARP table. • A broadcasts ARP query packet, containing B's IP address. • B receives ARP packet, replies to A with its (B's) link-layer address. • A caches (saves) IP-to-link layer address pair in its ARP table until it times out when can a mapping change? • Broadcasting an ARP request • ARP reply Interconnecting Nodes in LAN • Hubs: physical-layer signal repeaters. • Bridges: understands link-layer protocol (Ethernet), smarter than hubs. • Switches: essentially bridges with large number of ports. • What is the difference between bridges, switches and hubs? Questions ?