Physical and Data Link layers Youki Kadobayashi Graduate School of Science Nara Institute of Science and Technology Physical Layer All rights reserved. 2
Types of transmission medium! Cables Optical fiber Copper Source: siemon.com! Wireless Source: blackbox.com All rights reserved. Cables and connectors! Copper UTP STP! Connectors RJ45 RJ11 Source: aisan! Optical fibers Source: aisan Single mode fiber Multimode fiber! Connectors LC, SC, FC, MT-RJ RJ45 connector. Source: flukenetworks.com Source: aisan.co.jp All rights reserved.
Cable speed, distance and cost Speed Medium Distance Cost 10Gbit/s Optical (SMF) 10 km $$$ 10Gbit/s Copper 10 m $$ 1Gbit/s Optical (MMF) 550 m $$ 1Gbit/s Copper 100 m $ 1Mbit/s Copper 4 km $ Source: cable360.net All rights reserved. Physical characteristics: a crude comparison Copper Fiber Wireless Attenuation XX XXXX Attenuation distortion X X XX Noise XX X XXXX Bend XX Chromatic dispersion X XXXX Crosstalk XX XXXX EM interference XX XXXX Echo XX XXXX! 54Mbit/s in wireless cannot be delivered as advertised, whereas 1Gbit/s in optical fiber can be delivered as advertised. All rights reserved.
Basics of protocol All rights reserved. 7 Computer and network! Computer! Network interface! Protocol start bit pattern end bit pattern All rights reserved.
Fundamental aspect of network: Protocol! 3 major elements of protocol Finite State Machine Message Timer a α b δ ε β c γ d All rights reserved. Basic constructs of protocol! Main goal Transmission, recovery from errors! Message Header, trailer Error detection Sequence number Acknowledgement! State machine Negotiation Retransmission Error recovery! Timer Timeout Sequence number Header Acknowledgement Data Error detection Trailer All rights reserved.
Data Link Layer All rights reserved. 11 Data Link Layer Services overview! 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! Flow Control: Pacing between adjacent sending and receiving nodes! Error Detection: Errors caused by signal attenuation and noise Receiver detects presence of errors! 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 All rights reserved. 12
Frame! Data link layer Protocol Data Unit (PDU) Defining the frame borders (delimiters)! Can determine if any failures (bit errors) occured Adding error-detection / error-correction code to bit sequences in order to delimit the appropriate frame length! Frame header error detection and flow control control information 01111110 address control data checksum 01111110 header payload All rights reserved. 13 Frame Synchronization! Bit-sequence-based frame synchronization A special bit sequence is inserted to the data header and footer. synchronization Insertion of a bit sequence composed of the same bit e.g. bit stuffing special bit sequence only appears at the frame header and footer special bit sequence 01111110 if sender detects 11111 in data, it stuffs a 0 right after. if receiver detects 11111 in data, it deletes the following stuffed 0. 01111110 address control data checksum 01111110 All rights reserved. 14
Errors in Physical Layer Noise Attenuation Distortion All rights reserved. 15 Error Control! Goal Detecting and correcting transmission error in channel Was the frame correctly sent? Was the frame sequence order correct?! Techniques Introducing the concept of frame (failure localization) Coding techniques Error Correction Code Error Detection Code Parity, CRC (Cyclic redundancy check) Protocol techniques Timer Retransmission All rights reserved. 16
Basic idea of CRC! Given: ( m Generator polynomial G(x), of degree r (r < Polynomial expression of m bit frame M(x) (degree m-1)! Compute: prepare x r M(x): frame with r zeros Compute modulo of x r M(x) divided by G(x): R(x) Frame for transmission: F(x) F(x) = x r M(x) + R(x)! Successul transmission: F(x) / G(x) = 0 Nonzero otherwise. i.e., error detection. Consecutive errors less than r bits can be detected All rights reserved. 17 Standardized CRC polynomials! Commonly known standards CRC-12 x 12 +x 11 +x 3 +x 2 +x+1 CRC-16 x 16 +x 15 +x 2 +1 CRC-32 x 32 26 23 22 16 12 11 10 8 7 5 4 2 CRC-CCITT x 16 +x 12 +x 5 +1! There are many other error detection codes. All rights reserved. 18
Questions? All rights reserved. 19 Flow Control! Flow Control Protocols deal with how to send sequences of frames! They have two goals: Recover from lost frames Prevent buffer overflows! Network Layer may want to receive same set of frames in the same order they were sent! Automatic Repeat Request (ARQ) Stop-and-wait Go-back-N Selective-repeat All rights reserved. 20
Stop-and-wait ARQ (1) Sender t 1 t 5 t 4 t 1 t 2 t 3 Receiver t 1 : Round Trip Time t 2 : Frame Transmission Time t 3 : Frame Processing Time t 4 : ACK Transmission Time t 5 : ACK Processing Time All rights reserved. 21 Stop-and-wait ARQ (2)! Procedure Waiting to receive ACK on each frame transmission Setting a sender timer greater than 2t 1 +t 2 +t 3 +t 4 Retransmission when sender timer times out.! Characteristics Simple The buffer never contains more than one frame for the receiver and the sender Very low utilization of channel capacity All rights reserved. 22
Go-back-N ARQ Time out for Frame3 1 2 3 4 5 3 4 5 6!! 1 2 4 5 3 4 5 6 All rights reserved. 23 Selective-Repeat ARQ Time out for Frame3 1 2 3 4 5 3 6 7 8!! 1 2 4 5 3 6 7 8 All rights reserved. 24
ARQ: simplicity vs efficiency, adaptability! Stop-and-Wait Simple No large buffer required in both ends! Go-back-N Still simple, but buffer management has to be done at SENDER. N means the buffer size There is no large buffer required at RECEIVER side.! Selected Repeat Complicated scheme that requires buffer, timer, and ACK managements. Buffers are required in both ends. Window Flow Control is needed for buffer management. All rights reserved. 25 Window Flow Control for selective-repeat ARQ Sender keep frame until ACK is received sent frame sendable frame maximum size W) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 already received ACK last sent frame if sent move to right If ACK is received move to right Receiver received frame receivable frame maximum size W) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 already transmitted ACK if received if ACK is sent last received frame move Youki to Kadobayashi. right All rights move reserved. to right 26
Burden sharing among layers! Assignment of function depends on communication system designs! Various solutions exist Transport Network Data Link sequence assurance flow control retransmission interconnection of network error detection and correction frame boundary All rights reserved. 27 Questions? All rights reserved. 28
Sublayers of the Data Link Layer Network Layer ISO/OSI Local Area Network Definitions (8802) CCITT Data link Layer Definition Data link Layer Logical Link Control Sublayer Media Access Control Sublayer 8802/2 LLC 8802/3 CSMA/CD 8802/4 Token Bus 8802/5 Token Ring CCITT X.25 (HDLC/LAPB) Physical Layer All rights reserved. 29 Media Access Control (MAC) (1) Data link layer provides packet send/ receive service to network layer Physical Layer provides binary send/receive to data link layer Different media have different constraints about multiple nodes accessing the medium All rights reserved. 30
Media Access Control (MAC) (2) MAC layer provides medium access service to the data link layer A separate protocol is needed to implement the service for each different transmission medium Subsequent slides: learn about channel allocation (multiplexing) All rights reserved. 31 Access Channel! Two types of links : Point-to-point PPP for dial-up access Point-to-point link between Ethernet switch and host Broadcast (shared wire or medium) Traditional Ethernet 802.11 wireless LAN All rights reserved. 32
MAC Protocols (1)! Single shared broadcast channel Two or more simultaneous transmissions can interfere with each other Collision will be observed whenever node receives two or more signals at the same time! Ideal Media Access Protocol When one node wants to transmit, it can send at rate R When M nodes want to transmit, each can send at average rate R/M Fully decentralized: No special node to coordinate transmissions No synchronization of clocks, slots Simple All rights reserved. 33 MAC Protocols (2) Three techniques:! 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 Nodes with more to send can take longer turns All rights reserved. 34
Controlled or Contention?! Controlled assignment of partitioned channel is for higher efficient channel occupying (high throughput) TDMA (time), FDMA (frequency), WDM (wave length) Code Divided Multiple Access (CDMA)! Contention type (random access) has its long history, but CSMA/CD with binary back-off is the final answer. Pure ALOHA, Slotted ALOHA classic & primitive form of random access CSMA, CSMA/CD, CSMA/CD with binary back-off (Ethernet) More complicated form for avoiding unnecessary collisions. Carrier Sense is pre-action, Collision Detection is post-action. CSMA/CA (Collision Avoidance) More aggressive way to manage channels, WiFi. All rights reserved. 35 MAC Throughput Performance All rights reserved. 36
Questions? All rights reserved. 37 Evolution of data link technologies! Wide bandwidth! Large scale! Switched media! Bridges! Virtualization! VLAN! Coverage expansion! Broadband wireless, residential access, etc. All rights reserved. 38
LAN performance secrets: shared media switched media! High-bandwidth and commodity LAN! Effectively a channel partitioning scheme medium access Non-blocking crossbar switch All rights reserved. 39 Wireless LAN performance secrets! Wireless LAN performance will lag behind forever! Wireless LAN remains to be shared media Significantly slower, error prone crowded cocktail party -- Don t expect same performance Shared media Wireless LAN Voice Video (MPEG2) Video (MotionJPEG) Switched media Ethernet Voice Video (MPEG2) Video (MotionJPEG) Video (D1) Video (HD D1) 1996 1998 2000 2002 2004 2006 All rights reserved. 40
Large scale Bridges! Compatibility between physical limitations and LAN convenience Coverage, capacity Wiring in floor coax 100m Wiring between buildings optical fiber 5km All rights reserved. 41 Bridge basics: Transparent bridge! Host is not aware of the bridge! Transparent bridge No modification of MAC frame Promiscuous: capture all flowing packets Administrator builds the bridge forwarding table Transparent bridge 1 2 Fwd to 1 Fwd to 2 A, B, C, D E, F, G, H All rights reserved. 42
Learning Bridge! Dynamic adaptation for topology changes & traffic loop avoidance. Frame forwarding tables in bridges are maintained for optimizing the flow: Any frame to unknown MAC addresses is forwarded, and the table is updated for unknown MAC. Any frame to known MAC addresses is forwarded if necessary. Spanning Tree Protocol (STP) is now very common for 802.3 families to avoid traffic loop. Exchanging data between bridges to form a singe spanning tree as their forwarding route. Today: improved protocol called RSTP (Rapid STP). All rights reserved. 43 Questions? All rights reserved. 44
Summary! Basic ideas of Data Link Layer! Many simple but effective scheme to obtain good performance Error control, flow control Media access control (MAC) Switched media & learning bridge Ethernet families All rights reserved. 45 Assignment III
1. Given: a. Message: Aloha (without the apostrophe) (www.asciitable.com) b. Generator polynomial : 1+X+X 3 +X 4 +X 8 Show how CRC-8 works on sender and receiver side 1. Do you think the CRC method is foolproof? Please elaborate. 2. On selecting the best generator polynomial, what is your recommendation? Guidelines for submitting the assignments Deadline: 5/8 (Fri) 23:59 File Naming: Name_StudentID Preferred File Format: PDF Length: at most 2 pages Language: English/Japanese Send to: network1-2015@is.naist.jp
I 1. : Aloha ( ) (www.asciitable.com) : 1+X+X 3 +X 4 +X 8 CRC-8 2. CRC 3. : 5/8 ( ) 23:59 : _ ID : PDF : 2 : / : network1-2015@is.naist.jp