Link Layer and Ethernet

Save this PDF as:

Size: px
Start display at page:

Download "Link Layer and Ethernet"


1 Link Layer and Ethernet : Fundamentals of Computer Networks Bill Nace Material from Computer Networking: A Top Down Approach, 6 th edition. J.F. Kurose and K.W. Ross

2 traceroute Data Link Layer Multiple (Media / Medium) Access Protocols Ethernet 2

3 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

4 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

5 Context A packet is transferred by different link protocols over different links e.g., Ethernet on first link, frame relay on intermediate links, 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

6 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

7 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

8 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

9 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

10 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

11 traceroute Data Link Layer Multiple (Media / Medium) Access Protocols Ethernet 11

12 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 wireless LAN 12

13 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

14 MAC Protocols: A Taxonomy Channel Partitioning Taking Turns Random Access 14

15 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

16 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: 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 (token-ring) 16

17 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

18 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

19 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

20 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

21 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

22 Space-Time Diagrams Illustrate propagation delay of message through the channel Message transmission time Time Space

23 Multiple Transmitters Time Signals mix, collision detected!

24 Detecting Collisions Time Min transmission time must be long enough for collisions to propagate

25 traceroute Data Link Layer Multiple (Media / Medium) Access Protocols Ethernet 25

26 History Developed at Xerox PARC, ish By Robert Metcalfe, David Boggs, Chuck Thacker and Butler Lampson Metcalfe founded 3Com and popularized Quickly became the dominant LAN technology Standardized as IEEE Originally 3Mbps, now up to 100Gbps 400Gbps expected

27 Ethernet Services Connectionless No handshaking Unreliable Damaged frames are discarded No ACK or NACK generated by receiver In-order delivery 27

28 Topology Bus Topology: shared cable 28

29 Topology (2) Star Topology!!!!!! High-Speed backplane or interconnection fabric!!!! 29

30 Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type Preamble: 8 bytes 7 bytes with pattern followed by one byte with pattern used to synchronize receiver, sender clock rates 30

31 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

32 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

33 Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type Data: bytes Encapsulated datagram Short datagrams padded to 46 bytes IP receiver discards based on datagram length field in IP header 33

34 Ethernet Frame Preamble Dest Addr Source Addr Data CRC Type CRC: 4 bytes Error Checking Receiver will check simply discard frame on error 34

35 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

36 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

37 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

38 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

39 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}... { } wait 512 K bit times before going back to step number 2 (carrier sense) After 16 collisions, give up 39

40 Question #1 For 10Mbps Ethernet, what is the maximum wait time after a collision? 40

41 Question #2 A and B are on a 10 Mbps segment. What is the max separation to still guarantee collision detection? 41

42 Min Length Frame Jam Signal

43 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? 43

44 Answer Time Event at A Event at B t = 0 Start sending Start Sending t = 200 B s message arrives, collision A s message arrives, collision t = 201 Send Jam signal Send Jam signal t = 248 Stop sending Jam Stop sending Jam wait 0 *512 bit times wait 1 * 512 bit times (until 760) t = 249 Still hearing B s message Still hearing A s message t = 400 Stop hearing B s message Stop hearing A s message t = 401 Start hearing B s Jam Start hearing A s Jam t = 448 Stop hearing B s Jam Stop hearing A s Jam t = 449 Listen for 96 bit times t = 545 Start sending t = 745 Start hearing A s Message

45 Answer Time Event at A Event at B t = 760 stop waiting Channel not idle t = Frame sent has 1518+preamble = 1526 bytes = bits. Message has now been transmitted t = Stop hearing A s message Still listening for idle channel t = Channel has been idle for 96 bit times Start Sending

46 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 46

47 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