the data link layer

Ace your homework & exams now with Quizwiz!

Binary Synchronous Communications (BSC or BiSync)

Bisync is an old protocol developed by IBM and standardised by ISO. It is a connection-oriented half-duplex, asymmetric, synchronous, characteroriented, byte-stuffed protocol, using the Data Link Escape (DLE) character for data transparency. It uses a polling access method and it can operate in point-to-point or point-to-multipoint line configurations. It uses two or more ASCII Synchronisation characters (SYN) to synchronise the receiver for the start of a frame, followed by an optional ASCII Start of Header character (SOH) to indicate the start of a frame header, Start of Text (STX) for the start of the data field and End of Text (ETX) for the end of the data field with an optional one or two character Block Check Count (BCC) to provide error detection using the LRC technique. It uses Idle RQ (Stop and Wait) error control. Below are examples of typical BSC frames: SYN SYN STX <Data> ETX SYN SYN SOH <Header> STX <Data> ETX <Block Check Count> Bisync was mainly used in star-topology mainframe networks, but has now been largely replaced by modern bit-oriented protocols, such as HDLC.

Bit stuffing

Bit stuffing is somewhat similar. Whenever there are five consecutive ones, a single bit (0) is stuffed in the data so that 111110 is sent. The receiver when it receives five consecutives ones followed by a 0 will un-stuff the zero bit and read it as 111111.

Bit-oriented synchronous

Bit-oriented synchronous data link layer protocols, such as High-level Data Link Control (HDLC), have tended to replace the older character-oriented data link protocols such as BSC. They are much more sophisticated and efficient as they can support superior flow control and error recovery mechanisms.

Byte stuffing

Byte stuffing requires using a special Data Link Escape (DLE) character that is stuffed into the frame to indicate that the following character is data. It therefore should not have its normal meaning as a special character such as one that indicates the end of text. If the data includes a DLE, this is also stuffed with another DLE. When a frame is received, any DLEs are unstuffed and the data is passed to the layer above.

Cyclical Redundancy Checks

CRCs offer a more sophisticated and powerful error detection technique. The bits of the data to be checked are treated as a very large number which is divided (modulo two2) by a special number, known as a generator. In modulo 2 arithmetic, all additions and subtractions are replaced by the ⊕ (XOR) operation. As an example of modulo 2 multiplication, we will multiply 1011 by 101 using ⊕ instead of + to add the two partial multiplications

Channelised Acces

Channelised Access is a method whereby the available bandwidth of the media is shared between different stations by allocating a channel to each transmitter. There are three ways that this can be achieved: • Frequency Division Multiple Access (FDMA)11 - where each transmitter is allocated a different frequency range on the medium in which to transmit. It uses Frequency Division Multiplexing at the physical layer. • Time Division Multiple Access (TDMA)12 - where each transmitter is allocated different time slots on the medium in which to transmit. It uses Time Division Multiplexing at the physical layer. • Code Division Multiple Access (CDMA)13 - is a new technology, based on coding theory, which differs from FDMA in that the media only supports one broad channel and from TDMA in that stations do not have to use different timeslots. Each transmitter is allocated a unique, carefully selected code (or chipping sequence), and they can remarkably actually transmit simultaneously and only interfere with each other minimally. It is a bit like holding conversations at a very noisy party. The details of how CDMA works

Link Control

Connection-oriented data link protocols have to support frame types other than the information frames that carry data. Additional frames types are required for control purposes. These frames are usually called supervisory frames if they contain sequence numbers and unnumbered frames if they do not. The supervisory frames support positive and negative acknowledgements for flow and error control. The unnumbered frames perform functions such as setting up, resetting and disconnecting the data link. Connectionless data link protocols only require unnumbered information frames. The data link layer protocols used on LANs are defined in two sub-layers. The upper sub-layer is the Logical Link Control (LLC) sub-layer and is common to all types of LAN

Flow control

Connectionless data link layer protocols do not support any flow control. If the receiver cannot keep pace with the transmitter, then frames will be discarded and higher level protocols will be required to recover the lost data. Connection-oriented data link layer protocols will usually provide mechanisms to control the flow of data. There are a number of ways in which flow control can be achieved: • X-on/X-off. This mechanism is only used with asynchronous transmission. Whenever a receiver wants to stop a transmitter, it sends the ASCII DC3 character (Ctrl-S) and when it wants to restart the transmitter it sends the ASCII DC1 character (Ctrl-Q). • Stop and wait. Each frame must be positively acknowledged by the receiver before another frame can be transmitted. • Sliding window. This mechanism allows a transmitter to send a number of frames up to a maximum (called the window size) without any frames being acknowledged. At this point the transmitter has to stop transmitting and wait for some earlier frames to be acknowledged. Once some acknowledgements have been received the transmitter can start sending again, but must stop again as soon as the number of unacknowledged frames reaches the window size. The sliding window mechanism relies on a sequence number field in the data link layer protocol header, so that the receiver can indicate which frames are being acknowledged.

Ordered delivery

Connectionless data link layer protocols will make a best effort to deliver data in the order that it was transmitted, but should an error be detected and a frame discarded, the higher level protocols will be expected to retransmit the data and to reorder it, if necessary. With connection-oriented protocols, the data link layer itself will guarantee ordered delivery and will, if necessary, buffer new data while it is waiting for previous data to be retransmitted, so that it will always pass the data in the correct order to the network layer. Ordered delivery is achieved through the use of sequence numbers in the data link layer protocol headers.

Error detection

Error detection can be achieved by transmitting redundant information along with the data, so that it can be checked for errors:

example of transparency

For example, if the data link layer wants to transmit 01111110 as transparent data, which could be confused with a flag, it will stuff a zero after the five consecutive ones and send 011111010. The receiver will not interpret this as a flag, but will un-stuff the extra 0 to reproduce the original bit sequence 01111110.

types of framing

Framing can be character-oriented or bit-oriented. Character-oriented data link protocols transmit data as a sequence of 8-bit characters. Protocol header fields are also often made up of individual characters from the ASCII character set and the data carried must be in multiples of 8 bits. Bit-oriented data link protocols have protocol headers that can code information in binary rather than ASCII formats. For instance, a numeric field which always contains a number less than 8 could be coded as a 3-bit binary number. Data carried can, in theory, not be in multiples of 8 bits, but in practice this would be unusu

High-level Data Link Control (HDLC)

HDLC was developed by ISO but was based largely on an IBM bit-oriented protocol called SDLC. It is a connection-oriented full-duplex, synchronous, bit-oriented, bit-stuffed protocol, using a polling access method. It uses CRC error detection and can support both Go Back N and Selective Repeat error control. It is a complex protocol with many implementation options. HDLC uses an 8-bit flag (01111110) for synchronisation purposes at the start and end of each frame. HDLC has two classes of operation

classification

In each of these types there can be a problem if two stations are able to transmit at the same time. This can obviously happen with broadcast and point-to-multipoint media but it can also happen with a point-to-point medium, if it is configured in half-duplex mode. It is the responsibility of the data link layer to either prevent stations from transmitting at the same time or else to resolve the contention for the medium should it occur. There are three main types of medium access control methods that the data link layer can employ. This classification is taken from Forouzan.7 • Random Access is where any station can transmit at any time and the data link protocol subsequently resolves any contention. • Controlled Access is where the data link protocol provides an authorisation to transmit. • Chanelised Access is where the data link protocol allocates a separate channel to each transmitting device.

Error correction

In the early days of data communications, when low-speed asynchronous duplex data links were used between terminals and host computers, a crude error detection technique called echoplexing was used. Characters were typed at a terminal and were echoed back by the host. It was the echoed character and not the sent character that was displayed to the user. In conjunction with echoplexing, VRC checks were also used and any character that failed a VRC check was displayed as a block. By this means users were able to see errors and re-enter the data. This echoplexing technique is still sometimes in use today. Many Telnet applications echo back characters to users, often with packets containing single characters. There are two main error correction techniques used by modern data link protocols: • Automatic Repeat Request (ARQ) • Forward Error Correction (FEC). With Automatic Repeat Request (ARQ), the receiver issues a Negative Acknowledgement (NAK) or refrains from issuing a Positive Acknowledgement (ACK) when an error is detected, thus expecting the transmitter to retransmit the frame (possibly after a timeout has expired) and maybe other frames also. The number of frames that will need to be transmitted after an error depends on the precise error correction mechanism employed. The mechanisms used by data link protocols are: • Idle RQ sometimes also called Stop and Wait, where the sender waits for a positive acknowledgment before it can send another frame. • Continuous RQ which uses the same sliding window technique discussed under flow control to allowing a fixed number4 of frames to be unacknowledged at any one time. With Continuous RQ there are two possible mechanisms that can betransmitter then has to retransmit the frame that was in error and all subsequent frames. • Selective Repeat where on detection of an error, the receiver issues a Reject (REJ) frame, but keeps all the subsequent frames in buffer. The transmitter only retransmits the frame that was in error.

Longitudinal Redundancy Checks.

LRCs are used in conjunction with VRCs to provide a more sophisticated check on a block of data. This is done by treating the block as a two-dimensional array of bits, with each byte transmitted represented by a column in the array, the last bit in each column being a VRC for the column. A parity check (called an LRC) is then carried out for each row in the array, including the VRC row, and a new LRC column is added to the block. The block is then transmitted one byte at a time followed by the LRC byte. On receipt of the block, the data link layer will check all the VRC and LRC bits. If any of these bits does not check then the frame has been damaged during transmission. LRCs on a block of n bytes will be able to detect burst errors of up to n bits long. There are however combinations of errors that LRCs will not be able to detect, such as when single bit errors occur in the same positions of two columns or two rows. LRCs nonetheless provide a powerful error detection mechanism. Table 7.2 shows an example of an even parity LRC check on a 11-byte block. There is one VRC parity error and one LRC parity error. These are underlined and they can be used to pinpoint and correct an error (if it is a single bit error), as well as detect most multiple errors.

Modern Data Communication

Modern Data Communications mainly uses synchronous transmission, as it is much more efficient and can support sophisticated error control techniques. Asynchronous transmission is usually associated with low-speed (up to 1200 bits/s) modem links. Where such asynchronous transmission exists data can still be transmitted in blocks with error correction using file transfer protocols such as XMODEM, YMODEM, ZMODEM, BLAST and KERMIT

Error control

Most data link protocols provide some for of error detection, although only connection-oriented data link layer protocols tend to support error correction. Errors, as we have seen, are mostly generated at the physical layer and with error-prone media it is important to detect and correct errors at the data link layer. Otherwise they will be forwarded over other data links and will eventually have to be corrected at a higher end-to-end layer. This would be very inefficient

most problem in data link layer

One of the problems that can occur with any data link protocol is transparency. The protocol should not impose any restrictions on the data to be transmitted. In particular, it must be possible to transmit the special data used to delimit frames and synchronise the receiver (such as flags, and other special characters) within the data itself without confusing the receiver. This is vital, since executable files, which are binary, could easily contain bits that represent these special characters

Point-to-Point Protocol (PPP

PPP is a suite of protocols designed to carry IP over modem links. Access to Internet Service Providers normally uses PPP as the data link protocol, for both dial-up and broadband connections. It supports multiple network layer protocols, besides IP, including AppleTalk and IPX. As its name implies, it only supports point-to-point line configurations. It is a connection-oriented, full-duplex, symmetric, synchronous, character oriented, byte stuffed protocol. It uses CRC-16 or CRC-32 error detection, but has no flow control or error recovery mechanisms. It relies on higher layer protocols to recover from errors.

ppp and synchronization

PPP uses a 1-byte flag (the same as HDLC's) for synchronisation at the start and end of each frame. The header consists of a 1-byte Address field which is always set to the broadcast address (all ones), a Control field that defines the type of frame, a protocol field for demultiplexing the various protocols that PPP can carry, a variable length data field, followed by a 2 or 4-byte CRC field and then another flag.

Connection control

Some data link layer protocols (such as HDLC and PPP) are connectionoriented with the usual three connection phases (connection, data transfer and disconnection). These protocols require that a link is set up before data can be transmitted which must be closed afterwards. The connection and disconnection of the link is achieved through special frames known as supervisory frames which carry no data. Frames that carry data are called information frames. Connection-oriented data link protocols are able to guarantee the delivery of data in order, without loss and without duplication

Logical Link Control (LLC)16

The LLC sub-layer has been standardised by the IEEE and is common to all LAN protocols. It has the following fields: • A 1-byte Destination Service Access Point field, which specifies the destination user of LLC for demultiplexing. The first bit indicates whether it is an individual or group address. • A 1-byte Source Service Access Point field, which specifies the destination user of LLC. The first bit indicates whether the PDU is a command or a response. • A 1- or 2-Byte LLC Control field, which is identical to that used in HDLC with extended (7-bit) sequence numbers. The LLC standard defines three types of service that can be offered using the same PDU formats: • LLC Type 1 (LLC1) - unacknowledged connectionless service • LLC Type 2 (LLC2) - acknowledged connection-oriented service • LLC Type 3 (LLC3) - acknowledgacknowledged connectionless service.

Addressing

The data link layer is responsible for the addressing of devices attached to data links. Many data link layer protocols have either been designed to work over a shared medium or can trace their origins back to protocols used in terminal to host network where many terminals shared a data link to a host. In both cases some form of addressing is required and all data link protocols, even those that are only ever used in point-to-point configurations, have address fields even though they are not strictly needed. Point-to-Point Protocol (PPP) commonly used on dial-up Internet connections uses the broadcast address of all 1s for all of its addresses. Addresses on point-to-point and point-to-multipoint circuits only have local significance, but addresses used by data link protocols on LANs are globally unique. They are often called Media Access Control (MAC) or physical addresses as they identify physical devices, or at least their Network Interface Cards (NICs), onto which they are burned. They have been standardised by the IEEE1 and are used on all types of LANs. They are 48 bits long and are normally represented in hexadecimal form in pairs separated by hyphens or colons. Each pair corresponds to one byte of the address, as below. 00:06:F5:00:1E:2C or 00-06-F5-00-1E-2C The first three bytes make up the Organisationally Unique Identifier (OUI), which identifies the manufacturer of the NIC. The last three bytes are a serial number assigned by the manufacture

Encapsulation in datalink layer

The data link layer receives data from the network physical layer and encapsulates it, so that the network layer packet is transmitted inside a data link layer frame. Unlike most other layers, the data link layer not only precedes the higher level data with a header, it also uses a trailer for error detection codes which follows after the data. At the receiving end, the data link layer decapsulates the frame, checks it for errors, and if there are none, passes the packet contained within the frame to the network layer.

Services in data link layer

The data link layer, like most other layers, can offer a connection-oriented or connectionless service to its upper layer. You may think that connectionoriented services are only required at the network layer or above, but some data link protocols require some interaction to take place to set up the data link before data can be sent and to close it down afterwards. Some of these protocols also require state information to be held at each end, to support sliding window flow and error control. All of this points towards the need for connection-oriented as well as connectionless operation.

interfaces

The interfaces provided by the data link layer must support the usual connectionless and connection-oriented primitives. Again, they are rarely seen by anyone other than network layer protocol developers.

Media Access Control

The lower sub-layer is called the Media Access Control (MAC) sub-layer and is dependent on the type of LAN. The IEEE is also responsible for specifying the standards for the different MAC sub-layer protocols. The MAC sub-layer is responsible for controlling access to the transmission medium in such a way that capacity is allocated orderly and efficiently. It is also responsible for framing, addressing and error checking.

Functions of data link layer

The main role of the data link layer is to move data across a single physical link. All the higher layers transmit data across subnetworks which are often made up of multiple data links, but the data link layer is responsible for just one physical link. The physical link can be a private circuit (metallic or optical), an Ethernet bus, a Token Ring or a wireless link. The data link layer must also detect and recover from transmission errors and regulate the flow of data across the physical link. We will now look at the main functions of the data link layer

categorization of types of framing

The most common character-oriented data link protocol is the Point-to-Point Protocol used for Internet access. Bit-oriented data link protocols use a special bit sequence called a flag to synchronise communications and indicate the start and end of frames. Flags are continually transmitted down the link when there is no data to send. This allows the receiver to be kept in synchronisation with the transmitter. In the event of the receiver losing synchronisation, it simply looks for a flag in order to re-synchronise

ways to achieve framing

There are three ways that this can be achieved. Firstly, special bit sequences could be used to indicate the start and end of frames. Secondly, the frame header could contain a length field so that the receiver can determine the end of the frame and then assume that any further data is a new frame. Finally, the start or the end of the frame could be indicated by a code violation. A code violation breaks a rule being used for the coding of data at the physical layer, which can be used by the data link layer to indicate the start or end of a frame. Each method has some problems and data link layer protocols often combine two of the above methods.

transparency problem overcoming

Transparency problems are overcome by a procedure called stuffing (either byte stuffing for character-oriented protocols or bit-stuffing for bit-oriented protocols). The procedure involves inserting character or a bit in the data stream to prevent the receiver getting confused between codes being used by the data link protocol and codes being transmitted in the data

Vertical Redundancy Checks

VRCs are commonly used in asynchronous communications and add a redundant (parity) bit to each 7-bit ASCII character which is transmitted after the data bits and checks for errors. The parity bit is usually set so that when all 8 bits are added together the sum is even. This is called even parity. It is also possible to do a VRC using odd parity. Traditionally, odd parity was favoured for synchronous transmission and even parity for asynchronous transmission. VRCs can detect any single bit error and 50% of burst errors. VRCs can be implemented easily in hardware using exclusive OR (XOR) logic gates

Hamming code example 1

We will now look at an example of how to code the byte 01101110 in an even Hamming code. We place the bits from this byte in the first row of a table headed with the bit numbers in reverse order,6 leaving spaces for the parity bits. In the b1 row, we place all the bits that are checked by b1 and then calculate the value of b1 which will give even parity and enter it in the b1 column. We do the same to calculate b2 in the b2 row, b3 in the b4 row and b8 in the b8 row. We can see that the error occurred in parity bits 1, 2 and 4 but not in 8. The b7 bit is the only one that is checked by bit1, bit2 and bit4 and nothing else, which means that it is therefore the one that has been corrupted. As an additional check, we can read the bits in the 'fix' column upwards from the bottom and converting the binary number to decimal gives 7 confirming that the error was in b7. The bit error can now be corrected and the original byte that was sent was 11001101. Unfortunately, most transmission errors are caused by impulse noise, which will cause a burst of errors rather than a single bit error. Hamming codes can be extended to correct burst errors of up to N bits in a block of N bytes (where N is an arbitrary number), by changing the order of bit transmission. If a sequence of bytes is Hamming coded and then assembled into a block of N bytes and the first bit of each Hamming code in the block is transmitted in turn followed by the second bit of each Hamming code, then the third etc., until the 12th bit of the Nth Hamming code is transmitted, then a single burst error of up to N bits can be corrected. This is illustrated in Table 7.6 which shows four bytes (a, b, c and d) encoded as Hamming codes assembled into a block for transmission.

Ethernet Media Access Control (IEEE 802.3)

We will study the Ethernet MAC protocol in this part of the course, as it is a common method of interfacing a personal computer to a broadband modem (ADSL or cable) which will be covered in the next chapter. Other LAN MAC protocols will be studied in the Enterprise Networking part of the course, as they are most commonly used by enterprises. The Medium Access Control for Ethernet uses the CSMA/CD multiple access technique. The backoff algorithm used by Ethernet is the Binary Exponential Backoff Algorithm. Each transmitter chooses a random number between 0 and 2N -1, where N is the number of times the frame has suffered from a collision. This is then multiplied by the maximum round trip time that it can take a frame to travel from one end of the LAN to the other end and back. The station then waits for this time, before it retransmits the frame. Thus in a very heavily congested LAN that suffers from successive collisions, the spread of backoff times will grow exponentially after each collision. In a lightly congested LAN, the backoff times are likely to be quite small, as there is a high probability that the stations will select different backoff times. After 10 collisions the backoff time is frozen, and after 16 collisions, the algorithm gives up and reports failure. The Ethernet 802.3 MAC frame18 consists of the following fields: • A 7-byte Preamble of alternating 1s and 0s. Strictly speaking, it is not part of the data link frame. It is added by the physical layer. Its purpose is to synchronise the receiver before the start of the frame. • A 1-byte Start of Frame Delimiter (10101011) to alert the receiver that a frame is beginning. • A 6-byte Destination Address field. • A 6-byte Source Address field. • A 2-byte Length/Type19 field to indicate the length of the data field in bytes or its Ethernet II type. • A variable length Data field (between 0 and 1500 bytes). • A variable length Pad field (between 0 and 46 bytes). All valid Ethernet frames must be at least 64 bytes long. This is to ensure that all collisions are detected. A short frame could be transmitted and collide with another frame, but the transmitter will not detect a collision that has corrupted the frame. If the data being carried is less than 46 bytes then padding is added to make the frame 64 bytes long A 4-byte Frame Checking Sequence using CRC-32

Forward Error Correction (FEC)

With Forward Error Correction (FEC), redundant information (much more than is needed for error detection alone) is sent along with the data, so that errors can not only be detected but, in many cases, corrected as well. These schemes are by no means foolproof and protocols that use FEC will also have to implement ARQ for situations where errors are detected but cannot be corrected. We have already seen how the LRC can pinpoint and correct a single bit error. Another well known FEC scheme which can be extended to correct multiple bit errors is the use of Hamming codes5. The Hamming code can be used to correct a single bit error in an arbitrarily long sequence of bits (but often 8 bits). The Hamming code uses multiple parity bits within a code, where each parity bit checks a unique combination of bits. The parity used can be either even or odd.

data link layer and framing

important function of the data link layer is the framing of data. Data is received by the data link layer from the network layer in the form of packets. The data link layer must encapsulate these packets into frames for transmission over the physical link and decapsulate the data at the receiving end. In order to do this successfully the data link layer at the receiving end must be able to determine the start and end of each frame.

Random Access

where there are few, if any, constraints on when a station can transmit, is the simplest of all access methods. However, the data link protocol must be able to detect when stations are transmitting simultaneously (a collision) and have a procedure to resolve the contention. There are four different access methods that can be employed: • Multiple Access (MA) is the simplest random access method. There is absolutely no constraint on when to transmit. A transmitter can even transmit after another station has already started to transmit. The original ALOHA packet radio system used this method for data communication between the Hawaiian Islands. After sending a frame the station has to wait for an acknowledgement. If this is not received it retransmits the frame after a random time (this procedure is called backoff). • Carrier Sense Multiple Access (CSMA) is a refinement of Multiple Access where the transmitter listens on the energy levels in the medium to check that no other station is transmitting, before beginning to transmit itself. It therefore senses the carrier before transmitting. This method reduces the possibility of collisions, but they can still occur, since

PPP frames carry within them other protocols from the PPP suite:

• Link Control Protocol (LCP) is used to establish, configure, maintain and close down the data link. When establishing a link, LCP is able to negotiate options such as the Maximum Receive Unit that can be handled and which error correction techniques or data compression algorithms, if any, will be used. LCP is optionally able to determine the quality of the link and close it down, if it is of poor quality. LCP packets do not carry any user data. • The authentication protocol to be used to identify the user to the ISP is one of the options that LCP negotiates when it establishes a link. There are two alternative authentication protocols supported by PPP: • Password Authentication Protocol (PAP) is a simple authentication protocol that sends user name and passwords in plain text. PAP is only used at link establishment. • Challenge Handshake Authentication Protocol (CHAP) is a much more secure form of authentication using a three-way handshake. The password is kept secret and the client may from time to time (not just at link establishment) be sent a challenge value. It uses a predefined function that takes the challenge value and the user's password as its input to produce a result that is transmitted back to the challenger. The challenger then issues a packet to accept or reject the authentication. • Network Control Protocols (NCPs) which are used to configure the various network layers supported by PPP. There is therefore a different NCP for most protocols that PPP supports. IP Control Protocol (IPCP)15 is used to set up the IP network layer (including the configuration of the IP address).

The physical medium at the level below the data link layer can be one of three basic types. It can be

• Point-to-Point - a normal telecommunications circuit with two ends. • Point-to-Multipoint - a multidrop circuit in a tree topology supporting a small number of devices (or stations) which can each view all the transmissions on the medium. This type of circuit was very popular with mainframe star networks, where circuits were configured with the host at one end and multiple terminals in different locations at the other ends. • Broadcast - a shared medium usually in a bus or ring topology or using wireless transmission, where any number of stations, usually of equal status, can view all the transmissions on the medium


Related study sets

Financial Accounting 6.0: Analyzing Financial Statements | HBS CORe

View Set

الملك حسين بن طلال

View Set

Chapter 11: The Presidency, Chapter 13: The Federal Courts, Chapter 12: Bureaucracy, Chapter 10: Congress

View Set

Pennsylvania P&C Licensing Exam: Ch. 1

View Set

genetics final (test 2 questions)

View Set

Chapter 1: Introduction to Sociology

View Set