WK2.2_Data-Link Layer Part 1.pdf
Document Details
Uploaded by Deleted User
Tags
Full Transcript
Chapter 3 DATA-LINK LAYER PART 1 Course : ECE144 (Data Communications) Prepared by : Engr. Jess David A. Doria, MBA, CISSP, CC Contents ▪ Data-Link Control, which covers: o Framing o Error Control o Protocols Overview ▪ Although communication at the application, transport...
Chapter 3 DATA-LINK LAYER PART 1 Course : ECE144 (Data Communications) Prepared by : Engr. Jess David A. Doria, MBA, CISSP, CC Contents ▪ Data-Link Control, which covers: o Framing o Error Control o Protocols Overview ▪ Although communication at the application, transport, and network layers is end- to-end, communication at the data-link layer is node-to-node. ▪ To recall, a data unit from one point on the Internet needs to pass through many networks to reach another point. Theses LANs and WANs are connected by routers. ▪ It is customary to refer to the two end hosts and the routers as nodes and the networks in between as links. Link Types ▪ Although two nodes are physically connected by a transmission medium such as cable or air, the data-link layer controls how the medium is used. ▪ The data-link layer can utilize the whole capacity of the medium or only part of it. ▪ A point-to-point link dedicates the link to two devices, while a broadcast link shares the link among multiple device pairs. ▪ Traditional home phones use a point-to-point link, whereas cellular phones use a broadcast link, with the air shared among many users. Sublayers ▪ The data-link layer is divided into 2 sublayers: 1. The data-link control (DLC) sublayer addresses issues common to both point- to-point and broadcast links. This is common to both types of links. 2. The media access control (MAC) sublayer specifically handles issues related to broadcast links. This is used only is used only in the broadcast link. ▪ This division is common because LAN protocols also adopt a similar strategy. Chapter 3 : Data-Link Layer DATA-LINK CONTROL o FRAMING o ERROR CONTROL o PROTOCOLS Overview ▪ The data-link layer is packing bits into frames, so that each frame is distinguishable from another. Our postal system practices a type of framing. ▪ Framing in the data-link layer separates a message from one source to a destination by adding a sender address and a destination address. o The destination address defines where the packet is to go. o The sender address helps the recipient acknowledge the receipt. ▪ Dividing messages into smaller frames enhances efficiency in flow and error control compared to transmitting large, single-frame messages prone to retransmission for minor errors. ▪ Frames can be of fixed or variable size. Framing ▪ Fixed-size framing o There is no need to define the boundaries of the frames; the size itself can be used as a delimiter. o An example of this type of framing is the ATM WAN, which uses frames of fixed size called cells. ▪ Variable-size framing o Prevalent in local-area networks o It need a way to define the end of one frame and the beginning of the next. o Historically, two approaches have been used for this purpose: 1. Character-oriented approach 2. Cit-oriented approach. Variable Framing Character-oriented Framing ▪ In character-oriented approach, data to be carried are 8-bit characters from a coding system such as ASCII ▪ Frames begin and end with an 8-bit flag to delineate frame boundaries, ensuring clear separation. From the image below, a frame is composed of: 1. Header : carries the source and destination addresses and other control information, multiple of 8 bits. 2. Trailer : carries error detection redundant bits, are also multiples of 8 bits Variable Framing Character-oriented Framing ▪ This approach is popular when only text was exchanged by the data-link layers. ▪ Today, other types of information are being sent and any pattern used for the flag could also be part of the information. ▪ If this happens, the receiver, when it encounters this pattern in the middle of the data, thinks it has reached the end of the frame. ▪ To fix this problem, byte stuffing (or character stuffing) was added wherein a special byte is added to the data section of the frame when there is a character with the same pattern as the flag. ▪ The purpose of byte stuffing is to differentiate between the flag characters used for framing and those that may appear naturally in the data being transmitted. ▪ The data section is stuffed with an extra byte called the escape character (ESC). Variable Framing Character-oriented Framing ▪ The ESC has a predefined bit pattern and indicates that the following character is not a flag but actual data. ▪ When a character in the data matches the flag pattern, an ESC is inserted before it. ▪ When the data already has an ESC, it's distinguished from the framing ESC by adding another ESC before it. This double-escaping ensures the receiver reads the ESC as data, not a control signal. Variable Framing Character-oriented Framing ▪ Character-oriented protocols present another problem in data communications, which is the universal coding systems in use today, such as Unicode, have 16-bit and 32-bit characters that conflict with 8-bit characters. ▪ As such, the tendency is moving toward the bit-oriented protocols. Variable Framing Bit-oriented Framing ▪ In this approach, the data section of a frame is a sequence of bits to be interpreted by the upper layer as text, graphic, audio, video, and so on. ▪ In addition to headers (and possible trailers), a delimiter is still needed to separate one frame from the other. Most protocols use a special 8-bit pattern flag, 0 1 1 1 1 1 1 0, as the delimiter to define the beginning and end of the frame ▪ This flag can create the same type of problem we saw in the character-oriented protocols if the flag pattern appeared in the data. To avoid this, bit stuffing is introduced. Variable Framing Bit-oriented Framing ▪ In bit stuffing, if a 0 and five consecutive 1 bits are encountered, an extra 0 is added. This extra stuffed bit is eventually removed from the data by the receiver. ▪ Note that the extra bit is added after one 0 followed by five 1s regardless of the value of the next bit. This guarantees that the flag field sequence does not inadvertently appear in the frame. Chapter 3 : Data-Link Layer DATA-LINK CONTROL o FRAMING o ERROR CONTROL o PROTOCOLS Review (Review from ECE142) ▪ Error control is both error detection and error correction. ▪ It allows the receiver to inform the sender of any frames lost or damaged in transmission and coordinates the retransmission of those frames by the sender. ▪ In the data-link layer, the term error control refers primarily to methods of error detection and retransmission (error correction is done using retransmission of the corrupted frame). ▪ There are two types of error: 1. Single-bit error 2. Burst error Error Detection ▪ The process of monitoring the received data and determining when a transmission error has occurred. ▪ Error detection techniques do not identify which bit (or bits) is in error, only that an error has occurred. ▪ The purpose of error detection is not to prevent errors from occurring but to prevent undetected errors from occurring. ▪ Common techniques for error detection are: 1. Exact-code coding 2. Parity 3. Redundancy (Checksum, VRC, LRC, CRC) Error Correction ▪ Although detecting errors is an important aspect of data communications, determining what to do with data that contain errors is another consideration. ▪ Error correction is much more difficult than error detection because the receiver needs to find or guess the original codeword sent. ▪ Include sufficient extraneous information along with each message to enable the receiver to determine when an error has occurred, and which bit is in error ▪ Two primary methods used for error correction 1. Retransmission (discrete and continuous) 2. Forward error correction (Hamming code) Detection vs Correction Aspect Error Detection Error Correction Determine if an error has Goal Identify and fix the exact errors occurred (yes/no) Information Presence of an error Number and location of corrupted bits Needed Simple (just detect an Complexity Complex (determine and correct errors) error) Single-bit error is same as Requires knowing the exact number and Error Impact burst error location of errors Less affected by the Significantly affected by the number of Factors number of errors errors and size of message Combinatorial N/A Permutations of possible error locations Considerations Receiver's High, especially with larger messages and Low Difficulty multiple errors Chapter 3 : Data-Link Layer DATA-LINK CONTROL o FRAMING o ERROR CONTROL o PROTOCOLS Overview ▪ There are two (2) DLC protocols that implements the concepts on framing and error control. 1. High-Level Data-Link Control (HDLC) is the base of many protocols that have been designed for LANs. 2. Point-to-Point Protocol (PPP) is derived from HDLC and is used for point-to-point links. High-Level Data-Link Control (HDLC) ▪ HDLC is a bit-oriented protocol for communication over point-to-point and multipoint links. TRANSFER MODES ▪ HDLC provides two common transfer modes that can be used in different configurations: 1. Normal response mode (NRM) – the station configuration is unbalanced. The primary station sends commands, while the secondary can only respond. This is used for both point-to-point and multipoint links 2. Asynchronous balanced mode (ABM) – the configuration is balanced. The link is point-to-point, and each station can function as a primary and a secondary (acting as peers). This is the common mode today. HDLC Transfer Modes NRM ABM HDLC Frames ▪ To provide the flexibility necessary to support all the options possible in the modes and configurations just described, HDLC defines three types of frames: 1. Information Frames (I-frames) – used to transport user data and control information relating to user data (piggybacking) 2. Supervisory frames (S-frames) – are used only to transport control information when piggybacking is unavailable. 3. Unnumbered Frames (U-frames) – used to exchange session management and control information between connected devices. HDLC Frame Fields 1. Flag – contains synchronization pattern 01111110, which identifies both the beginning and the end of a frame. 2. Address – contains the address of the secondary station. It can be 1 byte or several bytes long, depending on the needs of the network. 3. Control – is 1 or 2 bytes used for flow and error control. 4. Information – contains the user’s data from the network layer or management information. Its length can vary from one network to another. 5. Frame Check Sequence (FCS) – the HDLC error-detection field. It can contain either a 2- or 4-byte CRC. HDLC Frame Fields - Control The control field determines the type of frame and defines its functionality. I-frames o The first bit (0) indicates it's an I-frame. o N(S) defines the sequence number o N(R) corresponds to acknowledgment when piggybacking. o P/F can indicate poll or final depending on sender-receiver roles. U-frames o U-frame codes are divided into two sections which creates 2 segments (5 bits) capable of creating 32 possible U-frames. ▪ 2-bit prefix code before the P/F bit ▪ 3-bit suffix code after the P/F bit. HDLC Frame Fields - Control S-frames o The first 2 bit (10) indicates it's an S-frame. o N(R) indicates acknowledgment or negative acknowledgment o Code used to define the type of S-frame itself Type Code Description Receive ready (RR) 00 Acknowledges safe receipt of frame Receive not ready (RNR) 10 Safe receipt and announces that receiver is busy and cannot receive any more frames (congestion control) Reject (REJ) 01 Frame is rejected Selective Reject (SREJ) 11 Receiver can either keep or delete the frame Point-to-Point Protocol ▪ PPP is one of the most common protocols for point-to-point access ▪ Users who want to access the Internet need to connect to their ISP via PPP and achieved with the use of a modem Services offered by PPP Services not offered by PPP o Defines frame format and negotiates o Lacks flow control and sophisticated link establishment and data exchange. error handling. o Supports payloads from various o Does not ensure frame sequencing or network layers and offers optional address multipoint configurations authentication. effectively. o A new version of PPP, called Multilink PPP allows connections over multiple links and provides network address configuration. PPP Framing ▪ PPP uses a character-oriented (or byte-oriented) frame. 1. Flag – a 1-byte flag with the bit pattern 01111110. 2. Address - a constant value and set to 11111111 (broadcast address) 3. Control – set to the constant value 00000011 (imitating U-frames in HDLC) 4. Protocol – defines what is being carried in the data field. Can either be 1 or 2 byte depending on agreement between parties 5. Payload - carries either the user data or other information (max is 1500 bytes) 6. FCS – a 2-byte or 4-byte standard CRC. PPP Byte Stuffing and Transition Phases BYTE STUFFING ▪ Because PPP is a byte-oriented protocol, the flag in PPP is a byte that needs to be escaped whenever it appears in the data section of the frame. ▪ The escape byte is 0 1 1 1 1 1 0 1, which means that every time the flaglike pattern appears in the data, this extra byte is stuffed to tell the receiver that the next byte is not a flag. TRANSITION PHASES ▪ A PPP connection goes through phases that can be shown in a transition phase diagram shown in the next slide. PPP Byte Stuffing and Transition Phases 1. Dead State: No active carrier, line is quiet. 2. Establish State: Connection starts, options are negotiated between nodes. 3. Authenticate State: If authentication is agreed upon; otherwise, it moves to the network state. 4. Open State: Data transfer occurs, with packets exchanged until termination. 5. Terminate State: Connection ends, system waits until the carrier signal is dropped, returning to the dead state. PPP Multiplexing ▪ Although PPP is a link-layer protocol, it uses another set of protocols to establish the link, authenticate the parties involved, and carry the network-layer data. ▪ Three sets of protocols are defined to make PPP powerful: the Link Control Protocol (LCP), two Authentication Protocols (APs), and several Network Control Protocols (NCPs). PPP Multiplexing 1. Link Control Protocol (LCP) o Establishes, maintains, configures, and terminates links. o Negotiates options between endpoints before establishing the link. 2. Authentication Protocol (AP) o Essential for verifying user identity over dial-up links. o Two protocols under AP are: Password Authentication Protocol (PAP) and Challenge Handshake Authentication Protocol (CHAP). 3. Network Control Protocols (NCPs) o PPP supports multiple network-layer protocols, each with its own NCP for configuration. One common NCP is the Internet Protocol Control Protocol (IPCP) configures links for IP data packets. o NCPs configure the link for network-layer data but do not carry the data themselves. PPP Multiplexing Password Authentication Protocol (PAP) o simple authentication procedure with a two- step process Challenge Handshake Authentication Protocol (CHAP) o a three-way handshaking authentication protocol that provides greater security than PAP. o password is kept secret; it is never sent online. PPP Multilink PPP ▪ Multilink PPP allows a logical PPP frame to be divided into several actual PPP frames, utilizing multiple channels in a single point-to-point link. ▪ From the image below, the protocol field is set to (003d)16 to indicate that an actual PPP frame carries a fragment of a logical frame. ▪ Sequence numbers are added to actual PPP frames to indicate the position of each fragment within the logical frame. FIN