0% found this document useful (0 votes)
43 views

Chapter 3

computer network

Uploaded by

Parsal Silwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Chapter 3

computer network

Uploaded by

Parsal Silwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Data Link Layer

The data link layer uses the services of the physical layer to send and receive bits over communication
channels. It has a number of functions, including:

1. Providing a well-defined service interface to the network layer.

2. Dealing with transmission errors.

3. Regulating the flow of data so that slow receivers are not swamped by fast senders.

To accomplish these goals, the data link layer takes the packets it gets from the network layer and
encapsulates them into frames for transmission. Each frame contains a frame header, a payload field for
holding the packet, and a frame trailer, as shown in figure below:

Fig: Relationship between packet and frame

Data Flow from source machine to destination machine is shown below:

Fig: (a) Virtual Communication (b) Actual Communication

By: Er. Saurav Raj Pant, IOE - TU


Data Link Layer Services:

 The Data Link Layer can offer many different services.


 These services can vary from system to system.
 Common services:
o Unacknowledged connectionless service.
o Acknowledged connectionless service.
o Acknowledged connection-oriented service.

Unacknowledged Connectionless Service

• No acknowledgement from the receiving machine.

• No logical connection is set up between the two machines.

• The DLL will make no attempt to detect the loss of or recover a lost frame.

• This service is useful for low error rate networks and for real-time traffic where late data is worse than
no data.

Acknowledged Connectionless Service

• The receiver acknowledges the arrival of each frame.

• If it hasn’t arrived correctly (or within the correct time) it can be resent.

• This is a useful service when the connection is unreliable (such as wireless)

• There is no requirement for such an acknowledgement service to be implemented by the Data Link
Layer.

Acknowledged Connection-Oriented Service

• A connection is established between the two machines.

• The frames are then transmitted and each frame is acknowledged.

• The frames are guaranteed to arrive only once and in order.

• This is the same as a “reliable” bit stream.

• The connection is released once the communication is complete.

By: Er. Saurav Raj Pant, IOE - TU


Other services of DLL are:

 Framing:
Encapsulates datagram into frame, adding header, trailer.
“MAC” addresses used in frame headers to identify source, destination
 Flow Control:
Pacing (speed) between adjacent sending and receiving nodes
 Error Control:
a. Error Detection:
Errors caused by signal attenuation, noise are detected by the receiver.
b. Error Correction:
Correction can be done by receiver by Forward Error Correction method.
Or by Backward Error Correction Method. i.e. Retransmission

Framing:
• Translates the physical layer's raw bit stream into discrete units called frames.

• Encapsulating a network layer datagram into frame.

• Frame is a data on the Layer 2 of the OSI model

• The Process of creating Frames by the Data Link Layer is known as Framing.

Types of Frames:

1. Fixed size Framing

 Fixed size Framing have Fixed Length

 No need to define boundaries for Frames

Example: ATM Frames (54 byte cells)

2. Variable size Framing


 Variable Size Framing do not Fixed Size
 Need a way to define the end of the frame and the beginning of the next frame

By: Er. Saurav Raj Pant, IOE - TU


Framing Methods:

Character Count:

• We use a field in the header to specify the number of characters in the frame.

• Destination sees the character count, it knows how many characters to follow.

Fig: A byte stream (a) without error (b) with one error

The main disadvantage of this method is that, an error can change the character count.
And if the wrong character count is received than the receiver will get out of synchronization
and will be unable to locate the start of the next frame. This method is rarely used today.

Flag bytes with byte stuffing:

This method solves the problem of resynchronization after an error by having each
frame start and end with special bytes. Often the same byte, called a flag byte, is used as both
the starting and ending delimiter. Two consecutive flag bytes indicate the end of one frame and
the start of the next. Thus, if the receiver ever loses synchronization it can just search for two
flag bytes to find the end of the current frame and the start of the next frame.

However, there is a still a problem we have to solve. It may happen that the flag byte
occurs in the data, especially when binary data such as photographs or songs are being
transmitted. This situation would interfere with the framing. One way to solve this problem is
to have the sender’s data link layer insert a special escape byte (ESC) just before each
‘‘accidental’’ flag byte in the data. Thus, a framing flag byte can be distinguished from one in

By: Er. Saurav Raj Pant, IOE - TU


the data by the absence or presence of an escape byte before it. The data link layer on the
receiving end removes the escape bytes before giving the data to the network layer. This
technique is called byte stuffing.

What happens if an escape byte occurs in the middle of the data? The answer is that it,
too, is stuffed with an escape byte.

Fig: (a) A frame delimited by flag bytes (b) four examples of byte sequence before and
after byte stuffing

Flag bits with bit stuffing:

• We could have problems with two machines communicating where one uses 8-bit characters
and one uses 16-bit characters.

• We stuff bits instead of bytes.

• Most DLL protocols use a combination of character count with another method for extra
safety. This increases the chances of catching an error.

• At the start and end of each frame is a flag byte consisting of the special bit pattern 01111110

• Whenever the sender's data link layer encounters five consecutive 1s in the data, it
automatically stuffs a zero bit into the outgoing bit stream. This technique is called bit stuffing

• When the receiver sees five consecutive 1s in the incoming data stream, followed by a zero
bit, it automatically de-stuffs the 0 bit.

• The boundary between two frames can be determined by locating the flag pattern.

By: Er. Saurav Raj Pant, IOE - TU


Fig: Bit Stuffing

(a) The Original Data

(b) The data as they appear on the line.

(c) The data as they are stored in the receiver’s memory after destuffing.

Physical layer coding violations:

The last method of framing is to use a shortcut from the physical layer. This method is
only applicable to networks in which the encoding on the physical medium contains some
redundancy. This redundancy means some signals will not occur in regular data. This means
there is possibility that many signals are not being used and just are reserved.

We can use some reserved signals to indicate the start and end of frames. In effect, we
are using ‘‘coding violations’’ to delimit frames. The beauty of this scheme is that, because they
are reserved signals, it is easy to find the start and end of frames and there is no need to stuff
the data.

Note:

Many data link protocols use a combination of these methods for safety. A common
pattern used for Ethernet and 802.11 is to have a frame begin with a well-defined pattern
called a preamble. This pattern might be quite long (72 bits is typical for 802.11) to allow the
receiver to prepare for an incoming packet. The preamble is then followed by a length (i.e.,
count) field in the header that is used to locate the end of the frame.

By: Er. Saurav Raj Pant, IOE - TU


Error Control:
• We use bit and byte stuffing as a method for detecting and determining errors in the data that we
send.

• We also have to deal with making sure that the frames make it to their destination.

• The receiver sends back a control frame acknowledging the received frame and the condition of the
frame.

• A timeout can occur if the acknowledgement doesn’t arrive, resulting in the frame being resent.

• Resending the frame can also cause problems – what happens when the same frame is received twice?
• We can also sequentially number the frames to prevent this problem.

• Error control in the data link layer is based on automatic repeat request, which is the retransmission of
data

• Error control includes both error detection and error correction

 Changes in bits results in Error


 Types of Error:
o Single Bit Error
o Burst Error
• Single Bit Error Occurs when Single bit Changes from 1 to 0 or from 0 to 1.

 Burst error:
o 2 or more bits in the data unit have changed from 1 to 0 or from 0 to 1.
o Burst error is more likely to occur than a single-bit error

By: Er. Saurav Raj Pant, IOE - TU


Error Detection Methods:
Error Detection uses the concept of redundancy, which means adding extra
bits for detecting errors at the destination.
1. Parity Check
2. Checksum
3. Cyclic Redundancy Check (CRC)

Parity Check:
The parity check is done by adding an extra bit called parity bit to the data to
make no. of 1’s either even in case of even parity or odd in case of odd parity.

While creating a frame, the sender counts the no. of 1’s in it and adds the parity
bit in the following way:

In case of even parity; if the number of 1’s is even then parity bit value is zero.
If the number of 1’s is odd then parity bit value is 1.

In case of odd parity if a number of 1’s is odd then parity bit value is zero. If a
number of 1’s is even then the parity bit value is 1.

 On receiving a frame, the receiver counts the no. of 1’s in it. In case of even parity
check if the count of 1’s is even, the frame is accepted otherwise it is rejected. A
similar rule is adopted for odd parity check.
 The parity check is suitable for single bit error detection only.

Checksum:
The sender adds the bits of the data to get the sum; it then computes the 2’s
compliment of the sum to get the checksum and sends the checksum along with the dataframe.
The receiver adds all the data bits along with the checksum. If the result is zero the received
frame are accepted otherwise they are discarded.

Cyclic Redundancy Check (CRC):


CRC involves binary division of the data bits being sent by a predetermined devisor
agreed upon by the communicating system. The devisor is generated using the degree of the
polynomials. Here the sender performs binary division of the data segment by the devisor. It
then appends the remainder called CRC bits to the end of the data segment. This makes the

By: Er. Saurav Raj Pant, IOE - TU


resulting data unit exactly divisible by the devisor. The receiver divides the incoming data unit
by the devisor. If there is no remainder then the data unit is assumed to be correct and is
accepted. Otherwise it is understood that the data is corrupted and is therefore rejected.

Fig: Standard Polynomials

Fig: CRC Example

By: Er. Saurav Raj Pant, IOE - TU


Error Correction:
1. Backward Error Correction (BEC)

If the receiver detects any error in the incoming frame, it requests the sender to
retransmit the frame. It is relatively simple technique. But it can be effectively
used only where retransmission is not expensive. For e.g. in fiber optic cables. It
is also called Automatic Repeat Request (ARQ) technique.

2. Forward Error Correction (FEC)

If the receiver detects any error in the incoming frame, it executes error
correcting codes that generates the actual frames. This saves bandwidth for
retransmission.

 Possible if the number of error is small i.e. if there are too many
errors, the frames needs to be retransmitted. Some of the codes are
Hamming codes, Binary Convolutional codes, low density parity check
codes etc.

Hamming Codes:

Hamming code is a block code that is capable of detecting up to two simultaneous bit
errors and correcting single-bit errors. It was developed by R.W hamming for error correction.

In this coding method, the source encodes the message by inserting redundant bits
within the message. These redundant bits are extra bits that are generated and inserted at
specific positions in the message itself to enable error detection and correction. When the
destination receives this message, it performs recalculations to detect errors and find the bit
position that has error.

Encoding a message by Hamming code:

Step 1: Calculation of the number of redundant bits.

The no. of redundant bit is calculated by using formula:

2^r ≥ m+r+1

Where, r= redundant bit, m= data bits

Suppose we have 4 data bits, then redundant bits can be calculated as:

2^3 ≥ 4 +3+1 ; thus no. of redundant bits =3.

By: Er. Saurav Raj Pant, IOE - TU


Step 2: positioning the redundant bits.

The positions of these bits is given by the formula 2^n, where n = {0,1,2,3,..}

So for 3 redundant bits, the position of these bits would be:

2^0, 2^1, 2^2 i.e. 1st , 2nd and 4th position.

Step 3: calculating the values of each redundant bits.

These redundant bits are parity bits. By default, we use even parity for the
calculation of these bits.

Thus, r1 = “parity value will be 1, if the no. of 1’s for positions 3,5,7.. is
odd”

r2= “parity value will be 1, if the no. of 1’s for positions 3,6,7.. is
odd ”

r3= “parity value will be 1, if the no. of 1’s for positions 5,6,7.. is
odd”

Decoding a message in Hamming Code:

Step 1: calculation of the number of redundant bits. (as like above)

Step 2: positioning the redundant bits. (as like above)

Step 3: parity checking:

Parity bits are calculated upon the data bits and the redundant bits using same
rule as above:

i.e. c1 = parity (1,3,5,7)

c2 = parity (2,3,6,7)

c3 = parity (4,5,6,7)

Step 4: Error Detection and Correction:

Now, the error can be detected by the receiver if there is any with the help of
the parity checking. i.e. if the values of c1, c2 and c3 are 0’s then there is no error, else
there is an error.
c3.c2.c1
This error position is calculated simply by the decimal value of the bits c1c2c3.
c3.c2.c1
i.e. if c3c2c2 = 101, the error bit will be 5, and this bit needs to be flipped to get
the correct message

By: Er. Saurav Raj Pant, IOE - TU


Flow Control:
When a data frame is sent from one host to another over a single medium,
it is required that the sender and receiver should work at the same speed. That is,
sender sends at a speed on which the receiver can process and accept the data.
What if the speed (hardware/software) of the sender or receiver differs? If sender
is sending too fast the receiver may be overloaded and data might be lost.
Two mechanisms for flow control:
1. Stop and Wait protocol
2. Sliding window protocol

Stop and wait:


This flow control mechanism forces the sender after transmitting a
data frame to stop and wait until the acknowledgement of the data frame
is received. The problem with stop and wait is that only one frame can be
transmitted at a time, and that often leads to inefficient transmission
because until the sender receives the ACK it cannot transmit any new
packet. During this time both the sender and receiver are unutilized.

Fig: Stop and wait timeline


Normal Operation:

 Sender keeps a copy of the last frame until it receives an acknowledgement.


 For identification, both data frames and acknowledgements (ACK) frames are numbered
alternatively 0 and 1.
 Sender has a control variable (S) that holds the number of the recently sent frame. (0 or 1)

By: Er. Saurav Raj Pant, IOE - TU


 Receiver has a control variable R that holds the number of the next frame expected (0 or 1).
 Sender starts a timer when it sends a frame. If an ACK is not received within a allocated time
period, the sender assumes that the frame was lost or damaged and resends it.
 Receiver send only positive ACK if the frame is intact.
 ACK number always defines the number of next expected frame.

Stop and wait ARQ (Automatic Repeat Request):


For Lost Frame:

 When a receiver receives a damaged frame, it discards it and keeps its value of R.
 After the timer at the sender expires, another copy of frame 1 is sent.

For Lost ACK:

 If the sender receives a damaged ACK, it discards it.


 When the timer of the sender expires, the sender retransmits frame 1.

By: Er. Saurav Raj Pant, IOE - TU


 Receiver has already received frame 1 and expecting to receive frame 0 (R=0). Therefore
it discards the second copy of frame 1.

For Delayed ACK:

 The ACK can be delayed at the receiver or due to some problem


 It is received after the timer for frame 0 has expired.
 Sender retransmitted a copy of frame 0. However, R =1 means receiver expects
to see frame 1. Receiver discards the duplicate frame 0.
 Sender receives 2 ACKs, it discards the second ACK.

Piggybacking:

• A method to combine a data frame with ACK.

• Station A and B both have data to send.

• Instead of sending separately, station A sends a


data frame that includes an ACK.

• Station B does the same thing.

• Piggybacking saves bandwidth.

By: Er. Saurav Raj Pant, IOE - TU


Sliding Window:
In this flow control mechanism both sender and receiver agree on the
number of data frames called window after which the acknowledgement should
be sent. Sender slides its window on receiving the acknowledgements for the sent
frame. This allows the sender to send more frames. As we learned, stop and wait
flow control mechanism wastes resources. This protocol tries to make use of
underlying resources as much as possible.

1 2 3 4 5 6 1 2 3 4 5 6

a. Window of size four b. window after the acknowledgement


of frame 1 is received.
Fig: Sliding window
Go-Back-N ARQ:
In Go-Back-N ARQ, N is the sender's window size. Suppose we say that Go-Back-3,
which means that the three frames can be sent at a time before expecting the
acknowledgment from the receiver. The receiver window size is always 1.

It uses the principle of protocol pipelining in which the multiple frames can be
sent before receiving the acknowledgment of the first frame. If we have five
frames and the concept is Go-Back-3, which means that the three frames can be
sent, i.e., frame no 1, frame no 2, frame no 3 can be sent before expecting the
acknowledgment of frame no 1. If the acknowledgment of a frame is not received
within an agreed-upon time period, then all the frames available in the current
window will be retransmitted.

In Go-Back-N ARQ, the frames are numbered sequentially as Go-Back-N ARQ


sends the multiple frames at a time that requires the numbering approach to
distinguish the frame from another frame, and these numbers are known as the
sequential numbers.

 If the frames are corrupted or out of order it discards them.


 If the sender did not receive the ACK, it leads to the retransmission of all the current
window frames.

By: Er. Saurav Raj Pant, IOE - TU


Selective Repeat ARQ:

The Go-back-N ARQ protocol works well if it has fewer errors. But if there is
a lot of error in the frame, lots of bandwidth loss in sending the frames again. So,
we use the Selective Repeat ARQ protocol. In this protocol, the size of the sender
window is always equal to the size of the receiver window.
If the receiver receives a corrupt frame, it does not directly discard it. It
sends a negative acknowledgment to the sender. The sender sends that frame
again as soon as on the receiving negative acknowledgment. So unlike Go-Back-N
ARQ, instead of sending the whole frames after not receiving ACK of any frame
afterward, it only sends the frame whose Negative acknowledgement is received
by the sender.
As there could be frames out of order in the receiving side, it requires
sorting to sort the frames.

By: Er. Saurav Raj Pant, IOE - TU


By: Er. Saurav Raj Pant, IOE - TU
Pipelining and a Bad Frame
• Pipelining is the process of putting multiple frames on the connection without
receiving any acks for them. Assuming that they all arrive safely, it is much faster
than sending them with stop-and-wait.
• What happens when we get a bad frame?
• Go back N – Ask the sender to go back and start retransmitting from the lost
frame.
• Selective repeat – Ask the sender to repeat the particular frames that were lost.

By: Er. Saurav Raj Pant, IOE - TU


Data Link Layer Protocols:
1. HDLC 2. PPP
HDLC (High Data Link Control):
High-level Data Link Control (HDLC) is a group of communication protocols
of the data link layer for transmitting data between network points or nodes.
Since it is a data link protocol, data is organized into frames. A frame is
transmitted via the network to the destination that verifies its successful arrival. It
is a bit - oriented protocol that is applicable for both point - to - point and
multipoint communications.
To satisfy a variety of applications, HDLC defines three types of stations, two link
configurations, and three data transfer modes of operation.
The three station types are:
• Primary station: Responsible for controlling the operation of the link. Frames
issued by the primary are called commands.
• Secondary station: Operates under the control of the primary station. Frames
issued by a secondary are called responses. The primary maintains a separate
logical link with each secondary station on the line.
• Combined station: Combines the features of primary and secondary. A
combined station may issue both commands and responses.
The two link configurations are:
• Unbalanced configuration: Consists of one primary and one or more secondary
stations and supports both full-duplex and half-duplex transmission.
• Balanced configuration: Consists of two combined stations and supports both
full-duplex and half-duplex transmission.
The three data transfer modes are:
• Normal response mode (NRM): Used with an unbalanced configuration. The
primary may initiate data transfer to a secondary, but a secondary may only
transmit data in response to a command from the primary.

By: Er. Saurav Raj Pant, IOE - TU


• Asynchronous balanced mode (ABM): Used with a balanced configuration.
Either combined station may initiate transmission without receiving permission
from the other combined station.
• Asynchronous response mode (ARM): Used with an unbalanced configuration.
The secondary may initiate transmission without explicit permission of the
primary. The primary still retains responsibility for the line, including initialization,
error recovery, and logical disconnection.
Frame Structure:
HDLC is a bit oriented protocol where each frame contains up to six fields. The
structure varies according to the type of frame. The fields of HDLC frame are:
1. Flag: it is an 8-bit sequence that makes the beginning and end of the frame.
The bit pattern of the flag is 01111110.
2. Address: it contains address of the receiver. The address field consists of 8-
bit. Hence it is capable of addressing 256 addresses. By default it is
11111111 to indicate that all stations are to accept the frame.
3. Control: it is 8-bit or 16-bit field. HDLC generally uses this field to determine
how to control process of communication. The control field is different for
different types of frames in HDLC protocol. The types of frames can be
Information frame (I-frame), Supervisory frame (S-frame), and
Unnumbered frame (U-frame).
4. Information field: this carries data from the network layer. Its length may
vary from one network to another. This field is absent for s-frames.
5. FCS (Frame Check Sequence): 16-bit field used for detecting of errors in the
address, control and information field. It is nothing else but a 16-bit CRC
code for error detection.

By: Er. Saurav Raj Pant, IOE - TU


 Information Frame (I-Frame) is supposed to carry user information
(Data) from the network layer.
 Supervisory Frame (s-Frame) does not contain any information field;
these frames are used for flow and error control
 Unnumbered Frames (U-Frame) are used for exchanging the session
(link) management and control information between communicating
devices.

Operation:
HDLC operation consists of the exchange of I-frames, S-frames, and U-
frames between two stations. The operation of HDLC involves three phases. First,
one side or another initializes the data link so that frames may be exchanged in an
orderly fashion. During this phase, the options that are to be used are agreed
upon. After initialization, the two sides exchange user data and the control

By: Er. Saurav Raj Pant, IOE - TU


information to exercise flow and error control. Finally, one of the two sides signals
the termination of the operation.

PPP (Point-to-Point Protocol) :


PPP is a communication protocol of the data link layer that is used to transmit
data between two directly connect nodes (routers or PCs) with a link. It is a byte-
oriented protocol that is widely used in broadband communications having heavy
loads and high speeds. Since it is a data link layer protocol, data is transmitted in
frames.
Frame Format:

Flag Field: It marks the beginning and end of the PPP frame. Flag byte is
01111110.
Address: always 11111111, which means all stations can accept the frame.
Control Field: It is also of 1 byte. The value is always 00000011 to show that the
frame does not contain any sequence number and there is no flow control or
error control.
Protocol field: tells what kind of packet is in payload. Codes stating with 0’s are
for IPv4, IPv6, IPX etc. and codes stating with 1’s are for PPP configuration
protocols such as LCP and NCP.
Payload Field: Its length is variable. It carries user data or other information.
FCS Field: It stands for Frame Check Sequence. It contains checksum. It is either 2
bytes or 4 bytes.

PPP uses several other protocols to establish link, authenticate users and to carry
the network layer data:

By: Er. Saurav Raj Pant, IOE - TU


Link Control Protocol (LCP):
 LCP helps to establish, configure and maintain a connection.
 Authentication, error detection and link termination (if not needed) is
also performed by the LCP.
Authentication Protocol:
Authentication protocol helps to validate the identity of a user who needs
to access the resources. Two authentication protocols are PAP (Password
Authentication Protocol) and CHAP (Challenge Handshake Authentication
Protocol).
 In PAP, any router who wants to send its frame to next router will send
its username and password to the receiving router. If the username and
password match to the configuration of receiving router, the sending
router is authenticated. No encryption in PAP.
 In CHAP, both the routers will have same password configured initially. If
router A wants to authenticate router B, it will simply send a random
number to the router B. When router B receives the random value, it
will combine the received random number with the password and put it
through the MD5 hashing algorithm. This hash value will be sent back to
the router A. The router A would also do the same thing, and generate
the hash value. If this hash value is matched with the one it received
from router B, the router B is authenticated.

Random no.

Password Hash Password

Network Control Protocols (NCPs):

 These protocols are used for negotiating the parameters and


facilities for the network layer.
 Therefore, NCP is a set of control protocols that allow the
encapsulation of the data coming from the network layer.
By: Er. Saurav Raj Pant, IOE - TU
 After the network layer configuration is done by one of the NCP, the
user can exchange data from the network layer.
 For example, if the layer 3 is running in IP, the NCP available for IP
is IPCP (IP control Protocol) that will be used to negotiate sending IP
within PPP frames.

The Medium Access Control (MAC) sub-layer:


The data link layer can be divided into two sub-layers as per the IEEE
standard i.e. logical link control (LLC) and Medium Access Control (MAC) sub
layer.

LLC provides flow control, acknowledgement and error control. The LLC sub-
layer acts as an interface between the medium access control sub-layer and the
network layer.
The main functions of MAC sub-layer are:

 Addressing the End devices using physical address (MAC address)


 It performs multiple access resolutions when more than one station
is sending a data frame.
 It also performs collision resolutions and initiating retransmission in
case of collision.

By: Er. Saurav Raj Pant, IOE - TU


MAC Address:
MAC address is an unique identifier given to the Network Interface
Controller (NIC) of a device. It is also called as physical address or hardware
address. It is used as a network address for data transmission within a network
segment like Ethernet, wifi and Bluetooth. A MAC is of 48 bits that comprises six
groups of two hexadecimal digits separated by colons or hyphens or no separator.
Example:
00:A0:2A:BC:03:0F
upper 3 byte represents the OUI (Organization Unique Identifier) also
called as manufacturer ID and lower 3 byte represents the Device ID.

The Channel Allocation Problem:

 In broadcast networks, single channel is shared by several stations.


 This channel can be allocated to only one transmitting user at a time.
 There are two different methods of channel Allocations:
o Static Channel Allocation
o Dynamic Channel Allocation
Static Channel Allocation:
• In this method, a single channel is divided among various users either on the
basis of frequency or on the basis of time.
• It either uses FDM (Frequency Division Multiplexing) or TDM (Time Division
Multiplexing).
• In FDM, fixed frequency is assigned to each user, whereas, in TDM, fixed time
slot is assigned to each user.
Dynamic Channel Allocation:
• In this method, no user is assigned fixed frequency or fixed time slot.
• All users are dynamically assigned frequency or time slot, depending upon the
requirements of the user.

By: Er. Saurav Raj Pant, IOE - TU


Assumptions for Dynamic Channel Allocation
1. Independent traffic: independent stations
2. Single channel: available for all communication. All stations can
transmit/receive on/from it. The stations are equally capable.
3. Observable Collisions: All stations can detect a collision.
4. Continuous or slotted time (for transmission)
5. Carrier sense or no carrier sense: With carrier sense, stations can tell if the
channel is in use before trying to use it.

Multiple Access Protocols:


• Distributed algorithm that determines how nodes share channel, i.e., determine
when node can transmit

Random Access Protocols :


• In this method, there is no control station.
• Any station can send the data.

By: Er. Saurav Raj Pant, IOE - TU


• There is no scheduled time for a stations to transmit. They can transmit in
random order.
• The various random access methods are:

 ALOHA
 CSMA (Carrier Sense Multiple Access)
 CSMA/CD (Carrier Sense Multiple Access with Collision Detection)
 CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance)
ALOHA:
• Any terminal is allowed to transmit without considering whether channel is idle
or busy
• If packet is received correctly, the base station transmits an acknowledgement.
• If no acknowledgement is received,
it assumes the packet to be lost
it retransmits the packet after waiting a random time
There are two different versions of ALOHA:
Pure ALOHA
Slotted ALOHA
Pure ALOHA:

 In pure ALOHA, stations transmit frames whenever they have data to send.
 When two stations transmit simultaneously, there is collision and frames
are lost.
 In pure ALOHA, whenever any station transmits a frame, it expects an
acknowledgement from the receiver.
 If acknowledgement is not received within specified time, the station
assumes that the frame has been lost.
 If the frame is lost, station waits for a random amount of time and sends it
again.
 This waiting time must be random, otherwise, same frames will collide
again and again.

By: Er. Saurav Raj Pant, IOE - TU


 Whenever two frames try to occupy the channel at the same time, there
will be collision and both the frames will be lost.
 If first bit of a new frame overlaps with the last bit of a frame almost
finished, both frames will be lost and both will have to be retransmitted.

Fig: In pure ALOHA, frames are transmitted at completely arbitrary


time.

Slotted ALOHA:

 Slotted ALOHA was invented to improve the efficiency of pure ALOHA.


 In slotted ALOHA, time of the channel is divided into intervals called slots.
 The station can send a frame only at the beginning of the slot and only one
frame is sent in each slot.
 If any station is not able to place the frame onto the channel at the
beginning of the slot, it has to wait until the next time slot.
 There is still a possibility of collision if two stations try to send at the
beginning of the same time slot.

By: Er. Saurav Raj Pant, IOE - TU


CSMA (Carrier Sense Multiple Access):
 CSMA was developed to overcome the problems of ALOHA i.e. to minimize
the chances of collision.
 Based on the principle "sense before transmit" or "listen before talk."
 Node verifies the absence of other traffic before transmitting on a shared
transmission medium
 Multiple access means that multiple stations send and receive on the
medium
 Each station first listens to the medium before Sending.
 The chances of collision still exist because of propagation delay.

By: Er. Saurav Raj Pant, IOE - TU


There are three different types of CSMA protocols:
1. 1-Persistent CSMA
2. Non-Persistent CSMA
3. P-Persistent CSMA
1-Persistent CSMA

 In this method, station that wants to transmit data continuously senses the
channel to check whether the channel is idle or busy.
 If the channel is busy, station waits until it becomes idle.
 When the station detects an idle channel, it immediately transmits the
frame.
 This method has the highest chance of collision because two or more
stations may find channel to be idle at the same time and transmit their
frames.
 More subtly, the propagation delay has an important effect on collisions.
There is a chance that just after a station begins sending, another station
will become ready to send and sense the channel. If the first station’s signal
has not yet reached the second one, the latter will sense an idle channel
and will also begin sending, resulting in a collision.
 The protocol is called 1-persistent because the station transmits with a
probability of 1 when it finds the channel idle.

Non-Persistent CSMA

 A station that has a frame to send senses the channel.


 If the channel is idle, it sends immediately.
 If the channel is busy, it waits a random amount of time and then senses
the channel again.
 It reduces the chance of collision because the stations wait for a random
amount of time.
 It is unlikely that two or more stations will wait for the same amount of
time and will retransmit at the same time.

By: Er. Saurav Raj Pant, IOE - TU


P-Persistent CSMA

 In this method, it has slotted channels.


 When a station is ready to send, it senses the channel.
 If the channel is busy, station waits until next slot.
 When the channel becomes idle, the station transmits the frame with a
probability p.
 With a probability ( 1 – p ), the channel waits for next time slot. If the next
time slot is idle, it again transmits with a probability p and waits with a
probability ( 1 – p ).
 The station repeats this process until either frame has been transmitted or
another station has begun transmitting.
 If another station begins transmitting, the station waits for a random
amount of time and restarts the algorithm.

CSMA/CD
Half Duplex
 CSMA with Collision Detection
 In this protocol, the station senses the channel before transmitting the
frame. If the channel is busy, the station waits.
 Additional feature in CSMA/CD is that the stations can detect collisions.
 The stations abort their transmission as soon as they detect collision.
 In CSMA/CD, the station that sends its data on the channel continues to
sense the channel even after data transmission.
 If collision is detected, the station aborts its transmission and waits for a
random amount of time & sends its data again.
 As soon as a collision is detected, the transmitting station releases a jam
signal.
 Jam signal alerts other stations. Stations are not supposed to transmit
immediately after the collision has occurred.

By: Er. Saurav Raj Pant, IOE - TU


CSMA/CA Full Duplex
 CSMA with Collision Avoidance
 This protocol is used in wireless networks because they cannot detect the
collision.
 So, the only solution is collision avoidance.

By: Er. Saurav Raj Pant, IOE - TU


 It avoids the collision by using three basic techniques:
o Inter-frame Space
o Contention Window
o Acknowledgements
Interframe Space

 Whenever the channel is found idle, the station does not transmit
immediately.
 It waits for a period of time called Interframe Space (IFS).
 When channel is sensed idle, it may be possible that some distant station
may have already started transmitting.
 Therefore, the purpose of IFS time is to allow this transmitted signal to
reach its destination.
 If after this IFS time, channel is still idle, the station can send the frames.
Contention Window

 Contention window is the amount of time divided into slots.


 Station that is ready to send chooses a random number of slots as its
waiting time.
 The number of slots in the window changes with time.
Acknowledgment
Despite all the precautions, collisions may occur and destroy the data.
Positive acknowledgement and the time-out timer help guarantee that the
receiver has received the frame.

By: Er. Saurav Raj Pant, IOE - TU


By: Er. Saurav Raj Pant, IOE - TU
Ethernet (IEEE 802.3)

 Ethernet has been a relatively inexpensive, reasonably fast, and very


popular LAN technology for several decades.
 Ethernet uses the CSMA/CD access method to handle simultaneous
demands.
 The most commonly installed Ethernet systems are called 10BASE-T and
provide transmission speeds up to 10 Mbps.
 Fast Ethernet or 100BASE-T provides transmission speeds up to 100
megabits per second.

Fig: Ethernet frame format according to IEEE 802.3 standard

 The Preamble - This consists of seven bytes, all of the form "10101010".
This allows the receiver's clock to be synchronized with the sender's.
 The Start Frame Delimiter - This is a single byte ("10101011") which is used
to indicate the start of a frame.
 The Destination Address - This is the address of the intended recipient of
the frame. The addresses in 802.3 use globally unique hardwired 48 bit
addresses.
 The Source Address - This is the address of the source, in the same form as
above.
 The Length - This is the length of the data in the Ethernet frame, which can
be anything from 0 to 1500 bytes.
 Data - This is the information being sent by the frame. Padding is
performed to make a minimum size of the frame to 64 bytes.
 Checksum - This is used for error detection and recovery.

By: Er. Saurav Raj Pant, IOE - TU


VLAN (Virtual LAN):

 VLANs are used to divide a physical LAN into multiple broadcast domains
(logically) to isolate services with the aim of improving the security and
management of the network.
 Hosts within a VLAN can directly communicate only with other hosts in
the same VLAN and must use a router to communicate with hosts in
other VLANs.
 Broadcast frames will only be switched to the same VLAN.
 Unlike other LAN types, which physically connect computers to LAN
segments, VLANs assign computers to LAN segments by software.

Fig: VLAN implementation and trunking for transmitting frames


from one VLAN to another

VLAN provides following advantages:-

 Solve broadcast problem


 Reduce the size of broadcast domains
 Allow us to add additional layer of security
 Make device management easier
 Allow us to implement the logical grouping of devices by function instead of
location

By: Er. Saurav Raj Pant, IOE - TU


Fig: connecting two VLANs switches with two VLANs
(a) two cables (b) trunked

 The IEEE has defined an extended Ethernet frame format, 802.1Q, for
frames crossing a VLAN trunk. The 802.1Q frame consists of the
standard Ethernet frame with a four-byte VLAN tag added into the
header that carries the identity of the VLAN to which the frame belongs.
IEEE 802.4 (Token Bus):

 802.3 suffered difficulty and gave poor performance under heavy load.
 Token passing protocols were proposed and were found to be very
attractive for situations with heavy load.
 The basic idea is to generate a token in the network.
 A token is a small message that circulates among the stations of a computer
network providing permission to the stations for transmission.
 If a station has data to transmit when it receives a token, it sends the data
and then passes the token to the next station; otherwise, it simply passes
the token to the next station.

By: Er. Saurav Raj Pant, IOE - TU


 Thus with one token, only one station can transmit at a time, eliminating
collisions totally.

Frame Structure:

 Preamble: 1 byte for synchronization.


 Start Delimiter: 1 byte that marks the beginning of the frame.
 Frame Control: 1 byte that specifies whether this is a data frame or control
frame.
 Destination Address: 2-6 bytes that specifies address of destination station.
 Source Address: 2-6 bytes that specifies address of source station.
 Payload: A variable length field that carries the data from the network
layer.
 Checksum: 4 bytes frame check sequence for error detection.
 End Delimiter: 1 byte that marks the end of the frame.

By: Er. Saurav Raj Pant, IOE - TU


IEEE 802.5 (Token Ring):

 In token ring, a physical ring is formed by using point to point links.


 Rings can be based on twisted pair, coaxial or a fiber optics cable.
 Channel access problem is solved with the help of a special frame called a
“Token”.
 A free token circulates the ring when all stations are idle.
 A station wishing to transmit must wait until it detects a free token passing
by.
 It then seizes the token by changing the token bit to transform it into the
start-of-frame sequence for a data frame.
 The data to be transmitted is then inserted into the payload section of the
frame..
 The frame on the ring will make a round trip and then removed by the
transmitting station.

 If a station fails, entire architecture will fail. To avoid this bypass relays
are used. If a station is powered down the relays close thereby removing
the station from the ring and maintaining the ring.

Fig: Token Ring Architecture

By: Er. Saurav Raj Pant, IOE - TU


Frame Format:

 The starting and ending delimiter fields mark the beginning and ending of
the frame.
 The access control byte contains the token bit, and also the monitoring bit,
priority bits and reservation bits.
 The frame control byte, distinguishes data frames from various possible
control frames.
 The frame status byte contains A and C bits.
A C Significance
0 0 Destination not present or not powered up
1 0 Destination present but frame not accepted
1 1 Destination present and frame copied.

FDDI (Fiber Distributed Data Interface):

 FDDI specifies a 100-Mbps, token-passing, dual-ring LAN using a fiber-optic


transmission medium.
 Although it operates at faster speeds, FDDI is similar in many ways to Token
Ring. The two networks similar features like topology (ring) and media-
access technique (token passing).
 An unbroken FDDI network can run to 100km with nodes being up to 2km
apart on multi-mode fiber (62.5/125um), and 10km apart on single-mode
fiber.

By: Er. Saurav Raj Pant, IOE - TU


 FDDI uses dual counter-rotating rings (called the primary and secondary).
Data normally travels on the primary ring. Secondary ring is for backup.
 Stations can be attached to the primary ring as single attachment stations
(SAS) or both rings as dual attachment stations (DAS).

Fig: FDDI network Architecture

Fig: Optical cable topology for an FDDI local area network.

By: Er. Saurav Raj Pant, IOE - TU


Fault Tolerance:

 An important feature of FDDI is its ability to handle a breaks in the network


by forming a single temporary ring out of the pieces of the primary and
secondary rings.
 Once the stations detect the break, traffic is rerouted through a new ring
formed out of the parts of the primary and secondary rings not affected by
the break.
 The network then operates over this temporary ring until the break can be
repaired.

Fig: Managing a broken link


FDDI Token Passing:
Token passing on an FDDI network works much the way it does on a Token Ring
network, that is, nodes pass a token around the ring, and only the node with the
token is allowed to transmit a frame. Frames are sent by the station until all data
has been sent or until the Token Holding Timer (THT) expires. All nodes read the
frame as it passes around the ring to determine if they are the recipients of the
frame. If they are, they extract the data and retransmit the frame to the next
station on the ring. When the frame returns to the originating station, the
originating station removes the frame. The token-access control scheme thus
allows all stations to share the network bandwidth in an orderly and efficient
manner.

By: Er. Saurav Raj Pant, IOE - TU


FDDI Frame:

Preamble: used to synchronize the individual clocks on the ring since there is no
master clock in FDDI.
Starting delimiter: 1 byte that marks the beginning of the frame.
Frame control: 1 byte that specifies whether this is a data frame or control frame.
Destination address: 6 bytes that specifies address of destination station.
Source address: 6 bytes that specifies address of source station.
Info (Data): A variable length field that carries the data from the network layer.
FCS: 4 bytes frame check sequence for error detection.
Ending delimiter: 1 byte that marks the end of the frame.
Frame status: has the Address Recognized (A) and Frame Copied (C) and Error (E)
indicators which are either Set (S symbol) or Reset (R symbol).

IEEE 802.11: Wireless LANs

 Wireless LANs provide high speed data communication in small areas such
as building or an office. WLANs allow users to move around in a confined
area while they are still connected to the network
 Use CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance)
 A station wishing to transmit shall first sense the medium.
 If the medium is busy, the station shall defer until the end of the current
transmission.
 After deferrals, the station shall select a random back off interval and shall
decrement the back off interval counter while the medium is idle.
By: Er. Saurav Raj Pant, IOE - TU
 If the medium is idle, after any deferrals or back offs, prior to data
transmission, RTS/CTS short frames are exchanged. (optional mechanism)

802.11b Standard

 Operate at 2.4 GHz range


 Throughput up to 11 Mbit/s using the same 2.4GHz band (Theoretically)
 Use DSSS Modulation Techniques
 802.11b devices suffer interference from other products operating in the
2.4 GHz band
o microwave ovens, Bluetooth, cordless phone
 Maximum 14 channels
o 11 channels (1-11) are allowed to use
o 3 non overlapping channels 1, 6, 11

802.11a Standard:

 Runs in the 5 GHz range, so less interference from other devices.


 Has up to 23 non overlapping channels and supports rates from 6 to 54
Mbps, but realistically about 27 Mbps max.
 Uses OFDM (Orthogonal Frequency Division Multiplexing)
802.11g Standard:

 Extension of 802.11b
 Extended throughput up to 54 Mbit/s.
 Using the same 2.4 GHz band as 802.11b.
 802.11g hardware is fully backwards compatible with 802.11b hardware.
 Uses OFDM

By: Er. Saurav Raj Pant, IOE - TU


802.11n Standard:

 RF Band (GHz) 2.4 or 5.


 Maximum data rate from 54 Mbit/s to 600 Mbit/s.
 Use OFDM and MIMO technologies.
 SU-MIMO (single user multiple input multiple output) is used.
802.11ac standard: (wifi 5)
 RF Band (GHz) 5.
 2014
 affording easy migration from IEEE 802.11n, which also uses 5 GHz band.
 Maximum data rate upto 7 Gbps.
 Shorter range as it uses 5 GHz frequency band but faster transmission.
 Uses OFDM and MU-MIMO (multiuser multiple input multiple output).
 MU-MIMO allows the Access Point to form beams towards each Clients
while transmitting information at the same time.
 MU-MIMO available in downlink direction.
802.11ax standard: (wifi 6)

 2019
 2.4 and 5 GHz
 Wifi 6E uses 6GHz
 MU-MIMO available in downlink and uplink direction.
 Uses OFDMA.

Note: In OFDM all subcarriers of the symbol are used for providing data to a
specific user whereas in OFDMA the sub-carriers of each symbol can be divided
into multiple users thus enabling better use of radio resources.

By: Er. Saurav Raj Pant, IOE - TU


By: Er. Saurav Raj Pant, IOE - TU

You might also like