Chapter 6 The Link Layer and LANs A note on the use of these Powerpoint slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you see the animations; and 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) that you mention their source (after all, we d like people to use our book!) If you post any slides 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. Thanks and enjoy! JFK/KWR All material copyright 1996-2016 J.F Kurose and K.W. Ross, All Rights Reserved Computer Networking: A Top Down Approach 7 th edition Jim Kurose, Keith Ross Pearson/Addison Wesley April 2016 6-1
Chapter 6: Link layer and LANs our goals: understand principles behind link layer services: error detection, correction sharing a broadcast channel: multiple access link layer addressing local area networks: Ethernet, VLANs instantiation, implementation of various link layer technologies 6-2
Link layer, LANs: outline 6.1 introduction, services 6.2 error detection, correction 6.3 multiple access protocols 6.4 LANs addressing, ARP Ethernet switches VLANS 6.5 link virtualization: MPLS 6.6 data center networking 6.7 a day in the life of a web request 6-3
Link layer: introduction terminology: hosts and routers: nodes communication channels that connect adjacent nodes along communication path: links wired links wireless links LANs layer-2 packet: frame, encapsulates datagram data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link 6-4
Link layer: context datagram transferred by different link protocols over different links: e.g., Ethernet on first link, frame relay on intermediate links, 802.11 on last link each link protocol provides different services e.g., may or may not provide rdt (Real Data Transport) over link transportation analogy: trip from Princeton to Lausanne limo: Princeton to JFK plane: JFK to Geneva train: Geneva to Lausanne tourist = datagram transport segment = communication link transportation mode = link layer protocol travel agent = routing algorithm 6-5
Media Access Control MAC Addresses 32-bit IP address: network-layer address used to get datagram to destination IP subnet MAC address (e.g., Ethernet LAN): used to get datagram from one interface to another physically-connected interface (on the same network) 48-bit MAC address (for most LANs) burned in the adapter ROM (globally unique) 6
MAC Addresses Each adapter on LAN has unique LAN address 1A-2F-BB-76-09-AD Broadcast address = FF-FF-FF-FF-FF-FF 71-65-F7-2B-08-53 LAN (wired or wireless) 58-23-D7-FA-20-B0 = adapter 0C-C4-11-6F-E3-98 7
LAN Address MAC address allocation administered by IEEE manufacturer buys portion of MAC address space MAC flat address provides portability can move LAN card from one LAN to another different than with IP addresses! 8
ARP: Address Resolution Protocol Question: how to determine MAC address of B knowing B s IP address? 237.196.7.23 LAN 237.196.7.78 1A-2F-BB-76-09-AD 237.196.7.14 Each IP node (Host, Router) on LAN has ARP table ARP Table: IP/MAC address mappings for some LAN nodes < IP address; MAC address; TTL> TTL (Time To Live): time after which address 71-65-F7-2B-08-53 -23-58D7-FA-20-B0 237.196.7.88 0C-C4-11-6F-E3-98 mapping will be forgotten (typically 20 min) 9
ARP protocol: Same LAN (network) A wants to send datagram to B, and B s MAC address not in A s ARP table. A broadcasts ARP query packet, containing B's IP address Dest MAC address = FF-FF-FF-FF-FF-FF all machines on LAN receive ARP query B receives ARP packet, replies to A with its (B's) MAC address frame sent to A s MAC address (unicast) A caches (saves) IP-to- MAC address pair in its ARP table until information becomes old (times out) ARP is a soft state protocol: information that times out unless refreshed ARP is plug-and-play : nodes create their ARP tables without intervention from net administrator 10
Addressing: routing to another LAN walkthrough: send datagram from A to B via R. focus on addressing - at both IP (datagram) and MAC layer (frame) assume A knows B s IP address (how?) assume A knows IP address of first hop router, R (how?) assume A knows MAC address of first hop router interface (how?) A 111.111.111.111 9-29-74C-E8-FF-55 R 222.222.222.220 1A-23-F9-CD-06-9B B 222.222.222.222 49-BD-D2-C7-56-2A 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F 11-5
Addressing: routing to another LAN walkthrough: send datagram from A to B via R. focus on addressing - at both IP (datagram) and MAC layer (frame) assume A knows B s IP address (how?) assume A knows IP address of first hop router, R (how?) assume A knows MAC address of first hop router interface (how?) A 111.111.111.111 9-29-74C-E8-FF-55 R 222.222.222.220 1A-23-F9-CD-06-9B B 222.222.222.222 49-BD-D2-C7-56-2A 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221-88B2-2F-54-1A-0F 12-5
Addressing: routing to another LAN walkthrough: send datagram from A to B via R. focus on addressing - at both IP (datagram) and MAC layer (frame) assume A knows B s IP address (how?) assume A knows IP address of first hop router, R (how?) assume A knows MAC address of first hop router interface (how?) A 111.111.111.111 9-29-74C-E8-FF-55 R 222.222.222.220 1A-23-F9-CD-06-9B B 222.222.222.222-49BD-D2-C7-56-2A 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221-88B2-2F-54-1A-0F 5-13
Addressing: routing to another LAN A creates IP datagram with IP source A, destination B A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram MAC src: 74-29-9C-E8-FF-55 IP dest: 222.222.222.222 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP Eth Phy A 111.111.111.111 9-29-74C-E8-FF-55 R 222.222.222.220 1A-23-F9-CD-06-9B B 222.222.222.222-49BD-D2-C7-56-2A 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221 88-B2-2F-54-1A-0F 14-5
Addressing: routing to another LAN frame sent from A to R frame received at R, datagram removed, passed up to IP IP Eth Phy A 111.111.111.111 9-29-74C-E8-FF-55 MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy R 222.222.222.220 1A-23-F9-CD-06-9B B 222.222.222.222-49BD-D2-C7-56-2A 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221-88B2-2F-54-1A-0F 15-5
Addressing: routing to another LAN R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram A 111.111.111.111 9-29-74C-E8-FF-55 IP Eth Phy R 222.222.222.220 1A-23-F9-CD-06-9B MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy B 222.222.222.222-49BD-D2-C7-56-2A 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221-88B2-2F-54-1A-0F 16-5
Addressing: routing to another LAN R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram A 111.111.111.111 9-29-74C-E8-FF-55 IP Eth Phy R 222.222.222.220 1A-23-F9-CD-06-9B MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy B 222.222.222.222-49BD-D2-C7-56-2A 111.111.111.112 CC-49-DE-D0-AB-7D 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.221-88B2-2F-54-1A-0F 17-5
Addressing: routing to another LAN R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy A 111.111.111.111 9-29-74C-E8-FF-55 111.111.111.112 CC-49-DE-D0-AB-7D R 111.111.111.110 E6-E9-00-17-BB-4B 222.222.222.220 1A-23-F9-CD-06-9B B 222.222.222.222-49BD-D2-C7-56-2A 222.222.222.221-88B2-2F-54-1A-0F 18-5
Link layer services framing, link access: encapsulate datagram into frame, adding header, trailer channel access if shared medium MAC addresses used in frame headers to identify source, destination different from IP address! reliable delivery between adjacent nodes we learned how to do this already (chapter 3)! seldom used on low bit-error link (fiber, some twisted pair) wireless links: high error rates Q: why both link-level and end-end reliability? 6-19
Link layer services (more) flow control: pacing between adjacent sending and receiving nodes error detection: errors caused by signal attenuation, noise. receiver detects presence of errors: signals sender for retransmission or drops frame error correction: receiver identifies and corrects bit error(s) without resorting to retransmission half-duplex and full-duplex with half duplex, nodes at both ends of link can transmit, but not at same time 6-20
Where is the link layer implemented? in each and every host link layer implemented in adaptor (aka network interface card NIC) or on a chip Ethernet card, 802.11 card; Ethernet chipset implements link, physical layer attaches into host s system buses combination of hardware, software, firmware application transport network link link physical cpu controller physical transmission memory host bus (e.g., PCI) network adapter card 6-21
Adaptors communicating datagram datagram controller controller sending host frame datagram receiving host sending side: receiving side encapsulates datagram in looks for errors, rdt, frame flow control, etc. adds error checking bits, rdt extracts datagram, passes (Real Data Transport), flow to upper layer at control, etc. receiving side 6-22
Adaptors Communicating sending node datagram frame link layer protocol frame rcving node adapter adapter link layer implemented in adaptor (aka NIC( Ethernet card, PCMCI card, 802.11 card sending side: encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc. receiving side looks for errors, rdt, flow control, etc extracts datagram, passes to rcving node adapter is semiautonomous link & physical layers 23
Link layer, LANs: outline 6.1 introduction, services 6.2 error detection, correction 6.3 multiple access protocols 6.4 LANs addressing, ARP Ethernet switches VLANS 6.5 link virtualization: MPLS 6.6 data center networking 6.7 a day in the life of a web request 6-24
What is Error? Error is a condition when the output information does not match with the input information. During transmission, digital signals suffer from noise that can introduce errors in the binary bits travelling from one system to other. That means a 0 bit may change to 1 or a 1 bit may change to 0. Data Link Layer 5-25
Error-Detecting code Whenever a message is transmitted, it may get scrambled by noise or data may get corrupted. To avoid this, we use error-detecting codes which are additional data added to a given digital message to help us detect if an error occurred during transmission of the message. A simple example of error-detecting code is parity check. Data Link Layer 5-26
How to Detect and Correct Errors? To detect and correct the errors, additional bits are added to the data bits at the time of transmission. The additional bits are called parity bits. They allow detection or correction of the errors. The data bits along with the parity bits form a code word. Data Link Layer 5-27
Parity Checking of Error Detection It is the simplest technique for detecting and correcting errors. The MSB of an 8-bits word is used as the parity bit and the remaining 7 bits are used as data or message bits. The parity of 8-bits transmitted word can be either even parity or odd parity. Even parity -- Even parity means the number of 1's in the given word including the parity bit should be even (2,4,6,...). Odd parity -- Odd parity means the number of 1's in the given word including the parity bit should be odd (1,3,5,...). Data Link Layer 5-28
How Does Error Detection Take Place? parity checking at the receiver can detect the presence of an error if the parity of the receiver signal is different from the expected parity. That means, if it is known that the parity of the transmitted signal is always going to be "even" and if the received signal has an odd parity, then the receiver can conclude that the received signal is not correct. If an error is detected, then the receiver will ignore the received byte and request for retransmission of the same byte to the transmitter. Data Link Layer 5-29
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 6-30
Parity checking single bit parity: detect single bit errors two-dimensional bit parity: detect and correct single bit errors 0 0 * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ 6-31
Internet checksum (review) goal: detect errors (e.g., flipped bits) in transmitted packet (note: used at transport layer only) sender: treat segment contents as sequence of 16-bit integers checksum: addition (1 s complement sum) of segment contents sender puts checksum value into UDP checksum field receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But maybe errors nonetheless? 6-32
Link layer, LANs: outline 6.1 introduction, services 6.2 error detection, correction 6.3 multiple access protocols 6.4 LANs addressing, ARP Ethernet switches VLANS 6.5 link virtualization: MPLS 6.6 data center networking 6.7 a day in the life of a web request 6-33
Multiple access links, 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) old-fashioned Ethernet upstream Hybrid fibre -coaxial (HFC) 802.11 wireless LAN shared wire (e.g., cabled Ethernet) shared RF (radio-frequency) (e.g., 802.11 WiFi) shared RF (satellite) humans at a cocktail party (shared air, acoustical) 6-34
When Multiple access protocols Required single shared broadcast channel two or more simultaneous transmissions by nodes: interference collision if node receives two or more signals at the same time examples, LANs, Wireless-LANs 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! no out-of-band channel for coordination 6-35
An ideal multiple access protocol given: broadcast channel of rate R bps desiderata/: 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 synchronization of clocks, slots 4. simple 6-36
MAC protocols: taxonomy 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 taking turns nodes take turns, but nodes with more to send can take longer turns 6-37
Channel partitioning MAC protocols: TDMA TDMA: time division multiple access access to channel in "rounds" each station gets fixed length slot (length = packet transmission time) in each round unused slots go idle example: 6-station LAN, 1,3,4 have packets to send, slots 2,5,6 idle 6-slot frame 6-slot frame 1 3 4 1 3 4 6-38
frequency bands Channel partitioning MAC protocols: FDMA 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 example: 6-station LAN, 1,3,4 have packet to send, frequency bands 2,5,6 idle FDM cable 6-39
Random access protocols when node has packet to send transmit at full channel data rate R. no a priori coordination among nodes two or more transmitting nodes collision, random access MAC protocol specifies: how to detect collisions how to recover from collisions (e.g., via delayed retransmissions) examples of random access MAC protocols: slotted ALOHA ALOHA CSMA, CSMA/CD, CSMA/CA 6-40