Link Layer and Ethernet 14-740: Fundamentals of Computer Networks Bill Nace Material from Computer Networking: A Top Down Approach, 6 th edition. J.F. Kurose and K.W. Ross
traceroute Data Link Layer Multiple (Media / Medium) Access Protocols Ethernet 2
Data Link Layer Mission The Data Link Layer transfers frames from one node, over a link, to an adjacent node i.e. service provided to network layer Service received from physical layer is the ability to move a bit across the link 3
Data Link Layer Link layer data is called a frame and will encapsulate a network layer datagram Link: Communication channel that connects adjacent nodes (host or router) Point-to-Point Broadcast Router has multiple link layers (one per interface) Each link is a subnet Local ISP Regional ISP Company Network
Context A packet is 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 data link protocol provides different services e.g., may or may not provide reliable data transfer over link Local ISP Regional ISP Company Network
Link Layer Services Framing: encapsulate datagram into frame, adding header, trailer identify source, destination with addresses Different from IP addresses!! Link access: use medium access control (MAC) protocol Point-to-point channels: this is trivial Broadcast channels: more interesting 6
Link Layer Services (2) Error Detection: errors caused by signal attenuation, noise, crosstalk, etc if receiver detects errors, signals for retransmission or drops frame Error Correction: receiver identifies and corrects bit error(s) without resorting to retransmission 7
Link Layer Services (3) Reliable Delivery: between adjacent nodes similar to Reliable Data Transport seldom used on low bit-error links (fiber, twisted pair) critical for wireless links high error rates 8
MTU Remember Max Transmission Unit? A value derived from the technology of the data-link layer The largest number of bytes carried in the payload of a frame Does not include the link-layer header or trailer 9
Various Link Layers FDDI: Fiber Distributed Data Interface Frame size: up to 4514 bytes Frame Relay Frame size: 46 to 4470 bytes ATM: Asynchronous Transfer Mode Frame size: always 53 bytes 10
traceroute Data Link Layer Multiple (Media / Medium) Access Protocols Ethernet 11
Two Types of Links Point-to-point (sender to receiver) point-to-point link between Ethernet switch and host Point-to-Point Protocol (PPP) used to negotiate, establish, authenticate, etc Broadcast (shared wire or medium) traditional Ethernet 802.11 wireless LAN 12
Medium Access Control Protocols For a single shared broadcast channel Simultaneous transmissions by 2 or more nodes interference collision if node receives two or more signals at the same time Multiple access protocol: a distributed algorithm that determines how nodes share channel communication about channel sharing must use channel itself! 13
MAC Protocols: A Taxonomy Channel Partitioning Taking Turns Random Access 14
Channel Partitioning Divide the channel into pieces time slots, frequency, or code Let each node use a piece of the channel Each node gets R/N bps, where R is channel throughput, N is # of nodes BUT: If < N nodes want to send, they still only get R/N bps 15
Taking Turns Taking Turns Like a time slot partition scheme... but, nodes with more to send can take longer turns Polling Protocol Master node asks each node in turn to send Examples: 802.15 and Bluetooth Token-passing Special-purpose frame is passed in fixed order from node to node (pattern repeats indefinitely) Only the node with the token may send Examples: FDDI and 802.5 (token-ring) 16
Random Access Transmitting node always sends at R bps Multiple nodes can send simultaneously Collision Collisions can be avoided or detected Avoided: Wireless, LocalTalk Detected: CSMA/CD Protocols 17
CSMA / CD Carrier Sense: Listen before talking Multiple Access: Broadcast Medium Collision Detection: Listen as you talk. If you hear someone else, be quiet Ethernet is the most famous example 18
CSMA / CD Overview Before transmitting, listen If channel is sensed idle, send the frame Else, defer transmission a random time If collision is detected, abort transmission reduces channel wastage 19
Collision Detection Easy in wired LANs Measure signal strengths, compare the transmitted and received signals Difficult in wireless LANs Receiver is shut off during transmission Hidden terminal problem You may not hear transmission from someone out of your range, but others will 20
Capturing a Channel Transmission is vulnerable for 1 propagation delay collision could occur If no other station initiates transmission during this period, sender has captured the channel No other node will initiate send Node transmits at t=0 Node captures channel at t=tprop
Space-Time Diagrams Illustrate propagation delay of message through the channel Message transmission time Time Space
Multiple Transmitters Time Signals mix, collision detected!
Detecting Collisions Time Min transmission time must be long enough for collisions to propagate
traceroute Data Link Layer Multiple (Media / Medium) Access Protocols Ethernet 25
History Developed at Xerox PARC, 1974-5ish By Robert Metcalfe, David Boggs, Chuck Thacker and Butler Lampson Metcalfe founded 3Com and popularized Quickly became the dominant LAN technology Standardized as IEEE 802.3 Originally 3Mbps, now up to 100Gbps 400Gbps expected 2017 26
Ethernet Services Connectionless No handshaking Unreliable Damaged frames are discarded No ACK or NACK generated by receiver In-order delivery 27
Topology Bus Topology: shared cable 28
Topology (2) Star Topology!!!!!! High-Speed backplane or interconnection fabric!!!! 29
Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type Preamble: 8 bytes 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 used to synchronize receiver, sender clock rates 30
Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type Dest, Source Addresses: 6 bytes each Flat address space, globally unique 3 bytes indicate adapter manufacturer 3 bytes generated uniquely Watch out: Can be changed/spoofed Broadcast address exists 31
Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type Type: 2 bytes Indicates the network-layer protocol Mostly IP, ARP Others include Novell IXP, AppleTalk 32
Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type Data: 46-1500 bytes Encapsulated datagram Short datagrams padded to 46 bytes IP receiver discards based on datagram length field in IP header 33
Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type CRC: 4 bytes Error Checking Receiver will check simply discard frame on error 34
Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type Total Frame Min size: 64 bytes + preamble = 72 bytes Long enough to guarantee collision detection in max length cable (100m) Max size: 1518 bytes + preamble Short enough to minimize wait times, receiver buffer requirements 35
Tx Algorithm 1. Ethernet adapter receives datagram from network-layer and builds frame Source address is MAC of sending adapter Destination address chosen based on IP address Address Resolution Protocol (ARP) Generates CRC often via H/W as frame is sent 36
Alg: Carrier Sense 2.Adapter listens for 96 bit times of idle channel Bit time is.1usec for 10Mbps Ethernet Variants exist for 1Mbps - 10Gbps If channel is idle, then transmit the frame If not idle, wait for it to be idle for 96 bit times 37
Alg: Collision Detection 3.While transmitting, listen and compare to sending values If no difference, great If collision, abort and send jam signal 48 bit times long Inform other transmitters of collision 38
Alg: Exponential Backoff 4. If collision happens, wait a random time before attempting transmission again For n th collision in a row, m=min{n,10} choose random value K from {0..2 m -1} {0,1} then {0,1,2,3}... {0..1023} wait 512 K bit times before going back to step number 2 (carrier sense) After 16 collisions, give up 39
Question #1 For 10Mbps Ethernet, what is the maximum wait time after a collision? 40
Question #2 A and B are on a 10 Mbps segment. What is the max separation to still guarantee collision detection? 41
Question #3 At t=0, A and B (who are separated by 200 bit times) each try to transmit a frame with 1500 bytes of data. A collision occurs, after which Ka = 0 and Kb = 1. At what time will B start retransmitting the frame? 42
Lesson Objectives Now, you should be able to: describe the mission, scope, addressing mechanism, data types and services / responsibilities of the Data Link Layer describe the differences between broadcast and point-to-point links describe three different general types of media access protocols 43
You should be able to: describe the CSMA/CD protocol, including the details of Ethernet's implementation use space-time diagrams to describe or solve problems relating to media access, including details of Ethernet's implementation describe the Ethernet frame format solve problems involving interaction of several Ethernet senders and receivers, collisions, propagation times, and the details of Ethernet's CSMA/CD algorithm