Chapter 5: The Data Link Layer Chapter 5 Link Layer and LANs Our goals: � understand principles behind data link layer services: � error detection, correction � sharing a broadcast channel: multiple access � link layer addressing link layer addressing �������������������������������������� ����������������������������������������������������� ����!���������!��������"#� � reliable data transfer, flow control: done! Computer Networking: $����������%�&��%����������������� ������!�������!�������������������� ��� ���������������"����������� �������������������������#�$�������������� � instantiation and implementation of various link A Top Down Approach ������������ ��� ���&���������������#�'����������������!�&��������������� 5 th edition. �����&���� layer technologies � '�������������������������#�#!������ ����"��������������������������������!� Jim Kurose, Keith Ross ��������������������������� ������������!�&�������������������������������(" Addison!Wesley, April � '�����������������������������������������������������������&&&�����!������ ������������������������������������������������������ �����"�����������!����� 2009. ��������� �������������������������# $������������)��(��*+,-,�. ������������� ����������//0�122/ *#+�,����������,#�#�.���!�����.������.������� ����������������� ��� ����������������� ��1 Link Layer Link Layer: Introduction Some terminology: � 5.1 Introduction and � 5.6 Link!layer switches � hosts and routers are ����� services � communication channels that � 5.7 PPP connect adjacent nodes along � 5.2 Error detection � 5.8 Link virtualization: communication path are ����� and correction ATM, MPLS � wired links � 5.3Multiple access � 5.3Multiple access � wireless links � wireless links protocols � LANs � layer!2 packet is a ������ � 5.4 Link!layer encapsulates datagram Addressing � 5.5 Ethernet ��������������� has responsibility of transferring datagram from one node to adjacent node over a link ����������������� ��3 ����������������� ��4
Link layer: context Link Layer Services transportation analogy � datagram transferred by � framing, link access: � trip from Princeton to different link protocols Lausanne � encapsulate datagram into frame, adding header, trailer over different links: � limo: Princeton to JFK � channel access if shared medium � e.g., Ethernet on first link, � plane: JFK to Geneva � “MAC” addresses used in frame headers to identify frame relay on source, dest � train: Geneva to Lausanne intermediate links, 802.11 • different from IP address! • different from IP address! on last link on last link � tourist = datagram tourist = datagram � reliable delivery between adjacent nodes � each link protocol � transport segment = provides different communication link � we learned how to do this already (chapter 3)! services � seldom used on low bit!error link (fiber, some twisted � transportation mode = pair) � e.g., may or may not link layer protocol � wireless links: high error rates provide rdt over link � travel agent = routing • Q: why both link!level and end!end reliability? algorithm ����������������� ��� ����������������� ��0 Link Layer Services (more) Where is the link layer implemented? � in each and every host � flow control: � link layer implemented in � pacing between adjacent sending and receiving nodes “adaptor” (aka network �������������� � error detection : interface card NIC) ����� ����� � errors caused by signal attenuation, noise. ��������� � Ethernet card, PCMCI �� ������ ���&��� � receiver detects presence of errors: receiver detects presence of errors: ���� ���� card, 802.11 card card, 802.11 card • signals sender for retransmission or drops frame � implements link, physical ����� ���� layer � error correction: ��������� ����������� ���� � attaches into host’s ����� �� � receiver identifies and corrects bit error(s) without ����� �� system buses ������������ resorting to retransmission � combination of � half!duplex and full!duplex ��������������� hardware, software, ���� � with half duplex, nodes at both ends of link can transmit, firmware but not at same time ����������������� ��5 ����������������� ��6
Adaptors Communicating Link Layer � 5.1 Introduction and � 5.6 Link!layer switches �������� services �������� � 5.7 PPP � 5.2 Error detection ��������� ��������� � 5.8 Link Virtualization: and correction ATM. MPLS ������������ �������������� � 5.3Multiple access � 5.3Multiple access �������� protocols ����� � 5.4 Link!layer � sending side: � receiving side Addressing � encapsulates datagram in � looks for errors, rdt, flow � 5.5 Ethernet frame control, etc � adds error checking bits, � extracts datagram, passes rdt, flow control, etc. to upper layer at receiving side ����������������� ��/ ����������������� ���2 Error Detection Parity Checking EDC= Error Detection and Correction bits (redundancy) Two Dimensional Bit Parity � Single Bit Parity: 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 �����&��� � � ����������������� ���� ����������������� ���1
Internet checksum (review) Checksumming: Cyclic Redundancy Check � view data bits, D, as a binary number Goal: detect “errors” (e.g., flipped bits) in transmitted � choose r+1 bit pattern (generator), G packet (note: used at transport layer only ) � goal: choose r CRC bits, R, such that <D,R> exactly divisible by G (modulo 2) Receiver: � Sender: � receiver knows G, divides <D,R> by G. If non!zero remainder: � compute checksum of � treat segment contents error detected! received segment received segment as sequence of 16!bit as sequence of 16!bit � can detect all burst errors less than r+1 bits can detect all burst errors less than r+1 bits � check if computed checksum integers � widely used in practice (Ethernet, 802.11 WiFi, ATM) equals checksum field value: � checksum: addition (1’s � NO ! error detected complement sum) of segment contents � YES ! no error detected. But maybe errors � sender puts checksum nonetheless? value into UDP checksum field ����������������� ���3 ����������������� ���4 Link Layer CRC Example Want: � 5.1 Introduction and � 5.6 Link!layer switches D . 2 r XOR R = nG services � 5.7 PPP equivalently: � 5.2 Error detection � 5.8 Link Virtualization: D . 2 r = nG XOR R and correction ATM, MPLS equivalently: equivalently: � 5.3Multiple access � 5.3Multiple access if we divide D . 2 r by protocols G, want remainder R � 5.4 Link!layer Addressing � 5.5 Ethernet D . 2 r R = remainder[ ] G ����������������� ���� ����������������� ���0
Recommend
More recommend