Untitled

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 198

KCA-303

COMPUTER NETWORKS

(https://www.javatpoint.com/multiple-access-protocols)

INTRODUCTION

The main objective of data communication and networking is to enable seamless


(continuous) exchange of data between any two systems in the world. This
exchange of data takes place over a computer network.

DATA & INFORMATION

Data refers to the raw facts that are collected while information refers to processed
data that enables us to take decisions.

Ex. When result of a particular test is declared it contains data of all students, when
you find the marks you have scored you have the information that lets you know
whether you have passed or failed.

DATA COMMUNICATION

Data Communication is a process of exchanging data or information. In case of


computer networks this exchange is done between two devices over a transmission
medium.

This process involves a communication system which is made up of hardware and


software.

The hardware part involves the sender and receiver devices and the intermediate
devices through which the data passes.

The software part involves certain rules which specify what is to be communicated,
how it is to be communicated and when. It is also called as a Protocol.

CHARACTERISTICS OF DATA COMMUNICATION

The effectiveness of any data communications system depends upon the following
four fundamental characteristics:

1. Delivery: The data should be delivered to the correct destination and correct
user.
2. Accuracy: The communication system should deliver the data accurately,
without introducing any errors. The data may get corrupted during
transmission affecting the accuracy of the delivered data.
3. Timeliness: Audio and Video data has to be delivered in a timely manner
without any delay; such a data delivery is called real time transmission of
data.
4. Jitter (a small irregular movement): It is the variation in the packet arrival
time. Uneven (Irregular) Jitter may affect the timeliness of data being
transmitted.

COMPONENTS OF DATA COMMUNICATION

A Data Communication system has five components as shown in the diagram


below:

1. Message
Message is the information to be communicated by the sender to the
receiver.
2. Sender
The sender is any device that is capable of sending the data (message).
3. Receiver
The receiver is a device that the sender wants to communicate the data
(message).
4. Transmission Medium
It is the path by which the message travels from sender to receiver. It can be
wired or wireless and many subtypes in both.
5. Protocol
1. It is an agreed upon set of rules used by the sender and receiver to
communicate data.
2. A protocol is a set of rules that governs data communication.
3. A Protocol is a necessity in data communications without which the
communicating entities are like two persons trying to talk to each other in a
different language without know the other language.

DATA REPRESENTATION

Data is collection of raw facts which is processed to get information.

There may be different forms in which data may be represented. Some of the forms
of data used in communications are as follows:

1. Text: Text includes combination of alphabets in small case as well as upper


case. It is stored as a pattern of bits. Common encoding system: ASCII, Unicode

ASCII - American Standard Code for Information Interexchange - assigns


letters, numbers, characters, and symbols a slot in the 256 available slots in
the 8-bit code.

Unicode is a universal character encoding standard that assigns a code to


every character and symbol in every language in the world.

2. Numbers: Numbers include combination of digits from 0 to 9. It is stored as a


pattern of bits. Prevalent encoding system: ASCII, Unicode

3. Images: An image is worth a thousand words‖ is a very famous saying. In


computers images are digitally stored.

A Pixel is the smallest element of an image. To put it in simple terms, a picture or


image is a matrix of pixel elements.

The pixels are represented in the form of bits. Depending upon the type of image
(black n white or color) each pixel would require different number of bits to
represent the value of a pixel.

The size of an image depends upon the number of pixels (also called resolution)
and the bit pattern used to indicate the value of each pixel.

Example: if an image is purely black and white (two color) each pixel can be
represented by a value either 0 or 1, so an image made up of 10 x 10 pixel elements
would require only 100 bits in memory to be stored.

L=2K

Where L is the no. of gray-levels and k is the no. of bit/pixel


On the other hand an image that includes gray level 4 may require 2 bits to
represent every pixel value (00 - black, 01 – dark gray, 10 – light gray, 11 –white).
So the same 10 x 10 pixel image would now require 200 bits of memory to be
stored.

Commonly used Image formats: jpg, png, bmp, etc

4. Audio: Data can also be in the form of sound which can be recorded and
broadcasted. Example: What we hear on the radio is a source of data or
information. Audio data is continuous, not discrete.

5. Video: Video refers to broadcasting of data in form of picture or movie

DATA FLOW

Devices communicate with each other by sending and receiving data. The data can
flow between the two devices in the following ways.

1. Simplex

2. Half Duplex

3. Full Duplex

1. Simplex

Figure: Simplex mode of communication

 In Simplex, communication is unidirectional


 Only one of the devices sends the data and the other one only receives
the data.
 Example: in the above diagram: a CpU send data while a monitor only
receives data.
2. Half Duplex

Figure: Half Duplex Mode of Communication

 In half duplex both the stations can transmit as well as receive but not at the
same time.
 When one device is sending other can only receive and viceversa (as shown
in figure above.)
 Example: A walkie-talkie.

3. Full Duplex

Figure: Full Duplex Mode of Communication

 In Full duplex mode, both stations can transmit and receive at the same
time.
 Example: mobile phones
COMPUTER NETWORK

Computer Networks are used for data communications

Definition: A computer network can be defined as a collection of nodes. A node


can be any device capable of transmitting or receiving data. The communicating
nodes have to be connected by communication links.

 A Compute network should ensure reliability of the data communication


process
 security of the data
 performance by achieving higher throughput and smaller delay times

CATEGORIES OF NETWORK

Networks are categorized on the basis of their size. The three basic categories of
computer networks are:

 Local Area Networks (LAN)


 Local area network is a group of computers connected with each other
in a small places such as school, hospital, apartment etc.
 LAN is secure because there is no outside connection with the local
area network thus the data which is shared is safe on the local area
network and can’t be accessed outside.
 LAN due to their small size are considerably faster, their speed can
range anywhere from 10 to 100 Mbps.
 LANs are not limited to wire connection; there is a new evolution to
the LANs that allows local area network to work on a wireless
connection. is usually limited to a few kilometers of area. It may be
privately owned and could be a network inside an office on one of the
floor of a building or a LAN could be a network consisting of the
computers in a entire building.
 Metropolitan Area Network (MAN)
A. MAN network covers larger area by connections LANs to a larger network
of computers.
B. In Metropolitan area network various Local area networks are connected
with each other through telephone lines.
C. The size of the Metropolitan area network is larger than LANs and smaller
than WANs(wide area networks),
D. A MANs covers the larger area of a city or town.

C. Wide Area Network (WAN)

 Wide area network provides long distance transmission of data.


 The size of the WAN is larger than LAN and MAN.
 A WAN can cover country, continent or even a whole world. Internet
connection is an example of WAN.
 Other examples of WAN are mobile broadband connections such as
3G, 4G etc.
Computer Network Topology
Geometric representation of how the computers are connected to each other is
known as topology. There are five types of topology in computer networks:

Mesh Topology

In mesh topology each device is connected to every other device on the network
through a dedicated point-to-point link. When we say dedicated it means that the
link only carries data for the two connected devices only.

Lets say we have n devices in the network then each device must be connected
with (n-1) devices of the network. Number of links in a mesh topology of n devices
would be n(n-1)/2.

Advantages of Mesh topology


1. No data traffic issues as there is a dedicated link between two devices which
means the link is only available for those two devices.
2. Mesh topology is reliable and robust as failure of one link doesn’t affect other
links and the communication between other devices on the network.
3. Mesh topology is secure because there is a point to point link thus unauthorized
access is not possible.
4. Fault detection is easy.

Disadvantages of Mesh topology

1. Amount of wires required to connected each system is tedious and headache.


2. Since each device needs to be connected with other devices, number of I/O ports
required must be huge.
3. Scalability issues because a device cannot be connected with large number of
devices with a dedicated point to point link.

Star Topology

In star topology each device in the network is connected to a central device called
hub. Unlike Mesh topology, star topology doesn’t allow direct communication
between devices, a device must have to communicate through hub. If one device
wants to send data to other device, it has to first send the data to hub and then the
hub transmit that data to the designated device.

Advantages of Star topology

1. Less expensive because each device only need one I/O port and needs to be
connected with hub with one link.
2. Easier to install
3. Less amount of cables required because each device needs to be connected with
the hub only.
4. Robust, if one link fails, other links will work just fine.
5. Easy fault detection because the link can be easily identified.

Disadvantages of Star topology

1. If hub goes down everything goes down, none of the devices can work without
hub.
2. Hub requires more resources and regular maintenance because it is the central
system of star topology.

Bus Topology

In bus topology there is a main cable and all the devices are connected to this main
cable through drop lines. There is a device called tap that connects the drop line to
the main cable. Since all the data is transmitted over the main cable, there is a limit
of drop lines and the distance a main cable can have.

Advantages of bus topology

1. Easy installation, each cable needs to be connected with backbone cable.


2. Less cables required than Mesh and star topology

Disadvantages of bus topology

1. Difficultly in fault detection.


2. Not scalable as there is a limit of how many nodes you can connect with
backbone cable.

Ring Topology
In ring topology each device is connected with the two devices on either side of it.
There are two dedicated point to point links a device has with the devices on the
either side of it. This structure forms a ring thus it is known as ring topology. If a
device wants to send data to another device then it sends the data in one direction,
each device in ring topology has a repeater, if the received data is intended for
other device then repeater forwards this data until the intended device receives it.

Advantages of Ring Topology

1. Easy to install.
2. Managing is easier as to add or remove a device from the topology only two
links are required to be changed.

Disadvantages of Ring Topology

1. A link failure can fail the entire network as the signal will not travel forward due
to failure.
2. Data traffic issues, since all the data is circulating in a ring.

Hybrid topology

A combination of two or more topology is known as hybrid topology. For example


a combination of star and ring topology is known as hybrid topology.
Advantages of Hybrid topology

1. We can choose the topology based on the requirement for example, scalability is
our concern then we can use star topology instead of bus technology.
2. Scalable as we can further connect other computer networks with the existing
networks with different topologies.

Disadvantages of Hybrid topology

1. Fault detection is difficult.


2. Installation is difficult.
3. Design is complex so maintenance is high thus expensive.

PROTOCOLS & STANDARDS

PROTOCOL
1. A Protocol is one of the components of a data communications system.
Without protocol communication cannot occur. The sending device cannot
just send the data and expect the receiving device to receive and further
interpret it correctly.
2. When the sender sends a message it may consist of text, number, images,
etc. which are converted into bits and grouped into blocks to be transmitted
and often certain additional information called control information is also
added to help the receiver interpret the data.
3. For successful communication to occur, the sender and receiver must agree
upon certain rules called protocol.
4. A Protocol is defined as a set of rules that governs data communications.
5. A protocol defines what is to be communicated, how it is to be
communicated and when it is to be communicated.

Key Elements of protocols


The key elements of the protocol determine what to be communicated, how it is
communicated, and when it is communicated.

There are mainly three key elements of a protocol, they are as follows:

 Syntax
 Semantics
 Timing
Let's learn these elements in detail:
Syntax

Syntax refers to the structure or format of data and signal levels. It indicates how
to read the data in the form of bits or fields.

It also decides the order in which the data is presented to the receiver.

Example: A protocol might expect that the size of a data packet will be 16 bits.
In which, the first 4 bits are the sender’s address, the next 4 bits are the receiver’s
address, the next 4 bits are the check-sum bits, and the last 4 bits will contain the
message. So, every communication that is following that protocol should send 16-
bit data.

Semantics

Semantics refers to the interpretation or meaning of each section of bits or fields.


It specifies which field defines what action. It defines how a particular section of
bits or pattern can be interpreted, and what action needs to be taken. It includes
control information for coordination and error handling.

Example: It interprets whether the bits of address identify the route to be taken or
the final destination of the message or something else.

Timing

Timing refers to two characteristics:

 When the data should be sent?


 What will be the speed of sending and receiving the data?
It performs speed matching, sequencing and flow control of the data items.

Example: A sender can send the data at a speed of 100 Mbps, but the receiver
can consume it only at a speed of 20 Mbps, then there may be data losses or the
packets might get dropped. So, proper synchronization must be there between a
sender and a receiver.

Standards: 
Standards are the set of rules for data communication that are needed for
exchange of information among devices. It is important to follow Standards
which are created by various Standard Organization like IEEE , ISO , ANSI etc.
Types of Standards :
Standards are of two types :
1. De Facto Standard.
2. De Jure  Standard.

De Facto Standard:  The meaning of the work ” De Facto ”   is ” By Fact ”  or


“By Convention”.
These are the standard s that have not been approved by any Organization, but
have been adopted as Standards because of its widespread use. Also, sometimes
these standards are often established by Manufacturers.

For example:   Apple and Google are two companies which established their
own rules on their products which are different. Also they use some same
standard rules for manufacturing for their products.

De Jure Standard:  The meaning of the word “De Jure” is “By Law” or “By


Regulations”. 
Thus, these are the standards that have been approved by officially recognized
body like ANSI, ISO, IEEE etc. These are the standard which are important to
follow if it is required or needed.

For example :  All the data communication standard  protocols like SMTP , TCP
, IP , UDP etc. are important to follow the same when we needed them. 

https://www.geeksforgeeks.org/layers-of-osi-model/

Layers of OSI Model


OSI stands for Open Systems Interconnection. It has been developed by ISO–
‘International Organization of Standardization ‘, in the year 1984.

It is a 7-layer architecture with each layer having specific functionality to perform.


All these 7 layers work collaboratively to transmit the data from one person to
another across the globe. 
 
1. Physical Layer (Layer 1) :
The lowest layer of the OSI reference model is the physical layer. It is responsible
for the actual physical connection between the devices. The physical layer contains
information in the form of bits. It is responsible for transmitting individual bits
from one node to the next. When receiving data, this layer will get the signal
received and convert it into 0s and 1s and send them to the Data Link layer, which
will put the frame back together. 

The functions of the physical layer are :  


 Bit synchronization: The physical layer provides the synchronization of the
bits by providing a clock. This clock controls both sender and receiver thus
providing synchronization at bit level.
 Bit rate control: The Physical layer also defines the transmission rate i.e. the
number of bits sent per second.
 Physical topologies: Physical layer specifies the way in which the different,
devices/nodes are arranged in a network i.e. bus, star or mesh topology.
 Transmission mode: Physical layer also defines the way in which the data
flows between the two connected devices. The various transmission modes
possible are: Simplex, half-duplex and full-duplex.

* Hub, Repeater, Modem, Cables are Physical Layer devices. 


** Network Layer, Data Link Layer and Physical Layer are also known as Lower
Layers or Hardware Layers. 
 
2. Data Link Layer (DLL) (Layer 2) :
1. The data link layer is responsible for the node to node delivery of the
message. The main function of this layer is to make sure data transfer is
error-free from one node to another, over the physical layer. When a packet
arrives in a network, it is the responsibility of DLL to transmit it to the Host
using its MAC address. 

MAC address is the physical address, which uniquely identifies each device
on a given network. To make communication between two networked
devices, we need two addresses: IP address and MAC address. It is
assigned to the NIC (Network Interface card) of each device that can be
connected to the internet. It is globally unique; it means two devices cannot
have the same MAC address. It is represented in a hexadecimal format on
each device, such as 00:0a:95:9d:67:16.
2. The packet received from Network layer is further divided into frames
depending on the frame size of NIC(Network Interface Card). DLL also
encapsulates Sender and Receiver’s MAC address in the header. 

3. The Receiver’s MAC address is obtained by placing an ARP(Address


Resolution Protocol) request and the destination host will reply with its
MAC address. 
 

The functions of the data Link layer are :  


 Framing: Framing is a function of the data link layer. It provides a way for a
sender to transmit a set of bits that are meaningful to the receiver. This can be
accomplished by attaching special bit patterns to the beginning and end of the
frame.
 Physical addressing: After creating frames, Data link layer adds physical
addresses (MAC address) of receiver in the header of each frame.
 Error control: Data link layer provides the mechanism of error control in
which it detects and retransmits damaged or lost frames.
 Flow Control: The data rate must be constant on both sides else the data may
get corrupted thus , flow control coordinates that amount of data that can be sent
before receiving acknowledgement.
 Access control: When a single communication channel is shared by multiple
devices, MAC sub-layer of data link layer helps to determine which device has
control over the channel at a given time.

* Packet in Data Link layer is referred as Frame. 


** Data Link layer is handled by the NIC (Network Interface Card) and device
drivers of host machines. 
*** Switch & Bridge are Data Link Layer devices. 
 
3. Network Layer (Layer 3):
4. Network layer works for the transmission of data from one host to the other
located in different networks.
5. It also takes care of packet routing i.e. selection of the shortest path to
transmit the packet, from the number of routes available.
6. The sender & receiver’s IP address are placed in the header by the network
layer. 

The functions of the Network layer are:  


 Routing: The network layer protocols determine which route is suitable from
source to destination. This function of network layer is known as routing.
 Logical Addressing: In order to identify each device on internetwork uniquely,
network layer defines an addressing scheme. The sender & receiver’s IP address
are placed in the header by network layer. Such an address distinguishes each
device uniquely and universally.
* Segment in Network layer is referred as Packet. 
 ** Network layer is implemented by networking devices such as routers.  

4. Transport Layer (Layer 4) :


Transport layer provides services to application layer and takes services from
network layer. The data in the transport layer is referred to as Segments. It is
responsible for the End to End Delivery of the complete message. The transport
layer also provides the acknowledgement of the successful data transmission and
re-transmits the data if an error is found. 
• At sender’s side: 
Transport layer receives the formatted data from the upper layers,
performs Segmentation and also implements Flow & Error control to ensure
proper data transmission. It also adds Source and Destination port number in its
header and forwards the segmented data to the Network Layer. 
Note: The sender need to know the port number associated with the receiver’s
application. 
Generally, this destination port number is configured, either by default or
manually. For example, when a web application makes a request to a web server, it
typically uses port number 80, because this is the default port assigned to web
applications. Many applications have default port assigned. 
• At receiver’s side: 
Transport Layer reads the port number from its header and forwards the Data
which it has received to the respective application. It also performs sequencing and
reassembling of the segmented data. 
The functions of the transport layer are :  
1. Segmentation and Reassembly: This layer accepts the message from the
(session) layer , breaks the message into smaller units . Each of the segment
produced has a header associated with it. The transport layer at the destination
station reassembles the message.

2. Service Point Addressing: In order to deliver the message to correct process,


transport layer header includes a type of address called service point address or
port address. Thus by specifying this address, transport layer makes sure that the
message is delivered to the correct process.

The services provided by the transport layer :  


1. Connection Oriented Service: It is a three-phase process which include 
– Connection Establishment 
– Data Transfer 
– Termination / disconnection 
In this type of transmission, the receiving device sends an acknowledgement,
back to the source after a packet or group of packet is received. This type of
transmission is reliable and secure.
2. Connection less service: It is a one-phase process and includes Data Transfer.
In this type of transmission, the receiver does not acknowledge receipt of a
packet. This approach allows for much faster communication between devices.
Connection-oriented service is more reliable than connectionless Service.
* Data in the Transport Layer is called as Segments. 
** Transport layer is operated by the Operating System. It is a part of the OS and
communicates with the Application Layer by making system calls. 
Transport Layer is called as Heart of OSI model. 

5. Session Layer (Layer 5) :


This layer is responsible for establishment of connection, maintenance of sessions,
authentication and also ensures security. 
The functions of the session layer are :  

1. Session establishment, maintenance and termination: The layer allows the


two processes to establish, use and terminate a connection.
2. Synchronization : This layer allows a process to add checkpoints which are
considered as synchronization points into the data. These synchronization point
help to identify the error so that the data is re-synchronized properly, and ends
of the messages are not cut prematurely and data loss is avoided.
3. Dialog Controller : The session layer allows two systems to start
communication with each other in half-duplex or full-duplex.
**All the below 3 layers(including Session Layer) are integrated as a single layer
in the TCP/IP model as “Application Layer”. 
**Implementation of these 3 layers is done by the network application itself. These
are also known as Upper Layers or Software Layers. 
SCENARIO: 
Let’s consider a scenario where a user wants to send a message through some
Messenger application running in his browser. The “Messenger” here acts as the
application layer which provides the user with an interface to create the data. This
message or so-called Data is compressed, encrypted (if any secure data) and
converted into bits (0’s and 1’s) so that it can be transmitted. 
 
 
6. Presentation Layer (Layer 6) :
Presentation layer is also called the Translation layer.The data from the
application layer is extracted here and manipulated as per the required format to
transmit over the network. 
The functions of the presentation layer are : 
1. Translation : For example, ASCII to EBCDIC.
2. Encryption/ Decryption : Data encryption translates the data into another form
or code. The encrypted data is known as the cipher text and the decrypted data
is known as plain text. A key value is used for encrypting as well as decrypting
data.
3. Compression: Reduces the number of bits that need to be transmitted on the
network. 

7. Application Layer (Layer 7) :


At the very top of the OSI Reference Model stack of layers, we find Application
layer which is implemented by the network applications. These applications
produce the data, which has to be transferred over the network. This layer also
serves as a window for the application services to access the network and for
displaying the received information to the user. 
Ex: Application – Browsers, Skype Messenger etc. 
**Application Layer is also called as Desktop Layer. 
 

The functions of the Application layer are :  


1. Network Virtual Terminal
2. FTAM-File transfer access and management
3. Mail Services
4. Directory Services
OSI model acts as a reference model and is not implemented in the Internet
because of its late invention. Current model being used is the TCP/IP model. 

7. Application Layer
The application layer is used by end-user software such as web browsers and email
clients.

It provides protocols that allow software to send and receive information and


present meaningful data to users.

A few examples of application layer protocols are the Hypertext Transfer


Protocol (HTTP), File Transfer Protocol (FTP), Post Office Protocol (POP),
Simple Mail Transfer Protocol (SMTP), and Domain Name System (DNS).

6. Presentation Layer

The presentation layer prepares data for the application layer.

It defines how two devices should encode, encrypt, and compress data so it is
received correctly on the other end.

The presentation layer takes any data transmitted by the application layer and
prepares it for transmission over the session layer.

5. Session Layer

The session layer creates communication channels, called sessions, between


devices.

It is responsible for opening sessions, ensuring they remain open and functional
while data is being transferred, and closing them when communication ends.

The session layer can also set checkpoints during a data transfer—if the session is
interrupted, devices can resume data transfer from the last checkpoint.

4. Transport Layer

The transport layer takes data transferred in the session layer and breaks it into
“segments” on the transmitting end.

It is responsible for reassembling the segments on the receiving end, turning it


back into data that can be used by the session layer.

The transport layer carries out flow control, sending data at a rate that matches the
connection speed of the receiving device, and error control, checking if data was
received incorrectly and if not, requesting it again.
3. Network Layer

The network layer has two main functions. One is breaking up segments into
network packets, and reassembling the packets on the receiving end. The other is
routing packets by discovering the best path across a physical network. The
network layer uses network addresses (typically Internet Protocol addresses) to
route packets to a destination node.

2. Data Link Layer

The data link layer establishes and terminates a connection between two
physically-connected nodes on a network. It breaks up packets into frames and
sends them from source to destination. This layer is composed of two parts—
Logical Link Control (LLC), which identifies network protocols, performs error
checking and synchronizes frames, and Media Access Control (MAC) which uses
MAC addresses to connect devices and define permissions to transmit and receive
data.

1. Physical Layer

The physical layer is responsible for the physical cable or wireless connection
between network nodes. It defines the connector, the electrical cable or wireless
technology connecting the devices, and is responsible for transmission of the raw
data, which is simply a series of 0s and 1s, while taking care of bit rate control.

Advantages of OSI Model

The OSI model helps users and operators of computer networks:

1. Determine the required hardware and software to build their network.


2. Understand and communicate the process followed by components communicating
across a network. 
3. Perform troubleshooting, by identifying which network layer is causing an issue
and focusing efforts on that layer.

TCP-IP REFERENCE MODEL

1. The OSI reference model was the first communication model and was
termed as general-purpose model because of its ability to fit in any type
of network but without fitting the protocols in. Due to its inability to fit
protocols, TCP/IP reference model which is commonly known as
Internet Model was developed in year 1983 by US Military Wing called
ARPANET.
2. TCP/IP stands for Transmission Control Protocol with the help of
which, protocol implementation over the network can be achieved.
3. The TCP/IP model also has a layered architecture which allows easy
data communication along with the facility of integrating multiple
protocols. The layout remains similar to OSI Model but the number of
layer, their functionalities and properties got changed.
4. This Internet Model(TCP/IP) comprises of only four layers as compared
to seven layers of OSI Model. These four layers are generated by
combining the layers of OSI model internally so that protocols can be
implemented. These layers have fixed positions too and their positions
cannot be altered.
5. Application Layer, Transport Layer, Internet Layer and Network
Access Layers are the four layers of TCP/IP Model.

a) The Network Access Layer

1. The Network Access Layer of TCP/IP reference model is also known as


the Host-to-Host or Host-to-Network layer as it is responsible for
performing roles of the Physical Layer along with the functions of Data
Link Layer.
2. Data in the form of bits received in the Network Access Layer are
connected in the form of data packets to Internet Layer.
3. Network Access Layer = Data Link Layer + Physical Layer.

b) The Internet Layer

o Internet layer is also called Network Layer which is responsible for


establishment of connection to send or receive data packets between
multiple users or nodes or devices or networks. This layer is placed on
the 2nd position from bottom.
o The Internet Layer en-routes the data packets from source to
destination through the process of routing with the help of various
routing techniques and routing protocols.

c) The Transport Layer

o The Transport Layer performs the same functions and have similar
features as that in OSI Model. The functionality of Transport Layer is
to provide end to end data transfer by using the technique of connection
oriented services between sender and receiver with the help of various
protocols.

d) The Application layer

 The Application Layer resides on the top of the TCP/IP reference model as
line in OSI Model. The functionality of Application Layer of
TCP/IP reference model is to provide interface between users and the
applications. In some cases depending upon the requirements, it can
perform the functions of Session Layer(to provide sessions) and
Presentation Layer(data representation).
 Application Layer = Session Layer + Presentation Layer + Application
Layer .

OSI Model TCP/IP Model

It stands for Open System It stands for Transmission Control


Interconnection. Protocol.

OSI model has been developed by ISO It was developed by ARPANET


(International Standard Organization). (Advanced Research Project Agency
Network).

It is an independent standard and generic It consists of standard protocols that


protocol used as a communication lead to the development of an
gateway between the network and the internet. It is a communication
end user. protocol that provides the connection
among the hosts.

In the OSI model, the transport layer The transport layer does not provide
provides a guarantee for the delivery of the surety for the delivery of packets.
the packets. But still, we can say that it is a
reliable model.

In this model, the session and In this model, the session and
presentation layers are separated, i.e., presentation layer are not different
both the layers are different. layers. Both layers are included in
the application layer.

It is also known as a reference model It is an implemented model of an


through which various networks are OSI model.
built. For example, the TCP/IP model is
built from the OSI model. It is also
referred to as a guidance tool.

In this model, the network layer provides The network layer provides only
both connection-oriented and connectionless service.
connectionless service.

Protocols in the OSI model are hidden In this model, the protocol cannot be
and can be easily replaced when the easily replaced.
technology changes.

It consists of 7 layers. It consists of 4 layers.

OSI model defines the services, In the TCP/IP model, services,


protocols, and interfaces as well as protocols, and interfaces are not
provides a proper distinction between properly separated. It is protocol
them. It is protocol independent. dependent.

The usage of this model is very low. This model is highly used.

It provides standardization to the devices It does not provide the


like router, motherboard, switches, and standardization to the devices. It
other hardware devices. provides a connection between
various computers.

Network Connecting Devices:


1-HUB
Half duplex means at a time it can send or receive the message
2-ROUTER (https://www.youtube.com/watch?
v=CHeDN82UPGw&list=PLqleLpAMfxGCUpDRFUnLKeDrgBsPOwTQK&i
ndex=7)
3-SWITCH
4-BRIDGE
5. Gateway : 
A gateway is basically a device or a hardware which acts like a “gate” among the
networks. Thus it can also be defined as a node which acts as an entrance for the
other nodes in the network. It is also responsible for enabling the traffic flow
within the network. Gateway uses more than one protocol for communication
thus its activities are much more complex than a switch or a router. 

So a gateway is basically a device that is used for the communication among the
networks which have a different set of protocols and is responsible for the
conversion of one protocol into the other. For any kind of workplace, the gateway
is a computer system which is responsible for routing the traffic from the main
workstation to outside network.

For homes, it is responsible for giving the access to the internet thus acting as an
internet service provider (ISP). 
S.NO. Router Gateway

It routes the data packets via It connects two dissimilar


1. similar networks. networks.

It is a hardware device which is It is a device that is used for the


responsible for receiving, communication among the
analyzing and forwarding the networks which have a different
2. data packets to other networks. set of protocols.

It does not support dynamic


3. It supports the dynamic routing. routing.

The main function of a router is The main function of a gateway is


routing the traffic from one to translate one protocol to the
4. network to the other. other.

A router operates on layer 3 and A gateway operates upto layer 5


5. layer 4 of the OSI model. of the OSI model.
Transmission Media:
For any networking to be effective, raw stream of data is to be transported from
one device to other over some medium. Various transmission media can be used
for transfer of data. These transmission media may be of two types −
 Guided − In guided media, transmitted data travels through cabling system
that has a fixed path. For example, copper wires, fibre optic wires, etc.
Features:  
o High Speed
o Secure
o Used for comparatively shorter distances

 Unguided − In unguided media, transmitted data travels through free space


in form of electromagnetic signal. For example, radio waves, lasers, etc.
Features:  
 The signal is broadcasted through air
 Less Secure
 Used for larger distances

Difference between Guided and Unguided Media


S.No. Guided Media Unguided Media

The signal energy propagates The signal energy propagates


1. through wires in guided media. through air in unguided media.

Unguided media is generally


Guided media is used for point to suited for radio broadcasting in
2. point communication. all directions.

Continuous network topologies


Discrete network topologies are are formed by the unguided
3. formed by the guided media. media.

Signals are in the form of voltage, Signals are in the form of


current or photons in the guided electromagnetic waves in
4. media. unguided media.

5. <Examples of guided media are Examples of unguided media


twisted pair wires, coaxial cables, are microwave or radio links
S.No. Guided Media Unguided Media

optical fiber cables. and infrared light.

Wired LAN and Wireless LAN

Wired LAN

LAN stands for Local Area Network. It can be described as a collection of network
devices in a specific location, and all of them are connected via switches or routers,
which helps in the transmission of data. Each network device uses a cable to
connect itself to the switch or router.

LAN is installed in locations where a large no. of computers have to be connected


to the internet at the same time, such as in offices or other buildings.

Wireless LAN
WLAN stands for Wireless Local Area Network. This network type enables the
transfer of data with the help of wireless transmitters and receivers. This does not
use the typical data transfer done using the cables. WLANs are used in areas that
require a large number of devices to connect to the internet at the same time.

WLANs installation is costly, but it is relatively easy to use. Nowadays, WLAN is


also used at homes to connect laptops and mobile phones.

WLAN vs LAN

The difference between WLAN and LAN is that WLAN stands for Wireless Local
Area Network and LAN stands for Local Area Network. Both are network
providers offering network services with varying costs, performance, and security
levels.

Comparison Table Between WLAN and LAN

Parameters of
WLAN LAN
Comparison

Stands for Wireless Local Area Network Local Area Network


Includes both wired and
Connection type Wireless technologies
wireless technologies.

Expensive to install and are less Less expensive and more


Cost and security
secure. secure.

Large regions such as offices, Large areas such as


Coverage
buildings, stations, etc. buildings.

High performance; Good performance and it


Performance performance affected by bad isn’t affected by the
weather. weather.

It cannot be interfered with


Interference It can be interfered with easily.
easily.

Desktops, laptops, tablets, and Desktop and laptop


Examples mobiles connected on Wi-Fi or connected to LAN in a
hotspots networks. building or an office.
UNIT-2

DATA LINK LAYER

Error Detection & Correction


There are many reasons such as noise, cross-talk etc., which may help data to get
corrupted during transmission. The upper layers work on some generalized view
of network architecture and are not aware of actual hardware data processing.
Hence, the upper layers expect error-free transmission between the systems. Most
of the applications would not function properly if they receive incorrect data.
Applications such as voice and video may not be that affected and with some
errors they may still function well.
Data-link layer uses some error control mechanism to ensure that frames (data bit
streams) are transmitted with certain level of accuracy. But to understand how
errors is controlled, it is essential to know what types of errors may occur.

Types of Errors

There may be three types of errors:


 Single bit error

In a frame, there is only one bit, anywhere though, which is corrupt.


 Multiple bits error

Frame is received with more than one bits in corrupted state.


 Burst error

Frame contains more than1 consecutive bits corrupted.

Error control mechanism may involve two possible ways:


 Error detection
 Error correction

Error Detection Methods

Following are the error detection methods or techniques of error detection in


networking.
1. VRC Method 2. LRC method 3. CRC method 4. Checksum method

1. Parity check or vertical redundancy check (VRC) method

In this error detection technique, a redundant bit called parity bit is appended to
every data unit so that total number of 1's in the unit (including parity bit) becomes
even. The system now transmits entire extended unit across the network link. At
the receiver, all eight received bits are checked through even parity checking
function. If it counts even 1's data unit passes. If it counts odd number of 1's, it
means error has been introduced in the data somewhere. Hence receiver rejects the
whole data unit. Similar way odd parity VRC can also be implemented. In this
method, total number of 1's should be odd before transmission.

Parity Check

One extra bit is sent along with the original bits to make number of 1s either even
in case of even parity, or odd in case of odd parity.
The sender while creating a frame counts the number of 1s in it. For example, if
even parity is used and number of 1s is even then one bit with value 0 is added.
This way number of 1s remains even.If the number of 1s is odd, to make it even a
bit with value 1 is added.
The receiver simply counts the number of 1s in a frame. If the count of 1s is even
and even parity is used, the frame is considered to be not-corrupted and is
accepted. If the count of 1s is odd and odd parity is used, the frame is still not
corrupted.

2. Longitudinal Redundancy Check (LRC) method


Longitudinal Redundancy Check (LRC) is also known as 2-D parity check. In this
method, data which the user want to send is organised into tables of rows and
columns. A block of bit is divided into table or matrix of rows and columns. In
order to detect an error, a redundant bit is added to the whole block and this block
is transmitted to receiver. The receiver uses this redundant row to detect error.
After checking the data for errors, receiver accepts the data and discards the
redundant row of bits.

Example:
If a block of 32 bits is to be transmitted, it is divided into matrix of four rows and
eight columns which as shown in the following figure:

In this matrix of bits, a parity bit (odd or even) is calculated for each column. It
means 32 bits data plus 8 redundant bits are transmitted to receiver. Whenever
data reaches at the destination, receiver uses LRC to detect error in data.
Advantage :
LRC is used to detect burst errors.
Example : Suppose 32 bit data plus LRC that was being transmitted is hit by a
burst error of length 5 and some bits are corrupted as shown in the following
figure :
Figure : Burst error & LRC

The LRC received by the destination does not match with newly corrupted LRC.
The destination comes to know that the data is erroneous, so it discards the data.
Disadvantage :
The main problem with LRC is that, it is not able to detect error if two bits in a
data unit are damaged and two bits in exactly the same position in other data unit
are also damaged.

3. Cyclic Redundancy Check (CRC)

CRC is a different approach to detect if the received frame contains valid data.
This technique involves binary division of the data bits being sent. The divisor is
generated using polynomials. The sender performs a division operation on the bits
being sent and calculates the remainder. Before sending the actual bits, the sender
adds the remainder at the end of the actual bits. Actual data bits plus the
remainder is called a codeword. The sender transmits data bits as codewords.
At the other end, the receiver performs division operation on codewords using the
same CRC divisor. If the remainder contains all zeros the data bits are accepted,
otherwise it is considered as there some data corruption occurred in transit.
4. Check sum

This is a block code method where a checksum is created based on the data values
in the data blocks to be transmitted using some algorithm and appended to the data.
When the receiver gets this data, a new checksum is calculated and compared with
the existing checksum. A non-match indicates an error.
Error Detection by Checksums
For error detection by checksums, data is divided into fixed sized frames or
segments.
 Sender’s End − The sender adds the segments using 1’s complement
arithmetic to get the sum. It then complements the sum to get the checksum
and sends it along with the data frames.
 Receiver’s End − The receiver adds the incoming segments along with the
checksum using 1’s complement arithmetic to get the sum and then
complements it.
If the result is zero, the received frames are accepted; otherwise they are discarded.
Example
Suppose that the sender wants to send 4 frames each of 8 bits, where the frames are
11001100, 10101010, 11110000 and 11000011.
The sender adds the bits using 1s complement arithmetic. While adding two
numbers using 1s complement arithmetic, if there is a carry over, it is added to the
sum.
After adding all the 4 frames, the sender complements the sum to get the
checksum, 11010011, and sends it along with the data frames.
The receiver performs 1s complement arithmetic sum of all the frames including
the checksum. The result is complemented and found to be 0. Hence, the receiver
assumes that no error has occurred.
Error Correction

Error Correction codes are used to detect and correct the errors when data is
transmitted from the sender to the receiver.

Error Correction can be handled in two ways:

o Backward error correction: Once the error is discovered, the receiver


requests the sender to retransmit the entire data unit.
o Forward error correction: In this case, the receiver uses the error-
correcting code which automatically corrects the errors.
Figure: Structure of the Encoder and Decoder in the Error Correction

In order to detect or correct the errors, there is a need to send some extra bits along
with the data. These extra bits are commonly known as Redundant bits.

As we had learned in the previous tutorial that original data is divided into
segments of k bits; it is referred to as dataword. When we add r redundant bits to
each block in order to make the length;n=k+r then it is referred to as Codeword.

6.1M

A single additional bit can detect the error, but cannot correct it.

For correcting the errors, one has to know the exact position of the error. For
example, If we want to calculate a single-bit error, the error correction code will
determine which one of seven bits is in error. To achieve this, we have to add some
additional redundant bits. Java Program for BeginnersHighest Salary in SQL

Suppose r is the number of redundant bits and d is the total number of the data bits.
The number of redundant bits r can be calculated by using the formula:

2r>=d+r+1

The value of r is calculated by using the above formula. For example, if the value
of d is 4, then the possible smallest value that satisfies the above relation would be
3.

To determine the position of the bit which is in error, a technique developed by


R.W Hamming is Hamming code which can be applied to any length of the data
unit and uses the relationship between data units and redundant units.
Hamming Code

Encoding a message by Hamming Code


The procedure used by the sender to encode the message encompasses the
following steps −
 Step 1 − Calculation of the number of redundant bits.
 Step 2 − Positioning the redundant bits.
 Step 3 − Calculating the values of each redundant bit.
 Step 4 − Once the redundant bits are embedded within the message, this is
sent to the user.

Let's understand the concept of Hamming code through an example:

Example: Suppose the original data is 1010 which is to be sent.

Total number of data bits 'd' = 4


Number of redundant bits r : 2r >= d+r+1
2r>= 4+r+1
Therefore, the value of r is 3 that satisfies the above relation.
Total number of bits = d+r = 4+3 = 7;

Determining the position of the redundant bits

The number of redundant bits is 3. The three bits are represented by r1, r2, r4. The
position of the redundant bits is calculated with corresponds to the raised power of
2. Therefore, their corresponding positions are 1, 21, 22.

1. The position of r1 = 1  
2. The position of r2 = 2  
3. The position of r4 = 4  

Representation of Data on the addition of parity bits:

Determining the Parity bits


Determining the r1 bit

The r1 bit is calculated by performing a parity check on the bit positions whose
binary representation includes 1 in the first position.

We observe from the above figure that the bit positions that includes 1 in the first
position are 1, 3, 5, 7. Now, we perform the even-parity check at these bit
positions. The total number of 1 at these bit positions corresponding to r1 is even,
therefore, the value of the r1 bit is 0.

Determining r2 bit

The r2 bit is calculated by performing a parity check on the bit positions whose
binary representation includes 1 in the second position.

We observe from the above figure that the bit positions that includes 1 in the
second position are 2, 3, 6, 7. Now, we perform the even-parity check at these bit
positions. The total number of 1 at these bit positions corresponding to r2 is odd,
therefore, the value of the r2 bit is 1.

Determining r4 bit

The r4 bit is calculated by performing a parity check on the bit positions whose
binary representation includes 1 in the third position.
We observe from the above figure that the bit positions that includes 1 in the third
position are 4, 5, 6, 7. Now, we perform the even-parity check at these bit
positions. The total number of 1 at these bit positions corresponding to r4 is even,
therefore, the value of the r4 bit is 0.

Data transferred is given below:

Suppose the 4th bit is changed from 0 to 1 at the receiving end, then parity bits are
recalculated.

R1 bit

The bit positions of the r1 bit are 1,3,5,7

We observe from the above figure that the binary representation of r1 is 1100.
Now, we perform the even-parity check, the total number of 1s appearing in the r1
bit is an even number. Therefore, the value of r1 is 0.

R2 bit

The bit positions of r2 bit are 2,3,6,7.


We observe from the above figure that the binary representation of r2 is 1001.
Now, we perform the even-parity check, the total number of 1s appearing in the r2
bit is an even number. Therefore, the value of r2 is 0.

R4 bit

The bit positions of r4 bit are 4,5,6,7.

We observe from the above figure that the binary representation of r4 is 1011.
Now, we perform the even-parity check, the total number of 1s appearing in the r4
bit is an odd number. Therefore, the value of r4 is 1.

o The binary representation of redundant bits, i.e., r4r2r1 is 100, and its
corresponding decimal value is 4. Therefore, the error occurs in a 4th bit
position. The bit value must be changed from 1 to 0 to correct the error.
Flow Control and Error Control
Stop and Wait Protocol

Noiseless channels are those channels which do not degrade the quality of data
(loss of data) during transmission.
Sliding Window protocol

The sliding window is a technique for sending multiple frames at a time. It controls
the data packets between the two devices where reliable and gradual delivery of
data frames is needed. It is also used in TCP.

In this technique, each frame has sent from the sequence number. The sequence
numbers are used to find the missing data in the receiver end. The purpose of the
sliding window technique is to avoid duplicate data, so it uses the sequence
number.
Go-back-N-ARQ Protocol
Go-Back-N ARQ protocol is also known as Go-Back-N Automatic Repeat
Request. It is a data link layer protocol that uses a sliding window method. In this,
if any frame is corrupted or lost, all subsequent frames have to be sent again.

The size of the sender window is N in this protocol. For example, Go-Back-8, the
size of the sender window, will be 8. 

If the receiver receives a corrupted frame, it cancels it. The receiver does not
accept a corrupted frame. When the timer expires, the sender sends the correct
frame again. The design of the Go-Back-N ARQ protocol is shown below.
Selective-Repeat ARQ Protocol

Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat
Request. It is a data link layer protocol that uses a sliding window method. 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. The size of the sliding window
is always greater than 1.

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. There is no waiting for any time-out
to send that frame. The design of the Selective Repeat ARQ protocol is shown
below.
Selective Repeat ARQ

Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat
Request. It is a data link layer protocol that uses a sliding window method. 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. The size of the sliding window
is always greater than 1.
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. There is no waiting for any time-out
to send that frame. The design of the Selective Repeat ARQ protocol is shown
below.
Difference between the Go-Back-N ARQ and Selective Repeat ARQ

Go-Back-N ARQ Selective Repeat ARQ

If a frame is corrupted or lost in it, In this, only the frame is sent again, which
all subsequent frames have to be is corrupted or lost.
sent again.
If it has a high error rate, it wastes There is a loss of low bandwidth.
a lot of bandwidth.
It is less complex. It is more complex because it has to do
sorting and searching as well. And it also
requires more storage.
It does not require sorting. In this, sorting is done to get the frames in
the correct order.
It does not require searching. The search operation is performed in it.
It is used more. It is used less because it is more complex.

Channel Allocation Protocols

Multiple Access Protocol

When a sender and receiver have a dedicated link to transmit data packets, the data
link control is enough to handle the channel. Suppose there is no dedicated path to
communicate or transfer the data between two devices. In that case, multiple
stations access the channel and simultaneously transmit the data over the channel.
It may create collision and cross talk. Hence, the multiple access protocol is
required to reduce the collision and avoid crosstalk between the channels.

For example, suppose that there is a classroom full of students. When a teacher
asks a question, all the students (small channels) in the class start answering the
question at the same time (transferring the data simultaneously). All the students
respond at the same time due to which data is overlap or data lost. Therefore it is
the responsibility of a teacher (multiple access protocol) to manage the students
and make them one answer.

Following are the types of multiple access protocol that is subdivided into the
different process as:
A. Random Access Protocol

In this protocol, all the station has the equal priority to send the data over a
channel. In random access protocol, one or more stations cannot depend on another
station and any station control another station. Depending on the channel's state
(idle or busy), each station transmits the data frame. However, if more than one
station sends the data over a channel, there may be a collision or data conflict. Due
to the collision, the data frame packets may be lost or changed. And hence, it does
not receive by the receiver end.

Following are the different methods of random-access protocols for broadcasting


frames on the channel.

o ALOHA
o CSMA
o CSMA/CD
o CSMA/CA

ALOHA

It is designed for wireless LAN (Local Area Network) but can also be used in a
shared medium to transmit data. Using this method, any station can transmit data
across a network simultaneously when a data frameset is available for
transmission.

Aloha Rules

1. Any station can transmit data to a channel at any time.


2. It does not require any carrier sensing.
3. Collision and data frames may be lost during the transmission of data
through multiple stations.
4. Acknowledgment of the frames exists in Aloha. Hence, there is no collision
detection.
5. It requires retransmission of data after some random amount of time.

Pure Aloha

Whenever data is available for sending over a channel at stations, we use Pure
Aloha. In pure Aloha, when each station transmits data to a channel without
checking whether the channel is idle or not, the chances of collision may occur,
and the data frame can be lost. When any station transmits the data frame to a
channel, the pure Aloha waits for the receiver's acknowledgment. If it does not
acknowledge the receiver end within the specified time, the station waits for a
random amount of time, called the backoff time (Tb). And the station may assume
the frame has been lost or destroyed. Therefore, it retransmits the frame until all
the data are successfully transmitted to the receiver.

1. The total vulnerable time of pure Aloha is 2 * Tfr.


2. Maximum throughput occurs when G = 1/ 2 that is 18.4%.
3. Successful transmission of data frame is S = G * e ^ - 2 G.
As we can see in the figure above, there are four stations for accessing a shared
channel and transmitting data frames. Some frames collide because most stations
send their frames at the same time. Only two frames, frame 1.1 and frame 2.2, are
successfully transmitted to the receiver end. At the same time, other frames are lost
or destroyed. Whenever two frames fall on a shared channel simultaneously,
collisions can occur, and both will suffer damage. If the new frame's first bit enters
the channel before finishing the last bit of the second frame. Both frames are
completely finished, and both stations must retransmit the data frame.
e=2.718
Slotted Aloha

The slotted Aloha is designed to overcome the pure Aloha's efficiency because
pure Aloha has a very high possibility of frame hitting. In slotted Aloha, the shared
channel is divided into a fixed time interval called slots. So that, if a station wants
to send a frame to a shared channel, the frame can only be sent at the beginning of
the slot, and only one frame is allowed to be sent to each slot. And if the stations
are unable to send data to the beginning of the slot, the station will have to wait
until the beginning of the slot for the next time. However, the possibility of a
collision remains when trying to send a frame at the beginning of two or more
station time slot.
CSMA (Carrier Sense Multiple Access)

It is a carrier sense multiple access based on media access protocol to sense the


traffic on a channel (idle or busy) before transmitting the data. It means that if the
channel is idle, the station can send data to the channel. Otherwise, it must wait
until the channel becomes idle. Hence, it reduces the chances of a collision on a
transmission medium.

CSMA Access Modes

1-Persistent: In the 1-Persistent mode of CSMA that defines each node, first sense
the shared channel and if the channel is idle, it immediately sends the data. Else it
must wait and keep track of the status of the channel to be idle and broadcast the
frame unconditionally as soon as the channel is idle.

2-Non-Persistent: It is the access mode of CSMA that defines before transmitting


the data, each node must sense the channel, and if the channel is inactive, it
immediately sends the data. Otherwise, the station must wait for a random time
(not continuously), and when the channel is found to be idle, it transmits the
frames.

3-P-Persistent: It is the combination of 1-Persistent and Non-persistent modes.


The P-Persistent mode defines that each node senses the channel, and if the
channel is inactive, it sends a frame with a P probability. If the data is not
transmitted, it waits for a (q = 1-p probability) random time and resumes the
frame with the next time slot.

4-O- Persistent: It is an O-persistent method that defines the superiority of the


station before the transmission of the frame on the shared channel. If it is found
that the channel is inactive, each station waits for its turn to retransmit the data.
CSMA with Collision Detection (CSMA/CD)
Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is a network
protocol for carrier transmission that operates in the Medium Access Control
(MAC) layer. It senses or listens whether the shared channel for transmission is
busy or not, and defers transmissions until the channel is free. The collision
detection technology detects collisions by sensing transmissions from other
stations. On detection of a collision, the station stops transmitting, sends a jam
signal, and then waits for a random time interval before retransmission.

Algorithms

The algorithm of CSMA/CD is:


 When a frame is ready, the transmitting station checks whether the channel is
idle or busy.
 If the channel is busy, the station waits until the channel becomes idle.
 If the channel is idle, the station starts transmitting and continually monitors
the channel to detect collision.
 If a collision is detected, the station starts the collision resolution algorithm.
 The station resets the retransmission counters and completes frame
transmission.

The algorithm of Collision Resolution is:


 The station continues transmission of the current frame for a specified time
along with a jam signal, to ensure that all the other stations detect collision.
 The station increments the retransmission counter.
 If the maximum number of retransmission attempts is reached, then the
station aborts transmission.
 Otherwise, the station waits for a backoff period which is generally a
function of the number of collisions and restart main algorithm.
CSMA/CA (Carrier Sense Multiple Access/Collision Avoidance)

Carrier sense multiple access/collision avoidance (CSMA/CA) is a protocol for


carrier transmission in 802.11 networks. It was developed to minimize the potential
of a collision occurring when two or more stations send their signals over a data
link layer.
In this scenario, CSMA requires each station to first check the state of the medium
before initiating a transmission. This helps to avert potential collisions by listening
to the broadcasting nodes and then informing devices to transmit when the channel
is free.

For example, as soon as a node receives a packet to transmit across the network, it
will check to ensure the channel is clear and no other node is transmitting at the
same time. If the network channel is idle, the packet is sent.

CSMA/CA checks that channels are clear before sending data packets across a
network.
If the channel is not clear, the node waits for a randomly chosen period of time --
in microseconds -- and then checks again to see if the channel is clear. This is
called the backoff factor and is counted down using a backoff counter.

If the channel is idle when the backoff counter reaches zero, the node transmits the
packet. If the channel is not clear when the backoff counter reaches zero, the
backoff factor will reset itself and repeat the process.

When the receiver gets the packet frame intact, it transmits an acknowledgment
(ACK) to the sender.

B. Controlled Access Protocol (https://www.youtube.com/watch?v=KviHyRss-dE)

It is a method of reducing data frame collision on a shared channel. In the


controlled access method, each station interacts and decides to send a data frame
by a particular station approved by all other stations. It means that a single station
cannot send the data frames unless all other stations are not approved. It has three
types of controlled access: Reservation, Polling, and Token Passing.
C. Channelization Protocols
Token Passing
 In token passing scheme, the stations are connected logically to each other in
form of ring and access to stations is governed by tokens.
 A token is a special bit pattern or a small message, which circulate from one
station to the next in some predefined order.
 In Token ring, token is passed from one station to another adjacent station in
the ring whereas incase of Token bus, each station uses the bus to send the
token to the next station in some predefined order.
 In both cases, token represents permission to send. If a station has a frame
queued for transmission when it receives the token, it can send that frame
before it passes the token to the next station. If it has no queued frame, it
passes the token simply.
 After sending a frame, each station must wait for all N stations (including
itself) to send the token to their neighbours and the other N – 1 stations to send
a frame, if they have one.
 There exists problems like duplication of token or token is lost or insertion of
new station, removal of a station, which need be tackled for correct and
reliable operation of this scheme.

Performance Performance of token ring can be concluded by 2 parameters:-
1. Delay, which is a measure of time between when a packet is ready and when it
is delivered. So, the average time (delay) required to send a token to the next
station = a/N.
2. Throughput, which is a measure of the successful traffic.
Throughput, S = 1/(1 + a/N) for a<1
and
S = 1/{a(1 + 1/N)} for a>1.
where N = number of stations
a = T p/Tt
(Tp = propagation delay and Tt = transmission delay)
UNIT-III

NETWORK LAYER

Switching techniques

In large networks, there can be multiple paths from sender to receiver. The
switching technique will decide the best route for data transmission.

Switching technique is used to connect the systems for making one-to-one


communication.

Classification of Switching Techniques

Circuit Switching

o Circuit switching is a switching technique that establishes a dedicated path


between sender and receiver.
o In the Circuit Switching Technique, once the connection is established then
the dedicated path will remain to exist until the connection is terminated.
o Circuit switching in a network operates in a similar way as the telephone
works.
o A complete end-to-end path must exist before the communication takes
place.
o In case of circuit switching technique, when any user wants to send the data,
voice, video, a request signal is sent to the receiver then the receiver sends
back the acknowledgment to ensure the availability of the dedicated path.
After receiving the acknowledgment, dedicated path transfers the data.
o Circuit switching is used in public telephone network. It is used for voice
transmission.
o Fixed data can be transferred at a time in circuit switching technology.

Communication through circuit switching has 3 phases:

o Circuit establishment
o Data transfer
o Circuit Disconnect

Circuit Switching can use either of the two technologies:

Space Division Switches:

o Space Division Switching is a circuit switching technology in which a single


transmission path is accomplished in a switch by using a physically separate
set of crosspoints.
o Space Division Switching can be achieved by using crossbar switch. A
crossbar switch is a metallic crosspoint or semiconductor gate that can be
enabled or disabled by a control unit.
o The Crossbar switch is made by using the semiconductor. For example,
Xilinx crossbar switch using FPGAs.
o Space Division Switching has high speed, high capacity, and nonblocking
switches.

Space Division Switches can be categorized in two ways:

o Crossbar Switch
o Multistage Switch

Crossbar Switch

The Crossbar switch is a switch that has n input lines and n output lines. The
crossbar switch has n2 intersection points known as crosspoints.

Disadvantage of Crossbar switch:

The number of crosspoints increases as the number of stations is increased.


Therefore, it becomes very expensive for a large switch. The solution to this is to
use a multistage switch.

Multistage Switch

o Multistage Switch is made by splitting the crossbar switch into the smaller
units and then interconnecting them.
o It reduces the number of crosspoints.
o If one path fails, then there will be an availability of another path.

Advantages Of Circuit Switching:

o In the case of Circuit Switching technique, the communication channel is


dedicated.
o It has fixed bandwidth.

Disadvantages of Circuit Switching:

o Once the dedicated path is established, the only delay occurs in the speed of
data transmission.
o It takes a long time to establish a connection approx 10 seconds during
which no data can be transmitted.
o It is more expensive than other switching techniques as a dedicated path is
required for each connection.
o It is inefficient to use because once the path is established and no data is
transferred, then the capacity of the path is wasted.
o In this case, the connection is dedicated therefore no other data can be
transferred even if the channel is free.

Message Switching
o Message Switching is a switching technique in which a message is
transferred as a complete unit and routed through intermediate nodes at
which it is stored and forwarded.
o In Message Switching technique, there is no establishment of a dedicated
path between the sender and receiver.
o The destination address is appended to the message. Message Switching
provides a dynamic routing as the message is routed through the
intermediate nodes based on the information available in the message.
o Message switches are programmed in such a way so that they can provide
the most efficient routes.
o Each and every node stores the entire message and then forward it to the
next node. This type of network is known as store and forward network.
o Message switching treats each message as an independent entity.

Advantages of Message Switching

o Data channels are shared among the communicating devices that improve
the efficiency of using available bandwidth.
o Traffic congestion can be reduced because the message is temporarily stored
in the nodes.
o Message priority can be used to manage the network.
o The size of the message which is sent over the network can be varied.
Therefore, it supports the data of unlimited size.

Disadvantages of Message Switching

o The message switches must be equipped with sufficient storage to enable


them to store the messages until the message is forwarded.
o The Long delay can occur due to the storing and forwarding facility
provided by the message switching technique.
Packet Switching

o The packet switching is a switching technique in which the message is sent


in one go, but it is divided into smaller pieces, and they are sent individually.
o The message splits into smaller pieces known as packets and packets are
given a unique number to identify their order at the receiving end.
o Every packet contains some information in its headers such as source
address, destination address and sequence number.
o Packets will travel across the network, taking the shortest path as possible.
o All the packets are reassembled at the receiving end in correct order.
o If any packet is missing or corrupted, then the message will be sent to resend
the message.
o If the correct order of the packets is reached, then the acknowledgment
message will be sent.

Approaches of Packet Switching:

There are two approaches to Packet Switching:

Datagram Packet switching:

o It is a packet switching technology in which packet is known as a datagram,


is considered as an independent entity. Each packet contains the information
about the destination and switch uses this information to forward the packet
to the correct destination.
o The packets are reassembled at the receiving end in correct order.
o In Datagram Packet Switching technique, the path is not fixed.
o Intermediate nodes take the routing decisions to forward the packets.
o Datagram Packet Switching is also known as connectionless switching.

Virtual Circuit Switching

o Virtual Circuit Switching is also known as connection-oriented switching.


o In the case of Virtual circuit switching, a preplanned route is established
before the messages are sent.
o Call request and call accept packets are used to establish the connection
between sender and receiver.
o In this case, the path is fixed for the duration of a logical connection.

Let's understand the concept of virtual circuit switching through a diagram:

o In the above diagram, A and B are the sender and receiver respectively. 1
and 2 are the nodes.
o Call request and call accept packets are used to establish a connection
between the sender and receiver.
o When a route is established, data will be transferred.
o After transmission of data, an acknowledgment signal is sent by the receiver
that the message has been received.
o If the user wants to terminate the connection, a clear signal is sent for the
termination.

Differences b/w Datagram approach and Virtual Circuit approach


Datagram approach Virtual Circuit approach

Node takes routing decisions to Node does not take any routing decision.
forward the packets.

Congestion cannot occur as all the Congestion can occur when the node is
packets travel in different busy, and it does not allow other packets to
directions. pass through.

It is more flexible as all the It is not very flexible.


packets are treated as an
independent entity.

Advantages Of Packet Switching:

o Cost-effective: In packet switching technique, switching devices do not


require massive secondary storage to store the packets, so cost is minimized
to some extent. Therefore, we can say that the packet switching technique is
a cost-effective technique.
o Reliable: If any node is busy, then the packets can be rerouted. This ensures
that the Packet Switching technique provides reliable communication.
o Efficient: Packet Switching is an efficient technique. It does not require any
established path prior to the transmission, and many users can use the same
communication channel simultaneously, hence makes use of available
bandwidth very efficiently.

Disadvantages Of Packet Switching:

o Packet Switching technique cannot be implemented in those applications


that require low delay and high-quality services.
o The protocols used in a packet switching technique are very complex and
requires high implementation cost.
o If the network is overloaded or corrupted, then it requires retransmission of
lost packets. It can also lead to the loss of critical information if errors are
nor recovered.
IPv4 vs IPv6

What is IP?

An IP stands for internet protocol. An IP address is assigned to each device


connected to a network. Each device uses an IP address for communication. It also
behaves as an identifier as this address is used to identify the device on a network.
It defines the technical format of the packets. Mainly, both the networks, i.e., IP
and TCP, are combined together, so together, they are referred to as a TCP/IP. It
creates a virtual connection betwe en the source and the destination.

We can also define an IP address as a numeric address assigned to each device on a


network. An IP address is assigned to each device so that the device on a network
can be identified uniquely. To facilitate the routing of packets, TCP/IP protocol
uses a 32-bit logical address known as IPv4(Internet Protocol version 4).

An IP address consists of two parts, i.e., the first one is a network address, and the
other one is a host address.

There are two types of IP addresses:

o IPv4
o IPv6

What is IPv4?

IPv4 is a version 4 of IP. It is a current version and the most commonly used IP
address. It is a 32-bit address written in four numbers separated by 'dot', i.e.,
periods. This address is unique for each device.

For example, 66.94.29.13

The above example represents the IP address in which each group of numbers
separated by periods is called an Octet. Each number in an octet is in the range
from 0-255. This address can produce 4,294,967,296 possible unique addresses.

In today's computer network world, computers do not understand the IP addresses


in the standard numeric format as the computers understand the numbers in binary
form only. The binary number can be either 1 or 0. The IPv4 consists of four sets,
and these sets represent the octet. The bits in each octet represent a number.

Each bit in an octet can be either 1 or 0. If the bit the 1, then the number it
represents will count, and if the bit is 0, then the number it represents does not
count.

Representation of 8 Bit Octet


The above representation shows the structure of 8- bit octet.

Now, we will see how to obtain the binary representation of the above IP address,
i.e., 66.94.29.13

Step 1: First, we find the binary number of 66.

To obtain 66, we put 1 under 64 and 2 as the sum of 64 and 2 is equal to 66


(64+2=66), and the remaining bits will be zero, as shown above. Therefore, the
binary bit version of 66 is 01000010.

Step 2: Now, we calculate the binary number of 94.

To obtain 94, we put 1 under 64, 16, 8, 4, and 2 as the sum of these numbers is
equal to 94, and the remaining bits will be zero. Therefore, the binary bit version of
94 is 01011110.

Step 3: The next number is 29.

To obtain 29, we put 1 under 16, 8, 4, and 1 as the sum of these numbers is equal
to 29, and the remaining bits will be zero. Therefore, the binary bit version of 29 is
00011101.

Step 4: The last number is 13.


To obtain 13, we put 1 under 8, 4, and 1 as the sum of these numbers is equal to
13, and the remaining bits will be zero. Therefore, the binary bit version of 13 is
00001101.

Drawback of IPv4

Currently, the population of the world is 7.6 billion. Every user is having more
than one device connected with the internet, and private companies also rely on the
internet. As we know that IPv4 produces 4 billion addresses, which are not enough
for each device connected to the internet on a planet. Although the various
techniques were invented, such as variable- length mask, network address
translation, port address translation, classes, inter-domain translation, to conserve
the bandwidth of IP address and slow down the depletion of an IP address. In these
techniques, public IP is converted into a private IP due to which the user having
public IP can also use the internet. But still, this was not so efficient, so it gave rise
to the development of the next generation of IP addresses, i.e., IPv6.

What is IPv6?

IPv4 produces 4 billion addresses, and the developers think that these addresses are
enough, but they were wrong. IPv6 is the next generation of IP addresses. The
main difference between IPv4 and IPv6 is the address size of IP addresses. The
IPv4 is a 32-bit address, whereas IPv6 is a 128-bit hexadecimal address. IPv6
provides a large address space, and it contains a simple header as compared to
IPv4.

It provides transition strategies that convert IPv4 into IPv6, and these strategies are
as follows:

o Dual stacking: It allows us to have both the versions, i.e., IPv4 and IPv6, on
the same device.
o Tunneling: In this approach, all the users have IPv6 communicates with an
IPv4 network to reach IPv6.
o Network Address Translation: The translation allows the communication
between the hosts having a different version of IP.

This hexadecimal address contains both numbers and alphabets. Due to the usage
of both the numbers and alphabets, IPv6 is capable of producing over 340
undecillion (3.4*1038) addresses.
IPv6 is a 128-bit hexadecimal address made up of 8 sets of 16 bits each, and these
8 sets are separated by a colon. In IPv6, each hexadecimal character represents 4
bits. So, we need to convert 4 bits to a hexadecimal number at a time

Address format

The address format of IPv4:

The address format of IPv6:

The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit
decimal address. It contains 4 octets or fields separated by 'dot', and each field is 8-
bit in size. The number that each field contains should be in the range of 0-255.
Whereas an IPv6 is a 128-bit hexadecimal address. It contains 8 fields separated by
a colon, and each field is 16-bit in size.

Differences between IPv4 and IPv6

Ipv4 Ipv6

Address IPv4 is a 32-bit address. IPv6 is a 128-bit address.


length

Fields IPv4 is a numeric address that IPv6 is an alphanumeric


consists of 4 fields which are address that consists of 8
separated by dot (.). fields, which are separated
by colon.

Classes IPv4 has 5 different classes of IP IPv6 does not contain


address that includes Class A, classes of IP addresses.
Class B, Class C, Class D, and
Class E.

Number of IP IPv4 has a limited number of IP IPv6 has a large number of


address addresses. IP addresses.

VLSM It supports VLSM (Virtual It does not support VLSM.


Length Subnet Mask). Here,
VLSM means that Ipv4 converts
IP addresses into a subnet of
different sizes.

Address It supports manual and DHCP It supports manual, DHCP,


configuration configuration. auto-configuration, and
renumbering.

Address space It generates 4 billion unique It generates 340 undecillion


addresses unique addresses.

End-to-end In IPv4, end-to-end connection In the case of IPv6, end-to-


connection integrity is unachievable. end connection integrity is
integrity achievable.

Security In IPv4, security depends on the In IPv6, IPSEC is


features application. This IP address is developed for security
not developed in keeping the purposes.
security feature in mind.

Address In IPv4, the IP address is In IPv6, the representation


representation represented in decimal. of the IP address in
hexadecimal.

Fragmentation Fragmentation is done by the Fragmentation is done by


senders and the forwarding the senders only.
routers.

Packet flow It does not provide any It uses flow label field in
identification mechanism for packet flow the header for the packet
identification. flow identification.

Checksum The checksum field is available The checksum field is not


field in IPv4. available in IPv6.

Transmission IPv4 is broadcasting. On the other hand, IPv6 is


scheme multicasting, which
provides efficient network
operations.

Encryption It does not provide encryption It provides encryption and


and and authentication. authentication.
Authentication
Number of It consists of 4 octets. It consists of 8 fields, and
octets each field contains 2 octets.
Therefore, the total number
of octets in IPv6 is 16.

Network Layer Protocols:

1. Address Resolution Protocol (ARP) –

Address Resolution Protocol is a communication protocol used for discovering


physical address associated with given network address. Typically, ARP is a
network layer to data link layer mapping process, which is used to discover MAC
address for given Internet Protocol Address. In order to send the data to
destination, having IP address is necessary but not sufficient; we also need the
physical address of the destination machine. ARP is used to get the physical
address (MAC address) of destination machine.

Before sending the IP packet, the MAC address of destination must be known. If
not so, then sender broadcasts the ARP-discovery packet requesting the MAC
address of intended destination. Since ARP-discovery is broadcast, every host
inside that network will get this message but the packet will be discarded by
everyone except that intended receiver host whose IP is associated. Now, this
receiver will send a unicast packet with its MAC address (ARP-reply) to the
sender of ARP-discovery packet. After the original sender receives the ARP-
reply, it updates ARP-cache and start sending unicast message to the destination.
 
2. Reverse Address Resolution Protocol (RARP) –

Reverse ARP is a networking protocol used by a client machine in a local area


network to request its Internet Protocol address (IPv4) from the gateway-router’s
ARP table. The network administrator creates a table in gateway-router, which is
used to map the MAC address to corresponding IP address. When a new machine
is setup or any machine which don’t have memory to store IP address, needs an
IP address for its own use. So the machine sends a RARP broadcast packet which
contains its own MAC address in both sender and receiver hardware address
field.

A special host configured inside the local area network, called as RARP-server is
responsible to reply for these kind of broadcast packets. Now the RARP server
attempt to find out the entry in IP to MAC address mapping table. If any entry
matches in table, RARP server send the response packet to the requesting device
along with IP address.

 LAN technologies like Ethernet, Ethernet II, Token Ring and Fiber
Distributed Data Interface (FDDI) support the Address Resolution Protocol.
 RARP is not being used in today’s networks. Because we have much great
featured protocols like BOOTP (Bootstrap Protocol) and DHCP( Dynamic
Host Configuration Protocol).
DHCP (Dynamic Host Configuration Protocol)

Dynamic Host Configuration Protocol (DHCP) is a network management


protocol used to dynamically assign an IP address to nay device, or node,
on a network so they can communicate using IP (Internet Protocol). DHCP
automates and centrally manages these configurations. There is no need to
manually assign IP addresses to new devices. Therefore, there is no
requirement for any user configuration to connect to a DHCP based
network.

DHCP can be implemented on local networks as well as large enterprise


networks. DHCP is the default protocol used by the most routers and
networking equipment. 

DHCP does the following:

o DHCP manages the provision of all the nodes or devices added or


dropped from the network.
o DHCP maintains the unique IP address of the host using a DHCP
server.
o It sends a request to the DHCP server whenever a client/node/device,
which is configured to work with DHCP, connects to a network. The
server acknowledges by providing an IP address to the
client/node/device.

DHCP is also used to configure the proper subnet mask, default gateway
and DNS server information on the node or device.

DHCP is an enhancement of an older protocol called BOOTP

How DHCP works


DHCP runs at the application layer of the TCP/IP protocol stack to dynamically assign IP
addresses to DHCP clients/nodes and to allocate TCP/IP configuration information to
the DHCP clients. Information includes subnet mask information, default gateway, IP
addresses and domain name system addresses.

DHCP is based on client-server protocol in which servers manage a pool of unique IP


addresses, as well as information about client configuration parameters, and assign
addresses out of those address pools.

The DHCP lease process works as follows:

o First of all, a client (network device) must be connected to the internet.


o DHCP clients request an IP address. Typically, client broadcasts a query for this
information.
o DHCP server responds to the client request by providing IP server address and
other configuration information. This configuration information also includes
time period, called a lease, for which the allocation is valid.
o When refreshing an assignment, a DHCP clients request the same parameters,
but the DHCP server may assign a new IP address. This is based on the policies
set by the administrator.

Differences between InterDomain Routing and IntraDomain

As we know that Routing is the process of forwarding the information/data


packets from source to the destination but the best route to send the packets is
determined by the routing algorithm.
So on the basis of interaction of domains we can distinguish between both
InterDomain and IntraDomain Routing protocols. Following are the important
differences between InterDomain and IntraDomain Routing.

Sr. Key InterDomain Routing IntraDomain Routing


No.

1 Definition InterDomain Routing as name On other hand IntraDomain as


suggests is the protocol in which name suggests is a protocol in
Routing algorithm works within which Routing algorithm works
and between domains. only within the domains.

2 Information In case of InterDomain the On other hand as IntraDomain


Required interaction is between different Routing has to interact within the
domains so information of domain so only information of
components of other domains is different components within the
also required. domain is required.
Sr. Key InterDomain Routing IntraDomain Routing
No.

3 Protocols In InterDomain Routing Interior- While On other Exterior-gateway


Used gateway protocols such as protocols such as BGP(Border
RIP(resource information Gateway Protocol) are being get
protocol) and OSPF(open used in case of IntraDomain
shortest path first) are being used. Routing.

4 Prerequisite For InterDomain Routing internet On other hand for IntraDomain


within the domain and in domain Routing internet within the domain
with which the interaction is should be connected and available
going on should be connected during the transmission.
and available.

5 Complex and InterDomain Routing is more On other hand as mentioned in


Dependent complex and more dependent as above points the IntraDomain
compared to that of IntraDomain Routing is less complex and less
Routing. interdependent as compared to that
of InterDomain Routing.

Switching Techniques:
Logical addressing:
(https://www.youtube.com/watch?v=zFyl_zaRYuQ)
Address format of IPv4

The address format of IPv4:


What is IPv6?
IPv6 is a 128-bit hexadecimal address made up of 8 sets of 16 bits each, and these
8 sets are separated by a colon. In IPv6, each hexadecimal character represents 4
bits. So, we need to convert 4 bits to a hexadecimal number at a time

The address format of IPv6:

The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit
decimal address. It contains 4 octets or fields separated by 'dot', and each field is 8-
bit in size. The number that each field contains should be in the range of 0-255.
Whereas an IPv6 is a 128-bit hexadecimal address. It contains 8 fields separated by
a colon, and each field is 16-bit in size.
Differences between IPv4 and IPv6

IPv4 IPv6

Address IPv4 is a 32-bit address. IPv6 is a 128-bit address.


length

Fields IPv4 is a numeric address that IPv6 is an alphanumeric


consists of 4 fields which are address that consists of 8
separated by dot (.). fields, which are separated
by colon.

Classes IPv4 has 5 different classes of IP IPv6 does not contain


address that includes Class A, classes of IP addresses.
Class B, Class C, Class D, and
Class E.

Number of IP IPv4 has a limited number of IP IPv6 has a large number of


address addresses. IP addresses.

VLSM It supports VLSM (Virtual It does not support VLSM.


Length Subnet Mask). Here,
VLSM means that Ipv4 converts
IP addresses into a subnet of
different sizes.
Address It supports manual and DHCP It supports manual, DHCP,
configuration configuration. auto-configuration, and
renumbering.

Address space It generates 4 billion unique It generates 340 undecillion


addresses unique addresses.

End-to-end In IPv4, end-to-end connection In the case of IPv6, end-to-


connection integrity is unachievable. end connection integrity is
integrity achievable.

Security In IPv4, security depends on the In IPv6, IPSEC is


features application. This IP address is developed for security
not developed in keeping the purposes.
security feature in mind.

Address In IPv4, the IP address is In IPv6, the representation


representation represented in decimal. of the IP address in
hexadecimal.

Fragmentatio Fragmentation is done by the Fragmentation is done by


n senders and the forwarding the senders only.
routers.

Packet flow It does not provide any It uses flow label field in
identification mechanism for packet flow the header for the packet
identification. flow identification.

Checksum The checksum field is available The checksum field is not


field in IPv4. available in IPv6.

Transmission IPv4 is broadcasting. On the other hand, IPv6 is


scheme multicasting, which
provides efficient network
operations.

Encryption It does not provide encryption It provides encryption and


and and authentication. authentication.
Authenticatio
n

Number of It consists of 4 octets. It consists of 8 fields, and


octets each field contains 2 octets.
Therefore, the total number
of octets in IPv6 is 16.
Classes and Subnetting

Classful Addressing

An IP address is 32-bit long. An IP address is divided into sub-classes:

o Class A
o Class B
o Class C
o Class D
o Class E

An ip address is divided into two parts:

o Network ID: It represents the number of networks.


o Host ID: It represents the number of hosts.

In the above diagram, we observe that each class have a specific range of IP
addresses. The class of IP address is used to determine the number of bits used in a
class and number of networks and hosts available in the class.

Class A

In Class A, an IP address is assigned to those networks that contain a large number


of hosts.

o The network ID is 8 bits long.


o The host ID is 24 bits long.

In Class A, the first bit in higher order bits of the first octet is always set to 0 and
the remaining 7 bits determine the network ID. The 24 bits determine the host ID
in any network.

The total number of networks in Class A = 27 = 128 network address

The total number of hosts in Class A = 224 - 2 = 16,777,214 host address


Class B

In Class B, an IP address is assigned to those networks that range from small-sized


to large-sized networks.

o The Network ID is 16 bits long.


o The Host ID is 16 bits long.

In Class B, the higher order bits of the first octet is always set to 01, and the
remaining14 bits determine the network ID. The other 16 bits determine the Host
ID.

The total number of networks in Class B = 214 = 16384 network address

The total number of hosts in Class B = 216 - 2 = 65534 host address

Class C

In Class C, an IP address is assigned to only small-sized networks.

o The Network ID is 24 bits long.


o The host ID is 8 bits long.

In Class C, the higher order bits of the first octet is always set to 110, and the
remaining 21 bits determine the network ID. The 8 bits of the host ID determine
the host in a network.

The total number of networks = 221 = 2097152 network address

The total number of hosts = 28 - 2 = 254 host address

Class D
In Class D, an IP address is reserved for multicast addresses. It does not possess
subnetting. The higher order bits of the first octet is always set to 1110, and the
remaining bits determines the host ID in any network.

Class E

In Class E, an IP address is used for the future use or for the research and
development purposes. It does not possess any subnetting. The higher order bits of
the first octet is always set to 1111, and the remaining bits determines the host ID
in any network.

NETWORK LAYER PROTOCOLS: ARP

Address Resolution Protocol is a communication protocol used for discovering


physical address associated with given network address. Typically, ARP is a
network layer to data link layer mapping process, which is used to discover MAC
address for given Internet Protocol Address.
In order to send the data to destination, having IP address is necessary but not
sufficient; we also need the physical address of the destination machine. ARP is
used to get the physical address (MAC address) of destination machine.

Before sending the IP packet, the MAC address of destination must be known. If
not so, then sender broadcasts the ARP-discovery packet requesting the MAC
address of intended destination. Since ARP-discovery is broadcast, every host
inside that network will get this message but the packet will be discarded by
everyone except that intended receiver host whose IP is associated. Now, this
receiver will send a unicast packet with its MAC address (ARP-reply) to the
sender of ARP-discovery packet. After the original sender receives the ARP-
reply, it updates ARP-cache and start sending unicast message to the destination.

(https://www.youtube.com/watch?v=-jjMVbxyuGY)
Reverse Address Resolution Protocol (RARP) –

Reverse ARP is a networking protocol used by a client machine in a local area


network to request its Internet Protocol address (IPv4) from the gateway-router’s
ARP table. The network administrator creates a table in gateway-router, which is
used to map the MAC address to corresponding IP address.
When a new machine is setup or any machine which don’t have memory to store
IP address, needs an IP address for its own use. So the machine sends a RARP
broadcast packet which contains its own MAC address in both sender and
receiver hardware address field.
A special host configured inside the local area network, called as RARP-server is
responsible to reply for these kind of broadcast packets. Now the RARP server
attempt to find out the entry in IP to MAC address mapping table. If any entry
matches in table, RARP server send the response packet to the requesting device
along with IP address.
 LAN technologies like Ethernet, Ethernet II, Token Ring and Fiber
Distributed Data Interface (FDDI) support the Address Resolution Protocol.
 RARP is not being used in today’s networks. Because we have much great
featured protocols like BOOTP (Bootstrap Protocol) and DHCP( Dynamic
Host Configuration Protocol).
UNIT-IV
Transport Layer

Introduction to Transport Layer


Transport Layer Protocols
SCTP Services

Some important services provided by SCTP are as stated below:

1. Process-to- Process communication: SCTP uses all important ports of TCP.

2. Multi- Stream Facility: SCTP provides multi-stream service to each connection,


called as association. If one stream gets blocked, then the other stream can deliver
the data.

3.Full- Duplex Communication: SCTP provides full-duplex service ( the data can
flow in both directions at the same time).

4. Connection- Oriented Service: The SCTP is a connection oriented protocol, just


like TCP with the only difference that, it is called association in SCTP. If User1
wants to send and receive message from user2, the steps are:

Step1: The two SCTPs establish the connection with each other.

Step2: Once the connection is established, the data gets exchanged in both
the directions.

Step3: Finally, the association is terminated.

5. Reliability: SCTP uses an acknowledgement mechanism to check the arrival of


data.

Features of SCTP

Some important features of SCTP are as stated below:

1. Transmission Sequence Number (TSN): The unit of data in SCTP is a data


chunk. Data transfer in SCTP is controlled by numbering the data chunks. In SCTP,
TSN is used to assign the numbers to different data chunks.
2. Stream Identifier (SI): The SI is a 16 bit number and starts with 0. In SI, there
are several streams in each association and it is needed to identify them. Each data
chunk needs to carry the SI in the header, so that it is properly placed in its stream
on arrival.

3. Packets: In SCTP, the data is carried out in the form of data chunks and control
information is carried as control chunks. Data chunks and control chunks are
packed together in the packet.

4. Multihoming: Multihoming allows both ends (sender and receiver) to define


multiple IP addresses for communication. But, only one of these can be defined as
primary address and the remaining can be used as alternative addresses

Congestion Control: Techniques for handling the Congestion


Control
(https://www.youtube.com/watch?v=hm9xcPHtmV4)
Quality of Service (QoS) in Computer Network
QoS is an overall performance measure of the computer network.

Important flow characteristics of the QoS are given below:

1. Reliability
If a packet gets lost or acknowledgement is not received (at sender), the re-
transmission of data will be needed. This decreases the reliability.
The importance of the reliability can differ according to the application.
For example:
E- mail and file transfer need to have a reliable transmission as compared to
that of an audio conferencing.

2. Delay
Delay of a message from source to destination is a very important
characteristic. However, delay can be tolerated differently by the different
applications.
For example:
The time delay cannot be tolerated in audio conferencing (needs a minimum
time delay), while the time delay in the e-mail or file transfer has less
importance.

3. Jitter
The jitter is the variation in the packet delay.
If the difference between delays is large, then it is called as high jitter. On the
contrary, if the difference between delays is small, it is known as low jitter.
Example:
Case1: If 3 packets are sent at times 0, 1, 2 and received at 10, 11, 12. Here,
the delay is same for all packets and it is acceptable for the telephonic
conversation.
Case2: If 3 packets 0, 1, 2 are sent and received at 31, 34, 39, so the delay is
different for all packets. In this case, the time delay is not acceptable for the
telephonic conversation.

4. Bandwidth
Different applications need the different bandwidth.
For example:
Video conferencing needs more bandwidth in comparison to that of sending an
e-mail.
Techniques to Improve QoS
 
Some techniques that can be used to improve the quality of service. The four
common methods: scheduling, traffic shaping, admission control, and resource
reservation.
 
a. Scheduling
 
Packets from different flows arrive at a switch or router for processing. A good
scheduling technique treats the different flows in a fair and appropriate manner.
Several scheduling techniques are designed to improve the quality of service. We
discuss three of them here: FIFO queuing, priority queuing, and weighted fair
queuing.
 
i. FIFO Queuing
 
In first-in, first-out (FIFO) queuing, packets wait in a buffer (queue) until the node
(router or switch) is ready to process them. If the average arrival rate is higher than
the average processing rate, the queue will fill up and new packets will be
discarded. A FIFO queue is familiar to those who have had to wait for a bus at a
bus stop.

ii. Priority Queuing


 
In priority queuing, packets are first assigned to a priority class. Each priority class
has its own queue. The packets in the highest-priority queue are processed first.
Packets in the lowest- priority queue are processed last. Note that the system does
not stop serving a queue until it is empty. Figure 4.32 shows priority queuing with
two priority levels (for simplicity).
 
A priority queue can provide better QoS than the FIFO queue because higher
priority traffic, such as multimedia, can reach the destination with less delay.
However, there is a potential drawback. If there is a continuous flow in a high-
priority queue, the packets in the lower-priority queues will never have a chance to
be processed. This is a condition called starvation

 
iii. Weighted Fair Queuing
 
A better scheduling method is weighted fair queuing. In this technique, the packets
are still assigned to different classes and admitted to different queues. The queues,
however, are weighted based on the priority of the queues; higher priority means a
higher weight. The system processes packets in each queue in a round-robin
fashion with the number of packets selected from each queue based on the
corresponding weight. For example, if the weights are 3, 2, and 1, three packets are
processed from the first queue, two from the second queue, and one from the third
queue. If the system does not impose priority on the classes, all weights can be
equal. In this way, we have fair queuing with priority. Figure 4.33 shows the
technique with three classes.
 
b. Traffic Shaping
 
Traffic shaping is a mechanism to control the amount and the rate of the traffic sent
to the network. Two techniques can shape traffic: leaky bucket and token bucket
 
i. Leaky Bucket
 
If a bucket has a small hole at the bottom, the water leaks from the bucket at a
constant rate as long as there is water in the bucket. The rate at which the water
leaks does not depend on the rate at which the water is input to the bucket unless
the bucket is empty. The input rate can vary, but the output rate remains constant.
Similarly, in networking, a technique called leaky bucket can smooth out bursty
traffic. Bursty chunks are stored in the bucket and sent out at an average rate.
Figure 4.34 shows a leaky bucket and its effects.
In the figure, we assume that the network has committed a bandwidth of 3 Mbps
for a host. The use of the leaky bucket shapes the input traffic to make it conform
to this commitment. In Figure 4.34 the host sends a burst of data at a rate of 12
Mbps for 2 s, for a total of 24 Mbits of data. The host is silent for 5 s and then
sends data at a rate of 2 Mbps for 3 s, for a total of 6 Mbits of data. In all, the host
has sent 30 Mbits of data in lOs. The leaky bucket smooth’s the traffic by sending
out data at a rate of 3 Mbps during the same 10 s.

A simple leaky bucket implementation is shown in Figure 4.35. A FIFO queue


holds the packets. If the traffic consists of fixed-size packets (e.g., cells in ATM
networks), the process removes a fixed number of packets from the queue at each
tick of the clock. If the traffic consists of variable-length packets, the fixed output
rate must be based on the number of bytes or bits.
 
The following is an algorithm for variable-length packets:
 
           Initialize a counter to n at the tick of the clock.
 
           If n is greater than the size of the packet, send the packet and decrement the
counter by the packet size. Repeat this step until n is smaller than the packet size.
 
           Reset the counter and go to step 1.
 
A leaky bucket algorithm shapes bursty traffic into fixed-rate traffic by
averaging the data rate. It may drop the packets if the bucket is full.
 
ii. Token Bucket
 
The leaky bucket is very restrictive. It does not credit an idle host. For example, if
a host is not sending for a while, its bucket becomes empty. Now if the host has
bursty data, the leaky bucket allows only an average rate. The time when the host
was idle is not taken into account. On the other hand, the token bucket algorithm
allows idle hosts to accumulate credit for the future in the form of tokens. For each
tick of the clock, the system sends n tokens to the bucket. The system removes one
token for every cell (or byte) of data sent. For example, if n is 100 and the host is
idle for 100 ticks, the bucket collects 10,000 tokens.

The token bucket can easily be implemented with a counter. The token is
initialized to zero. Each time a token is added, the counter is incremented by 1.
Each time a unit of data is sent, the counter is decremented by 1. When the counter
is zero, the host cannot send data.
 
The token bucket allows bursty traffic at a regulated maximum rate.
 
Combining Token Bucket and Leaky Bucket
 
The two techniques can be combined to credit an idle host and at the same time
regulate the traffic. The leaky bucket is applied after the token bucket; the rate of
the leaky bucket needs to be higher than the rate of tokens dropped in the bucket.
 
c. Resource Reservation
 
A flow of data needs resources such as a buffer, bandwidth, CPU time, and so on.
The quality of service is improved if these resources are reserved beforehand. We
discuss in this section one QoS model called Integrated Services, which depends
heavily on resource reservation to improve the quality of service.
 
d.  Admission Control
 
Admission control refers to the mechanism used by a router, or a switch, to accept
or reject a flow based on predefined parameters called flow specifications. Before a
router accepts a flow for processing, it checks the flow specifications to see if its
capacity (in terms of bandwidth, buffer size, CPU speed, etc.) and its previous
commitments to other flows can handle the new flow.

RSA Encryption Algorithm


RSA encryption algorithm is a type of public-key encryption algorithm. To better
understand RSA, lets first understand what is public-key encryption algorithm.

Public key encryption algorithm:

Public Key encryption algorithm is also called the Asymmetric algorithm.


Asymmetric algorithms are those algorithms in which sender and receiver use
different keys for encryption and decryption. Each sender is assigned a pair of
keys:

o Public key
o Private key

The Public key is used for encryption, and the Private Key is used for decryption.
Decryption cannot be done using a public key. The two keys are linked, but the
private key cannot be derived from the public key. The public key is well known,
but the private key is secret and it is known only to the user who owns the key. It
means that everybody can send a message to the user using user's public key. But
only the user can decrypt the message using his private key.

The Public key algorithm operates in the following manner:

o The data to be sent is encrypted by sender A using the public key of the


intended receiver
o B decrypts the received ciphertext using its private key, which is known
only to B.

RSA encryption algorithm:

RSA is the most common public-key algorithm, named after its


inventors Rivest, Shamir, and Adelman (RSA).
RSA algorithm uses the following procedure to generate public and private
keys:
OR e.d mod 𝜙 (n) = 1
Example 1:

This example shows how we can encrypt plaintext 9 using the RSA public-key
encryption algorithm. This example uses prime numbers 7 and 11 to generate the
public and private keys.

Explanation:

Step 1: Select two large prime numbers, p, and q.

p=7

q = 11

Step 2: Multiply these numbers to find n = p x q, where n is called the modulus


for encryption and decryption.

First, we calculate

n=pxq

n = 7 x 11

n = 77

Step 3: Choose a number e less that n, such that n is relatively prime to (p - 1) x (q


-1). It means that e and (p - 1) x (q - 1) have no common factor except 1. Choose
"e" such that 1<e < φ (n), e is prime to φ (n), gcd (e, d (n)) =1.

Second, we calculate

φ (n) = (p - 1) x (q-1)

φ (n) = (7 - 1) x (11 - 1)

φ (n) = 6 x 10

φ (n) = 60

Let us now choose relative prime e of 60 as 7.

Thus the public key is <e, n> = (7, 77)


Step 4: A plaintext message m is encrypted using public key <e, n>. To find
ciphertext from the plain text following formula is used to get ciphertext C.

To find ciphertext from the plain text following formula is used to get ciphertext C.

C = me mod n

C = 97 mod 77

C = 37

Step 5: The private key is <d, n>. To determine the private key, we use the
following formula d such that:

De mod {(p - 1) x (q - 1)} = 1

7d mod 60 = 1, which gives d = 43

The private key is <d, n> = (43, 77)

Step 6: A ciphertext message c is decrypted using private key <d, n>. To calculate
plain text m from the ciphertext c following formula is used to get plain text m.

m = cd mod n

m = 3743 mod 77

m=9

In this example, Plain text = 9 and the ciphertext = 37


DNS

An application layer protocol defines how the application processes running on


different systems, pass the messages to each other.

o DNS stands for Domain Name System.


o DNS is a directory service that provides a mapping between the name of a
host on the network and its numerical address.
o DNS is required for the functioning of the internet.
o Each node in a tree has a domain name, and a full domain name is a
sequence of symbols specified by dots.
o DNS is a service that translates the domain name into IP addresses. This
allows the users of networks to utilize user-friendly names when looking for
other hosts instead of remembering the IP addresses.
o For example, suppose the FTP site at EduSoft had an IP address of
132.147.165.50, most people would reach this site by specifying
ftp.EduSoft.com. Therefore, the domain name is more reliable than IP
address.

Example
Domain name = www.example.com whose Server IP address is,
say = 253.136.27.2
Working of DNS
The working of DNS is explained below in stepwise manner −
Step 1 − Every website has a domain name/ IP address associated with it.
Step 2 − Now IP is a bit complicated to share (as no one wants to write
192.168.224.23 or some random IP to access Tutorials point) so people came up
with an idea of domain names which basically stores the IP address mapped to
their name.
Step 3 − Now, a DNS translates every domain name to its IP address so every
browser can access that particular website.
Step 4 − DNS has eased the process of web surfing as we write tutorialspoint.com
to reach a website instead of some complicated 32-128 bit address.
Given below is the diagram of DNS −
TLD = TOP LEVEL DOMAIN NAME

What is World Wide Web?

World Wide Web, which is also known as a Web, is a collection of websites or


web pages stored in web servers and connected to local computers through the
internet. These websites contain text pages, digital images, audios, videos, etc.
Users can access the content of these sites from any part of the world over the
internet using their devices such as computers, laptops, cell phones, etc. The
WWW, along with internet, enables the retrieval and display of text and media to
your device.
The building blocks of the Web are web pages which are formatted in HTML and
connected by links called "hypertext" or hyperlinks and accessed by HTTP. These
links are electronic connections that link related pieces of information so that users
can access the desired information quickly. Hypertext offers the advantage to
select a word or phrase from text and thus to access other pages that provide
additional information related to that word or phrase.

A web page is given an online address called a Uniform Resource Locator (URL).
A particular collection of web pages that belong to a specific URL is called a
website, e.g., www.facebook.com, www.google.com, etc. So, the World Wide Web
is like a huge electronic book whose pages are stored on multiple servers across the
world.

(https://www.youtube.com/watch?v=B9T2C64uN7Q)
HTTP
o HTTP stands for HyperText Transfer Protocol.
o It is a protocol used to access the data on the World Wide Web (www).
o The HTTP protocol can be used to transfer the data in the form of plain text,
hypertext, audio, video, and so on.
o This protocol is known as HyperText Transfer Protocol because of its
efficiency that allows us to use in a hypertext environment where there are
rapid jumps from one document to another document.
o HTTP is similar to the FTP as it also transfers the files from one host to
another host. But, HTTP is simpler than FTP as HTTP uses only one
connection, i.e., no control connection to transfer the files.
o HTTP is used to carry the data in the form of MIME-like format.
o HTTP is similar to SMTP as the data is transferred between client and
server. The HTTP differs from the SMTP in the way the messages are sent
from the client to the server and from server to the client. SMTP messages
are stored and forwarded while HTTP messages are delivered immediately.
o HTTP Transactions

o
o The above figure shows the HTTP transaction between client and server.
The client initiates a transaction by sending a request message to the server.
The server replies to the request message by sending a response message.
o Messages
o HTTP messages are of two types: request and response. Both the message
types follow the same message format.
o
o Request Message: The request message is sent by the client that consists of
a request line, headers, and sometimes a body.

o
o Response Message: The response message is sent by the server to the client
that consists of a status line, headers, and sometimes a body.

Uniform Resource Locator (URL)

o A client that wants to access the document in an internet needs an address


and to facilitate the access of documents, the HTTP uses the concept of
Uniform Resource Locator (URL).
o The Uniform Resource Locator (URL) is a standard way of specifying any
kind of information on the internet.
o The URL defines four parts: method, host computer, port, and path.
o Method: The method is the protocol used to retrieve the document from a
server. For example, HTTP.
o Host: The host is the computer where the information is stored, and the
computer is given an alias name. Web pages are mainly stored in the
computers and the computers are given an alias name that begins with the
characters "www". This field is not mandatory.
o Port: The URL can also contain the port number of the server, but it's an
optional field. If the port number is included, then it must come between the
host and path and it should be separated from the host by a colon.
o Path: Path is the pathname of the file where the information is stored. The
path itself contain slashes that separate the directories from the
subdirectories and files.

Email

Email is a service which allows us to send the message in electronic mode over
the internet. It offers an efficient, inexpensive and real time mean of distributing
information among people.

E-Mail Address

Each user of email is assigned a unique name for his email account. This name is
known as E-mail address. Different users can send and receive messages
according to the e-mail address.
E-mail is generally of the form username@domainname. For example,
webmaster@tutorialspoint.com is an e-mail address where webmaster is username
and tutorialspoint.com is domain name.
 The username and the domain name are separated by @ (at) symbol.
 E-mail addresses are not case sensitive.
 Spaces are not allowed in e-mail address.
FTP

o FTP stands for File transfer protocol.


o FTP is a standard internet protocol provided by TCP/IP used for transmitting
the files from one host to another.
o It is mainly used for transferring the web page files from their creator to the
computer that acts as a server for other computers on the internet.
o It is also used for downloading the files to computer from other servers.

Objectives of FTP

o It provides the sharing of files.


o It is used to encourage the use of remote computers.
o It transfers the data more reliably and efficiently.

Why FTP?

Although transferring files from one system to another is very simple and
straightforward, but sometimes it can cause problems. For example, two systems
may have different file conventions. Two systems may have different ways to
represent text and data. Two systems may have different directory structures. FTP
protocol overcomes these problems by establishing two connections between hosts.
One connection is used for data transfer, and another connection is used for the
control connection.

Mechanism of FTP

The above figure shows the basic model of the FTP. The FTP client has three
components: the user interface, control process, and data transfer process. The
server has two components: the server control process and the server data transfer
process.

There are two types of connections in FTP:

o Control Connection: The control connection uses very simple rules for


communication. Through control connection, we can transfer a line of
command or line of response at a time. The control connection is made
between the control processes. The control connection remains connected
during the entire interactive FTP session.
o Data Connection: The Data Connection uses very complex rules as data
types may vary. The data connection is made between data transfer
processes. The data connection opens when a command comes for
transferring the files and closes when the file is transferred.

You might also like