Mod4 Framing HDLC MAC PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

ITT350:

Computer Networks
Module 4: Framing, HDLC, PPP and MAC

Instructor: Dr. Iqra Altaf Gillani


Data link layer
Framing
At physical layer, data transmission means moving bits in form of signals from
source to destination. So, physical layer provides bit synchronization to ensure
sender and receiver use same bit duration and timings.
Framing
At physical layer, data transmission means moving bits in form of signals from
source to destination. So, physical layer provides bit synchronization to ensure
sender and receiver use same bit duration and timings.

Data link layer packs bits in frames and one frame is distinguished from other.
Also, it separates a message from one source-destination pair from other
messages for other pair by adding sender and receiver address.
Framing
At physical layer, data transmission means moving bits in form of signals from
source to destination. So, physical layer provides bit synchronization to ensure
sender and receiver use same bit duration and timings.

Data link layer packs bits in frames and one frame is distinguished from other.
Also, it separates a message from one source-destination pair from other
messages for other pair by adding sender and receiver address.

Optimum size: Can’t be too large as error and flow control would be difficult. Too
small would result in a lot of overhead.
Types of framing
● Fixed-size

● Variable-size
Types of framing
● Fixed-size

There is no need of frame boundaries as the size is the delimiter. Example: ATM
WAN has fixed size frames called cells.

● Variable-size
Types of framing
● Fixed-size

There is no need of frame boundaries as the size is the delimiter. Example: ATM
WAN has fixed size frames called cells.

● Variable-size

We need to define the beginning and end of frame (synchronization). Used in


LANs. Two approaches used for identification:

1. Character-oriented protocols
2. Bit-oriented protocols
Character-oriented protocols
Data that is to be carried considered as a group of bits or character like 8 bit
character from a coding system like ASCII.

Such frames have three main parts:

● Header
● Trailer
● Flag
Character-oriented protocols
Data that is to be carried considered as a group of bits or character like 8 bit
character from a coding system like ASCII.

Such frames have three main parts:

● Header: Source, destination address and other control information


● Trailer: redundant bits for error detection and correction
● Flag: 8 bit (1 byte) at beginning and end to separate frames. Protocol
independent special characters.
Character-oriented protocols
Data that is to be carried considered as a group of bits or character like 8 bit
character from a coding system like ASCII.

Such frames have three main parts:

● Header: Source, destination address and other control information


● Trailer: redundant bits for error detection and correction
● Flag: 8 bit (1 byte) at beginning and end to separate frames. Protocol
independent special characters. This was popular when we only sent text.
But, now with information like graphs, audio, video any pattern used for flag
can be part of information and could cause misinterpretation by receiver.
Byte or character stuffing
Sender: Special byte is added to data stream of frame when data with flag pattern
is found. This extra byte is called escape character (ESC). It is a predefined bit
pattern.

Receiver: Whenever it receives an ESC in data it removes it and treat next


character as data and not flag.

Problem:???
Byte or character stuffing
Sender: Special byte is added to data stream of frame when data with flag pattern
is found. This extra byte is called escape character (ESC). It is a predefined bit
pattern.

Receiver: Whenever it receives an ESC in data it removes it and trest next


character as data and not flag.

Problem: If data contains ESC it will be removed by the receiver.

Solution:
Byte or character stuffing
Sender: Special byte is added to data stream of frame when data with flag pattern
is found. This extra byte is called escape character (ESC). It is a predefined bit
pattern.

Receiver: Whenever it receives an ESC in data it removes it and trest next


character as data and not flag.

Problem: If data contains ESC it will be removed by the receiver.

Solution: Add an additional ESC to indicate that it is part of data.


Byte or character stuffing
Sender: Special byte is added to data stream of frame when data with flag pattern
is found. This extra byte is called escape character (ESC). It is a predefined bit
pattern.

Receiver: Whenever it receives an ESC in data it removes it and trest next


character as data and not flag.

Problem: If data contains ESC it will be removed by the receiver.

Solution: Add an additional ESC to indicate that it is part of data.

Byte stuffing is the process of adding 1 extra byte whenever there is a flag
or escape character in the text.
Byte or character stuffing
Byte or character stuffing
Bit-oriented protocols
Data is treated as sequence of bits which can represent text, audio, video by
upper layers.

We still need header and trailer as delimiters to separate frames. Most protocols
use special 8 bit pattern as flag 01111110.
Bit-oriented protocols
Data is treated as sequence of bits which can represent text, audio, video by
upper layers.

We still need header and trailer as delimiters to separate frames. Most protocols
use special 8 bit pattern as flag 01111110.

Flag can create same problem as we saw in byte-oriented protocols. If flag pattern
is repeated in data, how to inform the receiver it is not end of frame.
Bit-oriented protocols
Data is treated as sequence of bits which can represent text, audio, video by
upper layers.

We still need header and trailer as delimiters to separate frames. Most protocols
use special 8 bit pattern as flag 01111110.

Flag can create same problem as we saw in byte-oriented protocols. If flag pattern
is repeated in data, how to inform the receiver it is not end of frame ⇒ Bit stuffing
Bit stuffing
Stuffing single bit to prevent pattern from looking like a flag. In bit stuffing
whenever a 0 and 5 1s are encountered an extra 0 is added. This extra bit is
eventually removed by the receiver.

Note that extra bit is added after 011111 regardless of next bit to make it
conventional for receiver. This is because if we have 0111110, receiver would
interpret it as stuffed bit and remove it.
Bit stuffing
Stuffing single bit to prevent pattern from looking like a flag. In bit stuffing
whenever a 0 and 5 1s are encountered an extra 0 is added. This extra bit is
eventually removed by the receiver.

Note that extra bit is added after 011111 regardless of next bit to make it
conventional for receiver. This is because if we have 0111110, receiver would
interpret it as stuffed bit and remove it.

So, flaglike pattern 01111110 is changed to 011111010.


Bit stuffing
Bit stuffing
Q) In a data link layer protocol, flag is 0111. Assuming
bit stuffing is employed by sender, send the data
sequence 01110110.
Q) In a data link layer protocol, flag is 0111. Assuming
bit stuffing is employed by sender, send the data
sequence 01110110.
Answer: 0110101100
HDLC (High level Data link control)
Bit oriented protocol for communication over point-to-point and multipoint links.

It uses stop and wait protocol.

More theoretical but forms basis for practical protocols used in LANs like PPP,
Ethernet.
HDLC configuration and transfer modes
HDLC works in two modes:

● Normal response mode (NRM)


● Asynchronous balanced mode (ABM)
HDLC: NRM
Unbalanced station configuration,
i.e., data flows in client server
model.

(One) Primary sends commands


and (one or multiple) secondary
only respond.
HDLC: ABM
Balanced configuration, i.e., data transfer as peer to peer network.

Common mode: point to point links.


HDLC: Framing
To provide flexibility and support to all configurations. HDLC defines three types of
frames that serve as envelope for different types of information:

● Information frame (I-frame)


● Supervisory frame (S-frame)
● Unnumbered frame (U-frame)
HDLC: Framing
To provide flexibility and support to all configurations. HDLC defines three types of
frames that serve as envelope for different types of information:

● Information frame (I-frame): user data and control information about user data
like piggybacking.
● Supervisory frame (S-frame): control information
● Unnumbered frame (U-frame): System management like managing link itself,
session management
HDLC: Framing
HDLC: Frame content
Flag: synchronization pattern of 01111110.

Address: Always of secondary station.

Control:

Information field: user data from network layer or management information.

Frame check sequence (FCS): error detection field ( 2 or 4 bytes of CRC).


HDLC: Control field
Determines the type of frame and defines its functionality.

1. Information frame: carries user data and flow-control information


(piggybacking). These functions are defined by sub-fields in control field.
● First bit: 0 - indicates I frame
● Next 3 bits (N(S)): Sequence number of frame
● Last 3 bits (N(R)): Ack no. (piggybacking)
● P/F bit: dual purpose, only valid if set to 1 ⇒ Poll/Final
○ Poll - frame sent by primary to secondary
○ Final - frame sent by secondary to primary
HDLC: Control field
2. Supervisory frame: used for flow and error control
whenever piggybacking is either impossible or inappropriate.

● First 2 bits: 10 indicate it is a S frame


● Last 3 bits (N(R)): ACK or NAK number.
● 2 bits code: used to define further subtype of S-frame
○ Receive ready (RR): 00 - acknowledges receipt of a safe and sound frame or
group of frames with ACK no. given by N(R)
○ Receive not ready (RNR): 10 - acknowledges receipt of a frame or group of frames
and announces receiver is busy and cannot receive further frames (congestion
control).
○ Reject (REJ): 01 - NAK frame that can be used with Go Back N to improve its
efficiency by informing sender before timer expires that last frame is lost/damaged.
○ Selective Reject (SREJ): 11 - NAK frame that can be used in Selective repeat.
HDLC: Control field
3. Unnumbered frame: used to exchange session management and control
information.

It has a information field but that contains system management information and
not user data.

5 bits are used for code:


HDLC: Control field
3. Unnumbered frame: used to exchange session management and control
information.

It has a information field but that contains system management information and
not user data.

5 bits are used for code:

These result in 2^5=32 different sub-types of U-frame.

Example: 00 001 - SNRM - Set Normal response mode

11 100 - SABM - Set Asynchronous balanced mode


Point to point protocol (PPP)
Supports both point-to-point as well as multi-point configurations. Most common
data link protocol for point to point access.

Example: Internet users who connect their PC to ISP using dial up connections.

This is a byte oriented protocol and does not provide flow control. However, CRC
is used for error control.
PPP: Framing
Character or byte oriented.

Flag: 1 byte with flag pattern 01111110.

Address: constant value and set to 11111111 (broadcast address)

Control: set to constant 11000000. No flow control.


PPP: Framing
Protocol: defines what is being carried in data field either user data or other
information.

Payload: User data or control information. Default size of maximum 1500 bytes but
can be changed by negotiation. Data field is byte stuffed to avoid flag-like pattern.
Byte stuffing - add ESC byte (01111101) whenever flag pattern appears in data.
PPP: Framing
Protocol: defines what is being carried in data field either user data or other
information.

Payload: User data or control information. Default size of maximum 1500 bytes but
can be changed by negotiation. Data field is byte stuffed to avoid flag-like pattern.
Byte stuffing - add ESC byte (01111101) whenever flag pattern appears in data.
Also, an ESC byte should be stuffed by another ESC byte.

FCS: 2 or 4 byte standard CRC.


PPP components
PPP components that ensure data transfer.
● Encapsulation Component − It encapsulates the datagram so that it can be transmitted
over the specified physical layer.
● Link Control Protocol (LCP) − It is responsible for establishing, configuring, testing,
maintaining and terminating links for transmission. It also imparts negotiation for set up of
options and use of features by the two endpoints of the links.
● Authentication Protocols (AP) − These protocols authenticate endpoints for use of
services. The two authentication protocols of PPP are −
○ Password Authentication Protocol (PAP)
○ Challenge Handshake Authentication Protocol (CHAP)
● Network Control Protocols (NCPs) − These protocols are used for negotiating the
parameters and facilities for the network layer. For every higher-layer protocol supported by
PPP, one NCP is there like IPCP, IPV6CP.
PPP authentication protocols
PPP was designed for use over dial-up links so verification of user identity is
necessary, i.e., whether to allow user to access resources or not.

1. Password authentication protocol (PAP):


a. User who wants access sends authentication id (username) and a password.
b. System checks validity of the identification and password and either accepts or denies
connection.
PPP authentication protocols
PPP was designed for use over dial-up links so verification of user identity is
necessary, i.e., whether to allow user to access resources or not.

1. Password authentication protocol (PAP):


a. User who wants access sends authentication id (username) and a password.
b. System checks validity of the identification and password and either accepts or denies
connection.
2. Challenge handshake authentication protocol (CHAP): is a 3-way
handshaking protocol that provides greater security than PAP as password
remains a secret and is never shared online.
a. System sends user a challenge packet containing a challenge value (few bytes).
b. User applies predefined function that takes challenge value and user’s password to create a
result. User sends this result in response packet to system.
c. System does same, applies same function to password (already in database) and challenge
value. If results are same, user is given access otherwise denied.
Media access control (MAC) address
MAC address is a unique id assigned to NIC (network interface controller) for
communication at data link layer.

This is assigned by the manufacturer of NIC, stored in hardware. It encodes


manufacturer’s registered id known as burned in address.

Multiple NICs, each NIC has unique MAC.


MAC details
It has 6 octets, i.e., 6*8=48 bits. It uses hexadecimal notation separated by
hyphen(-) or colon(:).
MAC details
It has 6 octets, i.e., 6*8=48 bits. It uses hexadecimal notation separated by
hyphen(-) or colon(:).
MAC details
It has 6 octets, i.e., 6*8=48 bits. It uses hexadecimal notation separated by
hyphen(-) or colon(:).

Broadcast address:

FF:FF:FF:FF:FF:FF

Received by all stations on LAN.


References
● Chapter 11 [BAF]
● PPP. https://www.tutorialspoint.com/point-to-point-protocol-ppp
[Accessed date: April 2021]
● Note: Source of all images unless specified is [BAF] book (4th Edition).

You might also like