Professional Documents
Culture Documents
Digital Notes
Reference No./MCA/Ayush/KCA-303/2/3
Page |1
INDEX
Unit-1
1.1 Data Communication
1.1.1 Component of Data Communication
1.2 Computer Network
1.2.1Local Area Network
1.2.2 Metropolitan Area Network
1.2.3 Wide Area Network
1.3 Topology
1.3.1 Mesh Topology
1.3.2 Star Topology
1.3.3 Bus Topology
1.3.4 Ring Topology
1.3.5 Hybrid Topology
1.4 Transmission mode or channel
1.4.1 Simplex Channel
1.4.2 Half Duplex Channel
1.4.3 Full Duplex Channel
1.5 Network Standards
1.5.1 Standards Organizations
1.6 OSI Model
1.6.1 Physical Layer
1.6.1.1 Bit synchronization
1.6.1.2 Bit rate control
1.6.2 Data-Link Layer
1.6.2.1 Framing
1.6.2.2 Physical addressing
1.6.3 Network Layer
1.6.3.1 Routing
1.6.4 Transport Layer
1.6.4.1 Segmentation and Reassembly
1.6.4.2 Port Addressing
Page |2
1.6.5 Session Layer
1.6.5.1 Synchronization
1.6.5.2 Dialog Controller
1.6.6 Presentation Layer
1.6.6.1 Translation
1.6.6.2 Encryption/ Decryption
1.6.7 Application Layer
1.6.7.1 Mail services
1.7 TCP/IP Model
1.7.1Network Access Layer
1.7.2 Internet Layer
1.7.3 Transport Layer
1.7.4 Application Layer
1.8 Difference between TCP/IP and OSI Model
1.9 Transmission Media
1.9.1 Types of transmission media
1.9.1.1 Guided Media
1.9.1.2 Unguided Media
1.10 Network Connecting Devices
Unit-2
2.1 Error Detection
2.1.1 Error detection Methods
2.1.1.1 Single Parity Check
2.1.1.2 Checksum
2.1.1.3 Cyclic Redundancy Check
2.2 Error Correction
2.2.1 Hamming Code
2.3 Flow Control
2.2.1 Stop and Wait ARQ
2.2.2 Go back N ARQ Protocol
2.2.3 Selective Repeat ARQ Protocol
Page |3
2.3 Multiple Access Protocol
2.3.1 Random Access Protocol
2.3.1.1 Aloha
2.3.1.2 CSMA
2.3.1.2 Controlled Access Protocol
Unit-3
3.1 Switching
3.1.1 Switching Techniques
3.1.1.1 Circuit Switching
3.1.1.2 Message Switching
3.1.1.3 Packet Switching
3.1.2 Difference between Circuit Switching and Packet Switching
3.2 IP Address
3.2.1 Private IP addresses
3.2.2 Public IP addresses
3.2.3 Classful Addressing
3.2.4 Subnetting
3.2.5 Difference b/w IPv4 and IPv6
3.2 ARP
3.3 RARP
3.4 BOOTP
3.5 DHCP
3.6 Routing algorithm
Page |4
Unit-4
4.1 INTRODUCTION
4.2 PROCESS-TO-PROCESS DELIVERY
4.3 Transport Layer Protocols
4.3.1 UDP
4.3.2 TCP
4.3.2.1 TCP Retransmission
4.3.2.2 TCP Connection Termination
4.3.2.3 Three Way Handshake
4.3.2.4 TCP Congestion Control
4.3.2.5 TCP Congestion Policy
4.3.3 SCTP
4.4 Congestion Control
4.4.1 Open Loop Congestion Control
4.4.2 Closed Loop Congestion Control
4.5 Quality of Service (QoS)
Unit-5
5.1 Cryptography
5.1.1 SECURITY SERVICES
5.1.2 Encryption/Decryption
Page |5
5.1.3 Secret Key Encryption/Decryption technique
5.1.4 Symmetric Key Cryptography
5.1.1.1 Data Encryption Standard (DES)
5.1.5 Public Key Encryption/Decryption technique
5.1.5.1 RSA encryption algorithm
5.2.1 DNS
5.2.2 FTP
5.2.3 SMTP
5.2.4 SNMP
5.2.5 HTTP
References:
1. Behrouz Forouzan, “Data Communication and Networking”, McGraw Hill.
2. Andrew Tanenbaum “Computer Networks”, Prentice Hall.
3. Behrouz Forouzan, “TCP/IP Protocol Suite”, McGraw Hill.
Page |6
Unit-1
Data Communication
When we communicate, we are sharing information. This sharing can be local or remote.
• Local communication occurs face to face communication example -talking individual
people.
• Remote communication takes place over distance example -Telephone, Television,
Telegraph etc.
The word telecommunication means communication at a distance.
Tele is the Greek word meaning “far”.
“Data Communication is the exchange of data between two devices via some form of
transmission medium such as a wire cable.”
The communicating devices must be part of communication system made up of a combination
of hardware and software.
Characteristics -
The characteristics of data communication are delivery, Accuracy and timeliness.
• Delivery
The system must deliver data to the correct destination. Data must be received by the
intended or user.
• Accuracy
The system must deliver the data accurately. Data that have been altered in transmission
and left uncorrected are unusable.
• Timeliness
The system must deliver data in a timely manner. Data delivered late are useless.
• Message
The message is the information (data) to be communicated. It can consist of text,
number, picture, sound or video or any combination of these.
• Sender
The sender is the device that sends the message. It can be a computer, workstation,
telephone handset, television and so on.
• Receiver
The receiver is the device that receives the message. It can be a computer,
workstation, telephone handset, television and so on.
Page |7
• Medium
The transmission medium is the physical path by which a message travels from sender
to receiver. It could be a twisted-pair wire, coaxial cable, fiberoptic cable or radio wave.
• Protocol
A protocol is a set of rules that governs data communication. It represents an agreement
between the communicating devices.
Without a protocol, two devices may be connected but not communicating, just as a
person speaking French cannot be understood by a person who speaks only Japanese.
A typical example of a data communication system is sending an e-mail. The user which send
email act as sender, message is data which user wants to send, receive is one whom user wants
to send message, there are many protocols involved in this entire process, one of them is Simple
Mail Transfer Protocol (SMTP), both sender and receiver must have an internet connection
which uses a wireless medium to send and receive email.
Computer Network:
A computer network is a group of computers linked to each other that enables the computer to
communicate with another computer and share their resources, data, and applications.
A computer network can be categorized by their size. A computer network is mainly of three
types:
Page |8
▪ LAN is used for connecting two or more personal computers through a communication
medium such as twisted pair, coaxial cable, etc.
▪ It is less costly as it is built with inexpensive hardware such as hubs, network adapters,
and Ethernet cables.
▪ The data is transferred at an extremely faster rate in Local Area Network.
▪ Local Area Network provides higher security.
Page |9
• It can also be used for communication in the military.
Examples of wide area network are mobile broadband and private network.
Advantages of Wide Area Network -There are following advantages of the Wide
P a g e | 10
Area Network:
1. Geographical area
2. Centralized data
3. Get updated files
4. Exchange messages
5. Sharing of software and resources
6. Global business
7. High bandwidth
Disadvantages of Wide Area Network -There are following disadvantages of the Wide Area
Network:
• Security issue
• Needs Firewall & antivirus software
• High Setup cost
• Troubleshooting problems
Internetwork -An internetwork is defined as two or more computer network LANs or WAN
or computer network segments are connected using devices, and they are configured by a local
addressing scheme. This process is known as internetworking.
Types of Internetwork -
Intranet: An intranet is a private network based on the internet protocol such as TCP/IP. An
intranet belongs to an organization which is only accessible by the organization’s employee.
Topology: Topology defines the structure of the network of how all the components are
interconnected to each other. There are two types of topology: physical and logical topology.
P a g e | 11
Physical Topology -Physical topology is the geometric representation of all the nodes in
a network.
Mesh Topology:
P a g e | 12
• Fully connected mesh topology
• Partially connected mesh topology
Full Mesh Topology: In a full mesh topology, each computer is connected to all the computers
available in the network.
Partial Mesh Topology: In a partial mesh topology, not all but certain computers are
connected to those computers with which they communicate frequently.
Advantage–
• It is robust.
• Fault is diagnosed easily. Data is reliable because data is transferred among the devices
through dedicated channels or links.
• Provides security and privacy.
Disadvantage–
Star Topology:
• Star topology is an arrangement of the network in which every node is connected to the
central hub, switch or a central computer.
• The central computer is known as a server, and the peripheral devices attached to the
server are known as clients.
• Hubs or Switches are mainly used as connection devices in a physical star topology.
• Number of cables required by star topology is n.
• Number of ports required by each device is 1.
• Hub is multiport devices.
P a g e | 13
Where n is the number of devices that represents the network.
Advantages –
• It is less expensive than mesh topology.
• It is easy to setup.
Disadvantages –
• Cost of installation is high.
• If the Hub gets damage whole transmission stop.
Bus Topology:
▪ The bus topology is designed in such a way that all the stations are connected through
a single cable known as a backbone cable.
▪ Each node is either connected to the backbone cable by drop cable or directly connected
to the backbone cable.
▪ When a node wants to send a message over the network, it puts a message over the
network. All the stations available in the network will receive the message whether it
has been addressed or not
P a g e | 14
Advantage -
• It is cost effective.
• Cable required is least compared to other network topology.
• Used in small networks.
• It is easy to understand.
• Easy to expand joining two cables together.
Disadvantage -
Ring Topology:
• Ring topology is like a bus topology, but with connected ends.
• The node that receives the message from the previous computer will retransmit to the
next node.
• The data flows in one direction, i.e., it is unidirectional.
• It has no terminated ends, i.e., each node is connected to other node and having no
termination point.
• The data in a ring topology flow in a clockwise direction.
Advantage -
P a g e | 15
▪ The possibility of collision is minimum in this type of topology.
▪ Cheap to install and expand.
Disadvantage -
Tree Topology:
• Tree topology combines the characteristics of bus topology and star topology.
• A tree topology is a type of structure in which all the computers are connected with
each other in hierarchical fashion.
• The top-most node in tree topology is known as a root node, and all other nodes are the
descendants of the root node.
• There is only one path exists between two nodes for the data transmission. Thus, it
forms a parent-child hierarchy.
Advantage -
Disadvantage -
• Heavily cabled.
• Costly.
• If more nodes are added maintenance is difficult.
P a g e | 16
• Central hub fails, network fails.
Hybrid Topology:
• The combination of various different topologies is known as Hybrid topology.
• A Hybrid topology is a connection between different links and nodes to transfer the
data.
• When two or more different topologies are combined together is termed as Hybrid
topology and if similar topologies are connected with each other will not result in
Hybrid topology.
Advantage -
Disadvantage -
• Complex in design.
• Costly.
P a g e | 17
Transmission mode refers to the mechanism of transferring of data between two devices
connected over a network. It is also called Communication Mode.
• Simplex channel
• Half duplex channel
• Full duplex channel
Simplex Channel
-
• A simplex communication channel can send the signals only in one direction.
• Thus, entire bandwidth of the channel can be used during the transmission.
Example –
Example-
P a g e | 18
• When the button is pressed, transmitter cannot hear the receiver but receiver can hear
the transmitter.
Example-
Network Standards:
Networking standards define the rules for data communications that are needed for
interoperability of networking technologies and processes. Standards help in creating and
maintaining open markets.
Types of Standards -Standards are of two types -
• De facto − These are the standards that are followed without any formal plan or
approval by any organization. They have come into existence due to traditions or facts.
For example, the HTTP had started as a de facto standard.
• De jure − These standards are the ones which have been adopted through legislation
by any officially recognized standards organization. Most of the communication
standards that are used today are de jure standards.
Standards Organizations:
Some of the standards organizations are
• International Standards Organization (ISO)
P a g e | 19
• International Telecommunication Union (ITU)
• Institute of Electronics and Electrical Engineers (IEEE)
• American National Standards Institute (ANSI)
• Internet Research Task Force (IETF)
• Electronic Industries Association (EIA)
P a g e | 20
Electronics Industry Association (EIA)
EIA is a non-profit U.S. trade association that establishes and recommends industrial standards.
EIA activities include standards development, increasing public awareness, and lobbying and
it is responsible for developing the RS (recommended standard) series of standards for data
and communications.
OSI Model:
• OSI stands for Open System Interconnection is a reference model that describes how
information from a software application in one computer moves through a physical
medium to the software application in another computer.
• OSI model was developed by the International Organization for Standardization (ISO)
in 1984.
• OSI consists of seven layers, and each layer performs a particular network function.
• OSI model divides the whole task into seven smaller and manageable tasks. Each layer
is assigned a particular task.
• Each layer is self-contained, so that task assigned to each layer can be performed
independently.
P a g e | 21
The physical layer, data link layer and the network layer are the network support layers. Session
layer, presentation layer, and application layer are the user support layers. Transport layer links
the two groups.
There are the seven OSI layers. Each layer has different functions. Lists of seven layers are
given below:
1. Physical Layer
2. Data-Link Layer
3. Network Layer
4. Transport Layer
5. Session Layer
6. Presentation Layer
7. Application Layer
Physical Layer-It is responsible for transmitting individual bits from one node to the next
node over a physical medium.
P a g e | 22
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.
• Signals: It determines the type of the signal used for transmitting the information.
• Topology: It defines the way how network devices are arranged.
Data-Link Layer – This layer is responsible for transmitting frames from one node to the
next node.
• Access control: When two or more devices are connected to the same communication
channel, then the data link layer protocols are used to determine which device has control over
the link at a given time.
Network Layer – This layer is responsible for delivery packets from original source to
final destination.
Transport Layer – This layer is responsible delivery of entire message from source host to
destination host.
P a g e | 23
• Segmentation and Reassembly: This layer accepts the message from the (session)
layer, breaks the message into smaller units. Each of the segments produced has a
header associated with it. The transport layer at the destination station reassembles the
message.
• Port 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.
Session Layer -It establishes sessions between users and offers services like dialog control
and synchronization.
• Dialog Controller: The session layer allows two systems to start communication with each
other in half-duplex or full-duplex.
• Synchronization: Session adds checkpoints when transmitting the data in a sequence.
If some error occurs in the middle of the transmission of data, then the transmission
will take place again from the checkpoint. This process is known as Synchronization.
Presentation Layer -This layer was designed to handle the syntax and semantics of the
information exchanged between the two systems. It was designed for data translation,
encryption, decryption and compression.
Application Layer– This layer is responsible for providing services to the user.
Such services are electronic mail, remote file access and transfer, access to the World Wide
Web.
The functions of the application layer are:
P a g e | 24
• File transfer, access, and management: An application layer allows a user to access
the files in a remote computer, to retrieve the files from a computer and to manage the
files in a remote computer.
• Mail services: An application layer provides the facility for email forwarding and
storage.
P a g e | 25
TCP/IP Model:
It was designed and developed by Department of Defense (DoD) in 1960s and is based on
standard protocols. It stands for Transmission Control Protocol/Internet Protocol.TCP/IP is a
suite of communication protocols used to interconnect network devices on the internet.
TCP/IP model is a concise version of the OSI model. It contains four layers, unlike seven
layers in the OSI model. The layers are:
• Process/Application Layer
• Host-to-Host/Transport Layer
• Internet Layer
• Network Access/Link Layer
P a g e | 26
Internet Layer
Transport Layer
• The transport layer is responsible for the reliability, flow control, and correction of data
which is being sent over the network.
• It divides the message received from the session layer into segments and numbers them
to make a sequence.
• Transport layer makes sure that the message is delivered to the correct process on the
destination machine.
• It also makes sure that the entire message arrives without any error else it should be
retransmitted.
• The protocols used by this layer are UDP, TCP.
Application Layer
• An application layer is the topmost layer in the TCP/IP model.
• It is responsible for handling high-level protocols, issues of representation.
• This layer allows the user to interact with the application.
• When one application layer protocol wants to communicate with another application
layer, it forwards its data to the transport layer.
• The protocols used by this layer are HTTP, SNMP, SMTP, DNS, and FTP.
P a g e | 27
Difference between TCP/IP and OSI Model:
5. In network layer TCP/IP only provides 5. In network layer OSI provides both
connection less service. connection oriented and connection less
service.
6. In Transport layer TCP/IP provides both 6. In Transport layer OSI only provides
connection oriented and connection less connection oriented service.
service.
7. In OSI session and presentation layer are 7. In TCP/IP both session and presentation
different layer. layer are application layer itself.
8.In OSI transport layer guarantees the 8.In TCP/IP transport layer does not
delivery of packets guarantees delivery of packets
Transmission Media
Transmission medium is a physical path between the transmitter and the receiver i.e it is the
channel through which data is sent from one place to another.
Transmission media is a communication channel that carries the information from the sender
to the receiver. Data is transmitted through the electromagnetic signals.
The electrical signals can be sent through the copper wire, fibre optics, atmosphere, water, and
vacuum.
P a g e | 28
Types of transmission media: Transmission media are of two types −
Guided Media
It is defined as the physical medium through which the signals are transmitted i.e. data travels
through cabling system that has a fixed path. It is also called as Bounded media or wired media.
Twisted pair is a physical media made up of a pair of cables twisted with each other. A twisted
pair cable is cheap as compared to other transmission media. Installation of the twisted pair
cable is easy, and it is a lightweight cable. The frequency range for twisted pair cable is from
0 to 3.5 KHz.
P a g e | 29
Unshielded Twisted Pair:
Advantage:
• It is cheap.
• Installation of the unshielded twisted pair is easy.
• It can be used for high-speed LAN.
Disadvantage:
• This cable can only be used for shorter distances because of attenuation.
A shielded twisted pair is a cable that contains the mesh surrounding the wire that allows the
higher transmission rate.
Advantage:
• An installation of STP is easy.
• It has higher capacity as compared to unshielded twisted pair cable.
• It has a higher attenuation.
• It is shielded that provides the higher data transmission rate.
Disadvantage:
• It is more expensive as compared to UTP and coaxial cable.
• It has a higher attenuation rate.
Difference between Unshielded Twisted Pair (UTP) and Shielded Twisted Pair (STP)
UTP STP
1. UTP stands for Unshielded twisted pair. 1. STP stands for Shielded twisted pair.
2. Data rate in UTP is slow compared to STP. 2. Data rate in STP is high.
P a g e | 30
3. The cost of UTP is less. 3. STP is costlier than UTP.
Coaxial Cable
• Coaxial cable is very commonly used transmission media, for example, TV wire is
usually a coaxial cable.
• The name of the cable is coaxial as it contains two conductors parallel to each other.
• It has a higher frequency as compared to twisted pair cable.
• The inner conductor of the coaxial cable is made up of copper, and the outer
conductor is made up of copper mesh. The middle core is made up of non-
conductive cover that separates the inner conductor from the outer conductor.
• The middle core is responsible for the data transferring whereas the copper mesh
prevents from the EMI (Electromagnetic interference).
Advantage:
P a g e | 31
• The data can be transmitted at high speed.
• It has better shielding as compared to twisted pair cable.
• It provides higher bandwidth.
Disadvantage:
• It is more expensive as compared to twisted pair cable.
• If any fault occurs in the cable causes the failure in the entire network.
Fibre Optic
• Fibre optic cable is a cable that uses electrical signals for communication.
• Fibre optic is a cable that holds the optical fibres coated in plastic that are used to send the
data by pulses of light.
• The plastic coating protects the optical fibres from heat, cold, electromagnetic interference
from other types of wiring.
• Fibre optics provides faster data transmission than copper wires.
Advantages:
Disadvantages:
Unguided Media
P a g e | 32
Unguided signals can travel in three ways −
• Ground propagation
• Sky propagation
• Line – of – sight propagation
Radio wave
• Radio waves are the electromagnetic waves that are transmitted in all the directions
of free space.
• Radio waves are omnidirectional, i.e., the signals are propagated in all the
directions.
• The range in frequencies of radio waves is from 3 KHz to 1 kHz.
• An example of the radio wave is FM radio.
P a g e | 33
Microwave
• Microwaves are the electromagnetic waves having the frequency in the range from
1GHz to 1000 GHz.
• Microwaves are unidirectional as the sending and receiving antenna is to be aligned.
• It works on the line of sight transmission.
Infrared
P a g e | 34
equipment needed to perform all possible processing and data communication in between the
inter network. These connecting devices are:
Hub
A Hub is a hardware device that divides the network connection among multiple devices.
When computer requests for some information from a network, it first sends the request to the
Hub through cable. Hub will broadcast this request to the entire network. All the devices will
check whether the request belongs to them or not. If not, the request will be dropped.
The process used by the Hub consumes more bandwidth and limits the amount of
communication.
Switch
Router
• A router is a hardware device which is used to connect a LAN with an internet
connection. It is used to receive, analyze and forward the incoming packets to
another network.
• A router works in a Layer 3 (Network layer) of the OSI Reference model.
P a g e | 35
• A router forwards the packet based on the information available in the routing
table.
• It determines the best path from the available paths for the transmission of the
packet.
Bridge
A Bridge in the computer network is used to unite two or more network segments. The main
function of a bridge in network architecture is to store as well as transmit frames among the
various segments. Bridges use MAC (Media Access Control) hardware for transferring frames.
These are also used for connecting two physical local area networks to a larger logical local
area network. In the OSI model, bridges work at the data link & physical layers to divide the
networks from larger to smaller by controlling the data flow between the two.
Modem
• A modem is a hardware device that allows the computer to connect to the internet
over the existing telephone line.
• A modem is not integrated with the motherboard rather than it is installed on the
PCI slot found on the motherboard.
• It stands for Modulator/Demodulator. It converts the digital data into an analog
signal over the telephone lines.
P a g e | 36
Repeater
The operating of a repeater can be done at the physical layer. The main function of this device
is to reproduce the signal on a similar network before the signal gets weak otherwise damaged.
The significant point to be noted regarding these devices is that they do not strengthen the
signal. Whenever the signal gets weak, then they reproduce it at the actual strength. A repeater
is a two-port device.
Gateway
A gateway is a node or a device that servers as an entrance to another network. The gateway
routes the traffic from a workstation to the outside network that is in the network or in the
websites. The gateway is used to connect the users to the internet. The gateway also acts as a
firewall in the network.
P a g e | 37
Wired LAN
A wired network uses cables to connect devices, such as laptop or desktop computers, to the
Internet or another network. A wired network has some disadvantages when compared to a
wireless network. The biggest disadvantage is that your device is tethered to a router. The
most common wired networks use cables connected at one end to an Ethernet port on the
network router and at the other end to a computer or other device.
“An electronic circuit or hardware grouping in which the configuration is determined by the
physical interconnection of the components”
Wireless LAN
Wireless LAN ƒ Communications that take place without the use of interconnecting wires
or cables, such as by radio, microwave, or infrared light ƒ Wireless networks can be installed:
o Peer-to-peer “Ad hoc” mode—wireless devices can communicate with each other o
"Infrastructure" mode—allows wireless devices to communicate with a central node that can
communicate with wired nodes on that LAN
Benefits -
• Convenience: Access your network resources from any location within your wireless
network's coverage area or from any Wi-Fi hotspot.
• Mobility: You're not tied to your desk, as you are with a wired connection. You and
your employees can go online in conference room meetings, for example.
P a g e | 38
• Productivity: Wireless access to the Internet and to your company's key applications
and resources helps your staff get the job done and encourages collaboration.
• Easy setup: You don't have to string cables, so installation can be quick and cost
effective.
• Expandability: You can easily expand wireless networks with existing equipment,
whereas a wired network might require additional wiring.
• Security: Advances in wireless networks provide robust security protections.
• Reduced cost: Because wireless networks eliminate or reduce wiring expenses, they
can cost less to operate than wired networks.
Unit-2
Error Detection
When sender transmits data to the receiver, the data might get scrambled by noise or data might
get corrupted during the transmission.
Error detection is a technique that is used to check if any error occurred in the data during the
transmission.
P a g e | 39
1. Single Parity Check
2. Cyclic Redundancy Check (CRC)
3. Checksum
Advantage-
• This technique is guaranteed to detect an odd number of bit errors (one, three, five
and so on).
Disadvantage-
• This technique cannot detect an even number of bit errors (two, four, six and so on).
Vertical redundancy check is maintenance of parity bit. An additional bit is added with
original block to ensure that data transmitted correctly. It is also known as parity check
technique.
In VRC there are two types of parity bit “Even parity bit” and “Odd parity bit“.
P a g e | 40
Example Even Parity Bit:
P a g e | 41
Checksum
Error detection using checksum method involves the following steps-
Step-01:
At sender side,
• If m bit checksum is used, the data unit to be transmitted is divided into segments of m
bits.
• All the m bit segments are added.
• The result of the sum is then complemented using 1’s complement arithmetic.
• The value so obtained is called as checksum.
Step-02:
• The data along with the checksum value is transmitted to the receiver.
Step-03:
At receiver side,
• If m bit checksum is being used, the received data unit is divided into segments of m
bits.
• All the m bit segments are added along with the checksum value.
• The value so obtained is complemented and the result is checked.
Case-02:
If the result is non-zero,
• Receiver assumes that error occurred in the data during the transmission.
• Receiver discards the data and asks the sender for retransmission.
Example-
P a g e | 42
Step-01:
At sender side,
The given data unit is divided into segments of 8 bits as-
Now, all the segments are added and the result is obtained as-
• 10011001 + 11100010 + 00100100 + 10000100 = 1000100011
• Since the result consists of 10 bits, so extra 2 bits are wrapped around.
• 00100011 + 10 = 00100101 (8 bits)
• Now, 1’s complement is taken which is 11011010.
• Thus, checksum value = 11011010
Step-02:
• The data along with the checksum value is transmitted to the receiver.
Step-03:
At receiver side,
• The received data unit is divided into segments of 8 bits.
• All the segments along with the checksum value are added.
• Sum of all segments + Checksum value = 00100101 + 11011010 = 11111111
• Complemented value = 00000000
• Since the result is 0, receiver assumes no error occurred in the data and therefore
accepts it.
CRC Generator-
• CRC generator is an algebraic polynomial represented as a bit pattern.
P a g e | 43
• Bit pattern is obtained from the CRC generator using the following rule-
The power of each term gives the position of the bit and the coefficient gives the value of the
bit.
Example-
The algebraic polynomial chosen as a CRC generator should have at least the following
properties-
Rule-01:
Rule-02:
P a g e | 44
Important Notes-
• The newly formed code word (Original data + CRC) is transmitted to the receiver.
At receiver side,
• The transmitted code word is received.
• The received code word is divided with the same CRC generator.
• On division, the remainder so obtained is checked.
Case-01: Remainder = 0
P a g e | 45
• Receiver accepts the data.
Case-02: Remainder ≠ 0
Problem-01:
A bit stream 1101011011 is transmitted using the standard CRC method. The generator
polynomial is x4+x+1. What is the actual bit string transmitted?
Solution-
P a g e | 46
• So, a string of 4 zeroes is appended to the bit stream to be transmitted.
• The resulting bit stream is 11010110110000.
Now,
• The code word to be transmitted is obtained by replacing the last 4 zeroes of
11010110110000 with the CRC.
• Thus, the code word transmitted to the receiver = 11010110111110.
P a g e | 47
Error Correction
Error Correction codes are used to detect and correct the errors when data is transmitted from
the sender to the receiver.
• Backward error correction: Once the error is discovered, the receiver requests the
sender to retransmit the entire data unit.
• Forward error correction: In this case, the receiver uses the error-correcting code
which automatically corrects the errors.
A single additional bit can detect the error, but cannot correct it.
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.
Hamming Code
Parity bits: The bit which is appended to the original data of binary bits so that the total
number of 1s is even or odd.
Even parity: To check for even parity, if the total number of 1s is even, then the value of the
parity bit is 0. If the total number of 1s occurrences is odd, then the value of the parity bit is
1.
Odd Parity: To check for odd parity, if the total number of 1s is even, then the value of
parity bit is 1. If the total number of 1s is odd, then the value of parity bit is 0.
P a g e | 48
Relationship b/w Error position & binary number
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
The r1 bit is calculated by performing a parity check on the bit positions whose binary
representation includes 1 in the first position.
P a g e | 49
We observe from the above figure that the bit positions that include 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 include 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.
P a g e | 50
We observe from the above figure that the bit positions that include 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.
Suppose the 4th bit is changed from 0 to 1 at the receiving end, then parity bits are recalculated.
R1 bit
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
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.
P a g e | 51
R4 bit
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.
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-
Flow control tells the sender how much data should be sent to the receiver so that it is not
lost. This mechanism makes the sender wait for an acknowledgment before sending the next
data. Flow control restricts the number of frames the sender can send before it waits for an
acknowledgment from the receiver.
P a g e | 52
Stop and Wait Protocol-
Stop and Wait Protocol is the simplest flow control protocol.It works under the following
conditions-
• Communication channel is perfect.
• No error occurs during transmission.
Advantages-
The advantages of stop and wait protocol are-
• It is very simple to implement.
• The incoming packet from receiver is always an acknowledgement.
Disadvantages-
The disadvantages of stop and wait protocol are-
1. It is extremely inefficient because-
• It makes the transmission process extremely slow.
P a g e | 53
2. If the data packet sent by the sender gets lost, then-
• Sender will keep waiting for the acknowledgement for infinite time.
Stop and wait ARQ is a one bit sliding window protocol where-
• Sender window size = 1
• Receiver window size = 1
• Time out timer helps to solve the problem of lost data packet.
• After sending a data packet to the receiver, sender starts the time out timer.
• If the data packet gets acknowledged before the timer expires, sender stops the time out
timer.
• If the timer goes off before receiving the acknowledgement, sender retransmits the same
data packet.
• After retransmission, sender resets the timer.
• This prevents the occurrence of deadlock.
2. Lost Acknowledgement-
P a g e | 54
• This prevents the occurrence of deadlock.
• The sequence number on the data packet helps the receiver to identify the duplicate data
packet.
• Receiver discards the duplicate packet and re-sends the same acknowledgement.
3. Delayed Acknowledgement-
• Sequence number on acknowledgements help to solve the problem of delayed
acknowledgement.
P a g e | 55
4. Damaged Packet-
• If receiver receives a corrupted data packet from the sender, it sends a negative
acknowledgement (NAK) to the sender.
• NAK requests the sender to send the data packet again.
Advantages-
• Stop and Wait ARQ support half duplex.
• Only one packet or frame can be sent at a time.
Disadvantages-
• There is no pipelining, channel utilization is very low.
Maximum number of frames that sender can send without acknowledgement = Sender window
size.
A window is a buffer where we store the frames. Each frame in a window is numbered. If
the window size is n then the frames are numbered from the number 0 to n-1.
P a g e | 56
Suppose the size of the window is 4. So, the frames would be numbered as
0,1,2,3,0,1,2,3,0,… so on.
Advantages –
• It performs much better than stop-and-wait flow control.
• This method increases efficiency.
• Multiples frames can be sent one after another.
Disadvantages-
• The main issue is complexity at the sender and receiver due to the transferring of
multiple frames.
• The receiver might receive data frames or packets out the sequence.
P a g e | 57
• SR protocol accepts the out of order frames.
• SR protocol requires sorting at the receiver’s side.
• SR protocol requires searching at the sender’s side.
• SR protocol leads to retransmission of lost frames after expiry of time out timer.
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.
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 nor any station control
another station. Depending on the channel's state (idle or busy), each station transmits the
data frame.
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.
There are the different methods of random-access protocols such as-
P a g e | 58
• Aloha
• CSMA
• CSMA/CD
• 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
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).
P a g e | 59
Slotted Aloha
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.
P a g e | 60
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.
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.
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.
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.
P a g e | 61
CSMA/ CD
It is a carrier sense multiple access/ collision detection network protocol to transmit data
frames. It first senses the shared channel before broadcasting the frames, and if the channel is
idle, it transmits a frame to check whether the transmission was successful. If the frame is
successfully received, the station sends another frame. If any collision is detected in the
CSMA/CD, the station sends a jam/ stop signal to the shared channel to terminate data
transmission. After that, it waits for a random time before sending a frame to a channel.
CSMA/ CA
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.
It is a channelization protocol that allows the total usable bandwidth in a shared channel to be
shared across multiple stations based on their time, distance and codes. It can access all the
stations at the same time to send the data frames to the channel.
Following are the various methods to access the channel based on their time, distance and
codes:
P a g e | 62
FDMA
It is a frequency division multiple access (FDMA) method used to divide the available
bandwidth into equal bands so that multiple users can send data through a different frequency
to the sub channel. Each station is reserved with a particular band to prevent the crosstalk
between the channels and interferences of stations.
TDMA
Time Division Multiple Access (TDMA) is a channel access method. It allows the same
frequency bandwidth to be shared across multiple stations. And to avoid collisions in the shared
channel, it divides the channel into different frequency slots that allocate stations to transmit
the data frames. The same frequency bandwidth into the shared channel by dividing the signal
into various time slots to transmit it. However, TDMA has an overhead of synchronization that
specifies each station's time slot by adding synchronization bits to each slot.
CDMA
Code Division Multiple Access is a channel access method. In CDMA, all stations can
simultaneously send the data over the same channel. It means that it allows each station to
transmit the data frames with full frequency on the shared channel at all times. It does not
require the division of bandwidth on a shared channel based on time slots. If multiple stations
send data to a channel simultaneously, their data frames are separated by a unique code
sequence. Each station has a different unique code for transmitting the data over a shared
channel. For example, there are multiple users in a room that are continuously speaking. Data
is received by the users if only two-person interact with each other using the same language.
P a g e | 63
Unit-3
Switching
The process of moving the data packets towards their destination by forwarding them from one
port to the other port is called as switching.
Switching Techniques-
Various switching techniques are-
1. Circuit Switching
2. Message Switching
3. Packet Switching
Circuit Switching-
Establishing a Circuit-
In this phase,
• A circuit is established between the two ends.
• Circuit provides a dedicated path for data to travel from one to the other end.
• Resources are reserved at intermediate switches which are used during the
transmission.
• The intermediate switches are connected by the physical links.
P a g e | 64
Transferring the Data-
After the circuit is established,
• The entire data travels over the dedicated path from one end to the other end.
• A well defined and dedicated path exists for the data to travel.
• There is no waiting time at any switch and the data is transmitted without any delay.
• Data always reaches the other end in order.
• No re ordering is required.
P a g e | 65
Message Switching-
In message switching,
Advantage-
• It is helpful in reducing traffic congestion.
• It is helpful in setting the message priorities due to store and forward technique.
Disadvantage-
• It requires enough storage at every switch to accommodate the entire message during
the transmission.
• It is extremely slow due to store and forward technique.
P a g e | 66
Packet Switching-
In packet switching,
• This process of dividing a single message into smaller size packets is called
as packetization.
• These smaller packets are sent after the other.
• It gives the advantage of pipelining and reduces the total time taken to transmit the
message.
Establishing a Circuit-
In this phase,
• A logical connection is established between the two ends.
• It provides a dedicated path for data to travel from one to the other end.
• Resources are reserved at intermediate switches which are used during the
transmission.
P a g e | 67
Transferring the Data-
Datagram Switching-
In datagram switching,
P a g e | 68
• 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.
P a g e | 69
An IP address represents a unique address that distinguishes any device on the internet or any
network from another. IP or Internet Protocol defines the set of commands directing the setup
of data transferred through the internet or any other local network.
An IP address is represented by a series of numbers segregated by periods (.). They are
expressed in the form of four pairs - an example address might be 255.255.255.255 wherein
each set can range from 0 to 255.
Types of IP addresses
Private IP addresses
All the devices that are linked with your internet network are allocated a private IP address. It
holds computers, desktops, laptops, smart phones, tablets, or even Wi-Fi-enabled gadgets such
as speakers, printers, or smart Televisions.
Public IP addresses
A public IP address or primary address represents the whole network of devices associated
with it. Every device included within with your primary address contains their own private IP
address. ISP is responsible to provide your public IP address to your router.
Public IP addresses are further classified into two categories- dynamic and static.
• Dynamic IP addresses
As the name suggests, Dynamic IP addresses change automatically and frequently.
With these types of IP address, ISPs already purchase a bulk stock of IP addresses and
allocate them in some order to their customers. Periodically, they re-allocate the IP
addresses and place the used ones back into the IP addresses pool so they can be used
later for another client. The foundation for this method is to make cost savings profits
for the ISP.
• Static IP addresses
In comparison to dynamic IP addresses, static addresses are constant in nature. The
network assigns the IP address to the device only once and, it remains consistent.
Though most firms or individuals do not prefer to have a static IP address, it is
essential to have a static IP address for an organization that wants to host its network
server. It protects websites and email addresses linked with it with a constant IP
address.
Classful Addressing
• Class A
P a g e | 70
• Class B
• Class C
• Class D
• Class E
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.
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.
Class B
In Class B, an IP address is assigned to those networks that range from small-sized to large-
sized networks.
P a g e | 71
• The Network ID is 16 bits long.
• The Host ID is 16 bits long.
In Class B, the higher order bits of the first octet are always set to 10, and the remaining14
bits determine the network ID. The other 16 bits determine the Host ID.
Class C
In Class C, the higher order bits of the first octet are 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.
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 are always set to 1110, and the remaining bits
determine 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 are
always set to 1111, and the remaining bits determine the host ID in any network.
P a g e | 72
Rules for assigning Host ID:
The Host ID is used to determine the host within any network. The Host ID is assigned based
on the following rules:
If the hosts are located within the same local network, then they are assigned with the same
network ID. The following are the rules for assigning Network ID:
• The network ID cannot start with 127 as 127 are used by Class A.
• The Network ID in which all the bits are set to 0 cannot be assigned as it is used to
specify a particular host on the local network.
• The Network ID in which all the bits are set to 1 cannot be assigned as it is reserved for
the multicast address.
A 0 8 24 27 224 0.0.0.0 to
127.255.255.255
P a g e | 73
D 1110 Not Not Not Defined Not Defined 224.0.0.0 to
Defined Defined 239.255.255.255
Subnetting
• The process of dividing a single network into multiple sub networks is called
as subnetting.
• The sub networks so created are called as subnets.
Example-
Following diagram shows the subnetting of a big single network into 4 smaller subnets-
Advantages-
Subnet ID-
• Each subnet has its unique network address known as its Subnet ID.
• The subnet ID is created by borrowing some bits from the Host ID part of the IP
Address.
• The number of bits borrowed depends on the number of subnets created.
Types of Subnetting-
P a g e | 74
Subnetting of a network may be carried out in the following two ways-
Fixed length subnetting also called as classful subnetting divides the network into subnets
where-
• All the subnets are of same size.
• All the subnets have equal number of hosts.
• All the subnets have same subnet mask.
Variable length subnetting also called as classless subnetting divides the network into
subnets where-
• All the subnets are not of same size.
• All the subnets do not have equal number of hosts.
• All the subnets do not have same subnet mask.
IPv4 Structure
Internet Protocol being a layer-3 protocol (OSI) takes data Segments from layer-4 (Transport)
and divides it into packets. IP packet encapsulates data unit received from above layer and
add to its own header information.
P a g e | 75
The encapsulated data is referred to as IP Payload. IP header contains all the necessary
information to deliver the packet at the other end.
IP header includes many relevant information including Version Number, which, in this
context, is 4. Other details are as follows −
• Version − Version no. of Internet Protocol used (e.g. IPv4).
• IHL − Internet Header Length; Length of entire IP header.
• DSCP − Differentiated Services Code Point; this is Type of Service.
• ECN − Explicit Congestion Notification; It carries information about the congestion
seen in the route.
• Total Length − Length of entire IP Packet (including IP header and IP Payload).
• Identification − If IP packet is fragmented during the transmission, all the fragments
contain same identification number. to identify original IP packet they belong to.
• Flags − As required by the network resources, if IP Packet is too large to handle,
these ‘flags’ tells if they can be fragmented or not. In this 3-bit flag, the MSB is
always set to ‘0’.
• Fragment Offset − This offset tells the exact position of the fragment in the original
IP Packet.
• Time to Live − To avoid looping in the network, every packet is sent with some TTL
value set, which tells the network how many routers (hops) this packet can cross. At
each hop, its value is decremented by one and when the value reaches zero, the
packet is discarded.
P a g e | 76
• Protocol − Tells the Network layer at the destination host, to which Protocol this
packet belongs to, i.e. the next level Protocol. For example protocol number of ICMP
is 1, TCP is 6 and UDP is 17.
• Header Checksum − This field is used to keep checksum value of entire header
which is then used to check if the packet is received error-free.
• Source Address − 32-bit address of the Sender (or source) of the packet.
• Destination Address − 32-bit address of the Receiver (or destination) of the packet.
• Options − This is optional field, which is used if the value of IHL is greater than 5.
These options may contain values for options such as Security, Record Route, Time
Stamp, etc.
IPv6
All IPv6 addresses are 128-bit hexadecimal addresses, written in 8 separate sections having
each of them have 16 bits. As the IPv6 addresses are represented in a hexadecimal format,
their sections range from 0 to FFFF. Each section is separated by colons (:). It also allows to
removes the starting zeros (0) of each 16-bit section. If two or more consecutive sections 16-
bit contains all zeros (0 : 0), they can be compressed using double colons (::).
IPv6 addresses are consist of 8 different sections, each section has a 16-bit hexadecimal
values separated by colon (:). IPv6 addresses are represented as following format:
Each "xxxx" group contains a 16-bit hexadecimal value, and each "x" is a 4-bit hexadecimal
value. For example:
You can also remove the starting zeros (0) of each 16-bit section. For example, the above
IPv6 can be rewritten by omitting starting zeros (0) as follow:
You can also compress the consecutive sections 16-bit zeros (0 : 0) using double colons (::).
But keep in mind that you can do it only once per IP address.
P a g e | 77
IPv6
IPv6 fixed header is 40 bytes long and contains the following information.
2 Traffic Class (8-bits): These 8 bits are divided into two parts. The most significant 6 bits
are used for Type of Service to let the Router Known what services should be provided
to this packet. The least significant 2 bits are used for Explicit Congestion Notification
(ECN).
3 Flow Label (20-bits): This label is used to maintain the sequential flow of
the packets belonging to a communication. The source labels the sequence to
help the router identify that a particular packet belongs to a specific flow of
information. This field helps avoid re-ordering of data packets. It is designed
for streaming/real-time media.
4 Payload Length (16-bits): This field is used to tell the routers how much
information a particular packet contains in its payload. Payload is composed
of Extension Headers and Upper Layer data. With 16 bits, up to 65535 bytes
can be indicated; but if the Extension Headers contain Hop-by-Hop
Extension Header, then the payload may exceed 65535 bytes and this field is
set to 0.
5 Next Header (8-bits): This field is used to indicate either the type of
Extension Header, or if the Extension Header is not present then it indicates
P a g e | 78
the Upper Layer PDU. The values for the type of Upper Layer PDU are same
as IPv4’s.
6 Hop Limit (8-bits): This field is used to stop packet to loop in the network
infinitely. This is same as TTL in IPv4. The value of Hop Limit field is
decremented by 1 as it passes a link (router/hop). When the field reaches 0
the packet is discarded.
IPv4 IPv6
IPv4 has a 32-bit address length IPv6 has a 128-bit address length
It can generate 4.29×10 9 address Address space of IPv6 is quite large it can produce
space 3.4×1038 address space
The Security feature is dependent on IPSEC is an inbuilt security feature in the IPv6
application protocol
In IPv4 Packet flow identification is In IPv6 packet flow identification are Available
not available and uses the flow label field in the header
P a g e | 79
IPv4 IPv6
ARP
• ARP stands for Address Resolution Protocol.
• It is used to associate an IP address with the MAC address.
• Each device on the network is recognized by the MAC address imprinted on the NIC.
Therefore, we can say that devices need the MAC address for communication on a local
area network. MAC address can be changed easily. For example, if the NIC on a
particular machine fails, the MAC address changes but IP address does not change.
ARP is used to find the MAC address of the node when an internet address is known.
Note: MAC address: The MAC address is used to identify the actual device.
IP address: It is an address used to locate a device on the network.
If the host wants to know the physical address of another host on its network, then it sends an
ARP query packet that includes the IP address and broadcast it over the network. Every host
on the network receives and processes the ARP packet, but only the intended recipient
recognizes the IP address and sends back the physical address. The host holding the datagram
adds the physical address to the cache memory and to the datagram header, then sends back
to the sender.
RARP
• RARP stands for Reverse Address Resolution Protocol.
• If the host wants to know its IP address, then it broadcast the RARP query packet that
contains its physical address to the entire network. A RARP server on the network
recognizes the RARP packet and responds back with the host IP address.
P a g e | 80
• The protocol which is used to obtain the IP address from a server is known as Reverse
Address Resolution Protocol.
• The message format of the RARP protocol is similar to the ARP protocol.
• Like ARP frame, RARP frame is sent from one machine to another encapsulated in the
data portion of a frame.
BOOTP
• Bootstrap Protocol (BOOTP) is a basic protocol that automatically provides each
participant in a network connection with a unique IP address for identification and
authentication as soon as it connects to the network. This helps the server to speed up
data transfers and connection requests.
• BOOTP uses a unique IP address algorithm to provide each system on the network
with a completely different IP address in a fraction of a second.
• This shortens the connection time between the server and the client. It starts the
process of downloading and updating the source code even with very little
information.
• BOOTP uses a combination of DHCP (Dynamic Host Configuration Protocol)
and UDP (User Datagram Protocol) to request and receive requests from various
network-connected participants and to handle their responses.
DHCP
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 is also called
RFC (Request for comments) 2131.
P a g e | 81
DHCP does the following:
• DHCP manages the provision of all the nodes or devices added or dropped from the
network.
• DHCP maintains the unique IP address of the host using a DHCP server.
• 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.
There are many versions of DCHP are available for use in IPV4 (Internet Protocol Version 4)
and IPV6 (Internet Protocol Version 6).
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.
Routing algorithm
• In order to transfer the packets from source to the destination, the network layer must
determine the best route through which packets can be transmitted.
P a g e | 82
• Whether the network layer provides datagram service or virtual circuit service, the main
job of the network layer is to provide the best route. The routing protocol provides this
job.
• The routing protocol is a routing algorithm that provides the best path from the source
to the destination. The best path is the path that has the "least-cost path" from source to
the destination.
• Routing is the process of forwarding the packets from source to the destination but the
best route to send the packets is determined by the routing algorithm.
P a g e | 83
path from source to the destination, instead it knows the direction through which the
packet is to be forwarded along with the least cost path.
Flooding: In case of flooding, every incoming packet is sent to all the outgoing links except
the one from it has been reached. The disadvantage of flooding is that node may contain several
copies of a particular packet.
Random walks: In case of random walks, a packet sent by the node to one of its neighbors
randomly. An advantage of using random walks is that it uses the alternative routes very
efficiently.
Inter-Domain Routing
When routing performed between autonomous systems (domains) is known as inter-domain
routing protocol. Example BGP.
P a g e | 84
An autonomous system is a collection of networks that comes under the single common
administrative domain. Or we can say that it is a collection of routers under the single
administrative domain. For example, an organization can contain multiple routers having
different locations, but the single autonomous number system will recognize them.
BGP Features
• Open standard
It is an exterior gateway protocol that is used to exchange the routing information between two
or more autonomous system numbers.
• InterAS-domain routing
• Supports internet
• Classless
It is a classless protocol.
The BGP is a path vector protocol. Path vector is a method of sending the routes along with
routing information.
Intra-Domain Routing
When routing performed within autonomous system (domains) is known as intra-domain
routing protocol. Example RIP and OSPF.
RIP Protocol
RIP stands for Routing Information Protocol. RIP is an intra-domain routing protocol used
within an autonomous system. Here, intra-domain means routing the packets in a defined
domain, for example, web browsing within an institutional area. To understand the RIP
protocol, our main focus is to know the structure of the packet, how many fields it contains,
and how these fields determine the routing table.
P a g e | 85
• RIP is based on the distance vector-based strategy.
• In RIP, infinity is defined as 16, which means that the RIP is useful for smaller networks
or small autonomous systems. The maximum number of hops that RIP can contain is
15 hops, i.e., it should not have more than 15 hops as 16 is infinity.
• Distributed: It is distributed in that each node receives information from one or more
of its directly attached neighbours performs calculation and then distributes the result
back to its neighbours.
• Iterative: It is iterative in that its process continues until no more information is
available to be exchanged between neighbours.
• Asynchronous: It does not require that all of its nodes operate in the lock step with
each other.
• The Distance vector algorithm is a dynamic algorithm.
• It is mainly used in ARPANET, and RIP.
• Each router maintains a distance table known as Vector.
P a g e | 86
Link State Routing
Link state routing is a technique in which each router shares the knowledge of its
neighbourhood with every other router in the internetwork.
• Knowledge about the neighbourhood: Instead of sending its routing table, a router
sends the information about its neighbourhood only. A router broadcast its identities
and cost of the directly attached links to other routers.
• Flooding: Each router sends the information to every other router on the internetwork
except its neighbours. This process is known as Flooding. Every router that receives
the packet sends the copies to all its neighbours. Finally, each and every router receives
a copy of the same information.
• Information sharing: A router sends the information to every other router only when
the change occurs in the information.
OSPF
The OSPF stands for Open Shortest Path First. It is a widely used and supported routing
protocol. It is an intra-domain protocol, which means that it is used within an area or a network.
It is an interior gateway protocol that has been designed within a single autonomous system. It
is based on a link-state routing algorithm in which each router contains the information of every
domain, and based on this information, it determines the shortest path. It is based on dijkastra
algorithm.
OSPF divides the autonomous systems into areas where the area is a collection of networks,
hosts, and routers. Like internet service providers divide the internet into a different
autonomous system for easy management and OSPF further divides the autonomous systems
into Areas.
P a g e | 87
Types of links in OSPF
A link is basically a connection, so the connection between two routers is known as a link.
There are four types of links in OSPF:
1. Point-to-point link: The point-to-point link directly connects the two routers without
any host or router in between.
2. Transient link: When several routers are attached in a network, they are known as a
transient link.
3. Stub link: It is a network that is connected to the single router. Data enters to the
network through the single router and leaves the network through the same router.
4. Virtual link: If the link between the two routers is broken, the administration creates
the virtual path between the routers, and that path could be a long one also.
P a g e | 88
Unit-4
INTRODUCTION
• The transport layer is responsible for the delivery of a message from one process to
another.
• The transport layer header must include a service – point –address in the OSI model or
port number in the TCP/IP (internet model).
• The Internet model has three protocols at the transport layer: UDP, TCP, and SCTP.
• UDP: Is the simplest of the three.
• TCP: A complex transport layer protocol.
• SCTP: The new transport layer protocol that is designed for specific applications such
as multimedia. A new reliable, message-oriented transport layer protocol that combines
the best features of UDP and TCP.
PROCESS-TO-PROCESS DELIVERY
• The Data link layer is responsible for delivery of frames between nodes over a link node
to node delivery using a MAC address to choose one node among several.
• The Network layer is responsible for delivery of datagram between two hosts host to
host delivery using an IP address to choose one host among millions.
• Real communication takes place between two processes (application programs). We
need process-to-process delivery.
• We need a mechanism to deliver data from one of process running on the source host
to the corresponding process running on the destination host.
• The Transport layer is responsible for process-to-process. We need a port number, to
choose among multiple processes running on the destination host.
UDP
P a g e | 89
• This type of protocol is used when reliability and security are less important than
speed and size.
• UDP is an end-to-end transport level protocol that adds transport-level addresses,
checksum error control, and length information to the data from the upper layer.
• The packet produced by the UDP protocol is known as a user datagram.
UDP Format
Where,
• Source port address: It defines the address of the application process that has
delivered a message. The source port address is of 16 bits address.
• Destination port address: It defines the address of the application process that will
receive the message. The destination port address is of a 16-bit address.
• Total length: It defines the total length of the user datagram in bytes. It is a 16-bit
field.
• Checksum: The checksum is a 16-bit field which is used in error detection.
Characteristics of UDP
• It is a connectionless protocol.
• It is a stateless protocol.
• It is an unreliable protocol.
• It is a fast protocol.
• It offers the minimal transport service.
• It is almost a null protocol.
• It does not guarantee in order delivery.
• It does not provide congestion control mechanism.
• It is a good protocol for data flowing in one direction.
P a g e | 90
Disadvantages of UDP protocol
• UDP provides basic functions needed for the end-to-end delivery of a transmission.
• It does not provide any sequencing or reordering functions and does not specify the
damaged packet when reporting an error.
• UDP can discover that an error has occurred, but it does not specify which packet
has been lost as it does not contain an ID or sequencing number of a particular data
segment.
Important Point-
• Size of UDP Header= 8 bytes.
• UDP is almost a null protocol.
• UDP is an unreliable protocol.
• Checksum calculation is not mandatory in UDP.
• UDP does not guarantee in order delivery.
TCP
Characteristics of TCP-
• TCP is a reliable protocol.
• TCP is a connection oriented protocol.
• TCP handles both congestion and flow control.
• TCP ensures in-order delivery.
• TCP connections are full duplex.
• TCP can use both selective & cumulative acknowledgements.
• TCP is a byte stream protocol.
• TCP provides error checking & recovery mechanism.
P a g e | 91
TCP Segment Format
Where,
• Source port address: It is used to define the address of the application program in a
source computer. It is a 16-bit field.
• Destination port address: It is used to define the address of the application program
in a destination computer. It is a 16-bit field.
• Sequence number: A stream of data is divided into two or more TCP segments. The
32-bit sequence number field represents the position of the data in an original data
stream.
• Acknowledgement number: A 32-field acknowledgement number acknowledge the
data from other communicating devices. If ACK field is set to 1, then it specifies the
sequence number that the receiver is expecting to receive.
• Header Length (HLEN): It specifies the size of the TCP header in 32-bit words. The
minimum size of the header is 5 words, and the maximum size of the header is 15 words.
Therefore, the maximum size of the TCP header is 60 bytes, and the minimum size of
the TCP header is 20 bytes.
• Reserved: It is a six-bit field which is reserved for future use.
• Control bits: Each bit of a control field functions individually and independently. A
control bit defines the use of a segment or serves as a validity check for other fields.
• URG: The URG field indicates that the data in a segment is urgent.
• ACK: When ACK field is set, then it validates the acknowledgement number.
• PSH: The PSH field is used to inform the sender that higher throughput is needed so if
possible, data must be pushed with higher throughput.
P a g e | 92
• RST: The reset bit is used to reset the TCP connection when there is any confusion
occurs in the sequence numbers.
• SYN: The SYN field is used to synchronize the sequence numbers in three types of
segments: connection request, connection confirmation ( with the ACK bit set ), and
confirmation acknowledgement.
• FIN: The FIN field is used to inform the receiving TCP module that the sender has
finished sending data. It is used in connection termination in three types of segments:
termination request, termination confirmation, and acknowledgement of termination
confirmation.
• Window Size: The window is a 16-bit field that defines the size of the window.
• Checksum: The checksum is a 16-bit field used in error detection.
• Urgent pointer: If URG flag is set to 1, then this 16-bit field is an offset from
the sequence number indicating that it is a last urgent data byte.
• Options and padding: It defines the optional fields that convey the additional
information to the receiver.
TCP Retransmission-
• Each time sender transmits a TCP segment to the receiver, it starts a Time Out Timer.
• Sender does not receive any acknowledgement for the sent segment and the timer goes
off.
• Sender retransmits the same segment to the receiver and resets the timer.
P a g e | 93
2. Retransmission after Receiving 3 Duplicate Acknowledgements-
• Consider sender receives three duplicate acknowledgements for a TCP segment sent by
it.
• Then, sender assumes that the corresponding segment is lost.
• So, sender retransmits the same segment without waiting for its time out timer to expire.
• This is known as early retransmission or Fast retransmission.
P a g e | 94
TCP Connection Termination-
A TCP connection is terminated using FIN segment where FIN bit is set to 1.
Consider-
• There is a well established TCP connection between the client and server.
• Client wants to terminate the connection.
The following steps are followed in terminating the connection-
After receiving the FIN segment,
• Server frees up its buffers.
• Server sends an acknowledgement to the client.
• Server enters the CLOSE_WAIT state.
P a g e | 95
Three Way Handshake-
Step-01: SYN-
P a g e | 96
Step-03: ACK-
P a g e | 97
Receiver Window Size-
Receiver window size is an advertisement of-
“How much data (in bytes) the receiver can receive without acknowledgement?”
• Sender should not send data greater than receiver window size.
• Otherwise, it leads to dropping the TCP segments which causes TCP Retransmission.
• So, sender should always send data less than or equal to receiver window size.
• Receiver dictates its window size to the sender through TCP Header.
Congestion Window-
• Sender should not send data greater than congestion window size.
• Otherwise, it leads to dropping the TCP segments which causes TCP Retransmission.
• So, sender should always send data less than or equal to congestion window size.
• Different variants of TCP use different approaches to calculate the size of congestion
window.
• Congestion window is known only to the sender and is not sent over the links.
So, always-
Sender window size = Minimum (Receiver window size, Congestion window size)
TCP’s general policy for handling congestion consists of following three phases-
1. Slow Start
2. Congestion Avoidance
3. Congestion Detection
P a g e | 98
1. Slow Start Phase-
• Initially, sender sets congestion window size = Maximum Segment Size (1 MSS).
• After receiving each acknowledgment, sender increases the congestion window size by
1 MSS.
• In this phase, the size of congestion window increases exponentially.
P a g e | 99
Threshold
= Maximum number of TCP segments that receiver window can accommodate / 2
= (Receiver window size / Maximum Segment Size) / 2
When sender detects the loss of segments, it reacts in different ways depending on how the loss
is detected-
• Detection On Time Out
• Detection on Receiving 3 Duplicate Acknowledgements.
P a g e | 100
Definition TCP establishes a virtual UDP transmits the data directly to
circuit before transmitting the destination computer without
the data. verifying whether the receiver is
ready to receive or not.
SCTP
SCTP stands for Stream Control Transmission Protocol.
It is a connection- oriented protocol in computer networks which provides a full-duplex
association i.e., transmitting multiple streams of data between two end points at the same
time that have established a connection in network. It is sometimes referred to as next
generation TCP. SCTP makes it easier to support telephonic conversation on Internet. A
telephonic conversation requires transmitting of voice along with other data at the same time
on both ends; SCTP protocol makes it easier to establish reliable connection.
“SCTP is a message-oriented, reliable protocol that combines the best features of UDP and
TCP”.
Characteristics of SCTP
Advantages of SCTP
P a g e | 101
1. It is a full- duplex connection i.e. users can send and receive data simultaneously.
2. It allows half- closed connections.
3. The message’s boundaries are maintained and application doesn’t have to split
messages.
4. It has properties of both TCP and UDP protocol.
5. It doesn’t rely on IP layer for resilience of paths.
Disadvantages of SCTP
1. One of key challenges is that it requires changes in transport stack on node.
2. Applications need to be modified to use SCTP instead of TCP/UDP.
Congestion Control
Congestion control refers to the techniques used to control or prevent congestion.
Congestion control techniques can be broadly classified into two categories:
2. Window Policy
The type of window at the sender’s side may also affect the congestion. Several packets
in the Go-back-n window are re-sent, although some packets may be received
successfully at the receiver side. This duplication may increase the congestion in the
network and make it worse.
Therefore, Selective repeat window should be adopted as it sends the specific packet that
P a g e | 102
may have been lost.
3. Discarding Policy
A good discarding policy adopted by the routers is that the routers may prevent
congestion and at the same time partially discard the corrupted or less sensitive packages
and also be able to maintain the quality of a message.
In case of audio file transmission, routers can discard less sensitive packets to prevent
congestion and also maintain the quality of the audio file.
4. Acknowledgment Policy
Since acknowledgements are also the part of the load in the network, the
acknowledgment policy imposed by the receiver may also affect congestion. Several
approaches can be used to prevent congestion related to acknowledgment.
The receiver should send acknowledgement for N packets rather than sending
acknowledgement for a single packet. The receiver should send an acknowledgment
only if it has to send a packet or a timer expires.
5. Admission Policy
In admission policy a mechanism should be used to prevent congestion. Switches in a
flow should first check the resource requirement of a network flow before transmitting it
further. If there is a chance of a congestion or there is a congestion in the network, router
should deny establishing a virtual network connection to prevent further congestion.
1. Backpressure
Backpressure is a technique in which a congested node stops receiving packets from
upstream node. This may cause the upstream node or nodes to become congested and
reject receiving data from above nodes. Backpressure is a node-to-node congestion control
technique that propagates in the opposite direction of data flow. The backpressure
technique can be applied only to virtual circuit where each node has information of its
above upstream node.
In above diagram the 3rd node is congested and stops receiving packets as a result 2nd
node may be get congested due to slowing down of the output data flow. Similarly 1st
node may get congested and inform the source to slow down.
P a g e | 103
2. Choke Packet Technique
Choke packet technique is applicable to both virtual networks as well as datagram
subnets. A choke packet is a packet sent by a node to the source to inform it of
congestion. Each router monitors its resources and the utilization at each of its
output lines. Whenever the resource utilization exceeds the threshold value which is
set by the administrator, the router directly sends a choke packet to the source
giving it a feedback to reduce the traffic. The intermediate nodes through which the
packets has traveled are not warned about congestion.
3. Implicit Signaling
In implicit signaling, there is no communication between the congested nodes and the
source. The source guesses that there is congestion in a network. For example when
sender sends several packets and there is no acknowledgment for a while, one
assumption is that there is congestion.
4. Explicit Signaling
Flow Characteristics
P a g e | 104
• Reliability, Lack of reliability means losing a packet or acknowledgement which
entertains retransmission.
• Delay, Increase in delay means destination will find the packet later than expected,
Importance of delay changes according to the various application.
• Jitter, Variation of the delay is jitter, if the delay is not at a constant rate, it may
result in poor quality.
• Bandwidth, Increase in bandwidth means increase in the amount of data which can
be transferred in given amount of time, Importance of bandwidth also varies
according to various applications.
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 i.e. 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.
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.
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
P a g e | 105
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
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.
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
P a g e | 106
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.
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.
· 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.
P a g e | 107
“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”.
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”.
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.
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,
P a g e | 108
buffer size, CPU speed, etc.) and its previous commitments to other flows can handle the new
flow.
Unit-5
Cryptography
The art or science encompassing the principles and methods of transforming an intelligible
message into one that is unintelligible, and then retransforming that message back to its
original form.
“Cryptographic was derived from the Greek word which means secret writing.”
SECURITY SERVICES
The classification of security services are as follows:
Confidentiality - Ensures that the information in a computer system and transmitted
information are accessible only for reading by authorized parties. E.g. Printing, displaying
and other forms of disclosure.
Authentication- Ensures that the origin of a message or electronic document is correctly
identified, with an assurance that the identity is not false.
Integrity- Ensures that only authorized parties are able to modify computer system assets and
transmitted information. Modification includes writing, changing status, deleting, creating
and delaying or replaying of transmitted messages.
Non repudiation- Requires that neither the sender nor the receiver of a message be able to
deny the transmission.
Encryption/Decryption
Encryption: Encryption means that the sender converts the original information into another
form and sends the unintelligible message over the network.
Decryption: Decryption reverses the Encryption process in order to transform the message
back to the original form.
The data which is to be encrypted at the sender site is known as plaintext, and the encrypted
data is known as ciphertext. The data is decrypted at the receiver site.
P a g e | 109
There are two types of Encryption/Decryption techniques:
• In Secret Key Encryption/Decryption technique, the same key is used by both the
parties, i.e., the sender and receiver.
• The sender uses the secret key and encryption algorithm to encrypt the data; the
receiver uses this key and decryption algorithm to decrypt the data.
• In Secret Key Encryption/Decryption technique, the algorithm used for encryption
is the inverse of the algorithm used for decryption. It means that if the encryption
algorithm uses a combination of addition and multiplication, then the decryption
algorithm uses a combination of subtraction and division.
• The secret key encryption algorithm is also known as symmetric encryption
algorithm because the same secret key is used in bidirectional communication.
• In secret key encryption/decryption algorithm, the secret code is used by the
computer to encrypt the information before it is sent over the network to another
computer.
• The secret key requires that we should know which computers are talking to each
other so that we can install the key on each computer.
P a g e | 110
Transposition Ciphers
In Cryptography, a transposition cipher is a method of encryption by which the positions held
by units of plaintext (which are commonly characters or groups of characters) are shifted
according to a regular system, so that the ciphertext constitutes a permutation of the
plaintext.
That is, the order of the units is changed (the plaintext is reordered). Mathematically, a
bijective function is used on the characters’ positions to encrypt and an inverse function to
decrypt.
Substitution Cipher
Method of encryption by which units of plaintext are replaced with ciphertext, according to a
fixed system; the “units” may be single letters (the most common), pairs of letters, triplets of
letters, mixtures of the above, and so forth.
Example:
Consider this example shown on the slide: Using the system just discussed, the keyword
“zebras” gives us the following alphabets:
P a g e | 111
Stream Cipher
Symmetric or secret-key encryption algorithm that encrypts a single bit at a time. With a Stream
Cipher, the same plaintext bit or byte will encrypt to a different bit or byte every time it is
encrypted.
Block Cipher
An encryption method that applies a deterministic algorithm along with a symmetric key to
encrypt a block of text, rather than encrypting one bit at a time as in stream ciphers
Example: A common block cipher, AES, encrypts 128-bit blocks with a key of predetermined
length: 128, 192, or 256 bits. Block ciphers are pseudorandom permutation (PRP) families that
operate on the fixed size block of bits
P a g e | 112
Advantage
Efficient: The secret key algorithms are more efficient as it takes less time to encrypt the
message than to encrypt the message by using a public key encryption algorithm. The reason
for this is that the size of the key is small. Due to this reason, Secret Key Algorithms are mainly
used for encryption and decryption.
Disadvantages
• Each pair of users must have a secret key. If the number of people wants to use
this method in the world is N, then there are N (N-1)/2 secret keys. For example,
for one million people, then there are half billion secret keys.
• The distribution of keys among different parties can be very difficult. This
problem can be resolved by combining the Secret Key Encryption/Decryption
with the Public Key Encryption/Decryption algorithm.
In the above figure, we see that A is sending the message to user B. 'A' uses the public key to
encrypt the data while 'B' uses the private key to decrypt the data.
• In public key Encryption/Decryption, the public key used by the sender is different
from the private key used by the receiver.
• The public key is available to the public while the private key is kept by each
individual.
• The most commonly used public key algorithm is known as RSA.
P a g e | 113
Advantages of Public Key Encryption
• The main restriction of private key encryption is the sharing of a secret key. A third
party cannot use this key. In public key encryption, each entity creates a pair of
keys, and they keep the private one and distribute the public key.
• The number of keys in public key encryption is reduced tremendously. For example,
for one million users to communicate, only two million keys are required, not a
half-billion keys as in the case of secret key encryption.
Speed Its speed is high as it uses a single Its speed is slow as it uses two
key for encryption and different keys; both keys are related to
decryption. each other through the complicated
mathematical process.
P a g e | 114
Algorithms The Secret key algorithms are The Public key algorithms are Diffie-
DES, 3DES, AES & RCA. Hellman, RSA.
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:
P a g e | 115
to get plain text m.
m = cd mod n
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:
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
P a g e | 116
φ (n) = (p - 1) x (q-1)
φ (n) = (7 - 1) x (11 - 1)
φ (n) = 6 x 10
φ (n) = 60
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:
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
Example 2:
In an RSA cryptosystem, a particular A uses two prime numbers, 13 and 17, to generate the
public and private keys. If the public of A is 35. Then the private key of A is ……………?.
P a g e | 117
Explanation:
Step 1: in the first step, select two large prime numbers, p and q.
p = 13
q = 17
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 = 13 x 17
n = 221
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) = (13 - 1) x (17 - 1)
φ (n) = 12 x 16
φ (n) = 192
g.c.d (35, 192) = 1
Step 3: To determine the private key, we use the following formula to calculate the d such that:
Calculate d = de mod φ (n) = 1
d = d x 35 mod 192 = 1
d = (1 + k.φ (n))/e [let k =0, 1, 2, 3………………]
Put k = 0
d = (1 + 0 x 192)/35
d = 1/35
Put k = 1
d = (1 + 1 x 192)/35
d = 193/35
Put k = 2
d = (1 + 2 x 192)/35
d = 385/35
d = 11
The private key is <d, n> = (11, 221)
Hence, private key i.e. d = 11
Example 3:
A RSA cryptosystem uses two prime numbers 3 and 13 to generate the public key= 3 and the
private key = 7. What is the value of cipher text for a plain text?
Explanation:
Step 1: In the first step, select two large prime numbers, p and q.
p=3
q = 13
P a g e | 118
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 = 3 x 13
n = 39
Step 3: If n = p x q, then the public key is <e, n>. A plaintext message m is encrypted using
public key <e, n>. Thus the public key is <e, n> = (3, 39).
To find ciphertext from the plain text following formula is used to get ciphertext C.
C = me mod n
C = 53 mod 39
C = 125 mod 39
C=8
Hence, the ciphertext generated from plain text, C = 8.
An application layer protocol defines how the application processes running on different
systems pass the messages to each other.
DNS is a TCP/IP protocol used on different platforms. The domain name space is divided into
three different sections: generic domains, country domains, and inverse domain.
Generic Domains
The format of country domain is same as a generic domain, but it uses two-character country
abbreviations (e.g., us for the United States) in place of three character organizational
abbreviations.
Inverse Domain
The inverse domain is used for mapping an address to a name. When the server has received a
request from the client, and the server contains the files of only authorized clients. To determine
whether the client is on the authorized list or not, it sends a query to the DNS server and ask
for mapping an address to the name.
Working of DNS
FTP
• FTP stands for File transfer protocol.
• FTP is a standard internet protocol provided by TCP/IP used for transmitting the
files from one host to another.
• 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.
• It is also used for downloading the files to computer from other servers.
P a g e | 120
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.
• 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.
• 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.
SMTP
P a g e | 121
• SMTP is a set of communication guidelines that allow software to transmit an electronic
mail over the internet is called Simple Mail Transfer Protocol.
• It is a program used for sending messages to other computer users based on e-mail
addresses.
• It provides a mail exchange between users on the same or different computers, and it
also supports:
• It can send a single message to one or more recipients.
• Sending message can include text, voice, video or graphics.
• It can also send the messages on networks outside the internet.
Components of SMTP
First, we will break the SMTP client and SMTP server into two components such as user
agent (UA) and mail transfer agent (MTA). The user agent (UA) prepares the message,
creates the envelope and then puts the message in the envelope. The mail transfer agent
(MTA) transfers this mail across the internet.
P a g e | 122
• SMTP allows a more complex system by adding a relaying system. Instead of just
having one MTA at sending side and one at receiving side, more MTAs can be added,
acting either as a client or server to relay the email.
SNMP
• SNMP stands for Simple Network Management Protocol.
• SNMP is a framework used for managing devices on the internet.
• It provides a set of operations for monitoring and managing the internet.
HTTP
• HTTP stands for Hypertext Transfer Protocol.
• It is a protocol used to access the data on the World Wide Web (www).
• The HTTP protocol can be used to transfer the data in the form of plain text, hypertext,
audio, video, and so on.
• 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.
• 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.
• HTTP is used to carry the data in the form of MIME-like format.
P a g e | 123
• 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.
Features of HTTP:
Stateless: HTTP is a stateless protocol as both the client and server know each other only
during the current request.
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.
Messages
HTTP messages are of two types: request and response. Both the message types follow the
same message format.
Request Message: The request message is sent by the client that consists of a request line,
headers, and sometimes a body.
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)
• 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).
P a g e | 124
• The Uniform Resource Locator (URL) is a standard way of specifying any kind of
information on the internet.
• The URL defines four parts: method, host computer, port, and path.
• Method: The method is the protocol used to retrieve the document from a server. For
example, HTTP.
• 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.
• 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.
• Path: Path is the pathname of the file where the information is stored. The path itself
contains slashes that separate the directories from the subdirectories and files.
P a g e | 125
References:
1. Behrouz Forouzan, “Data Communication and Networking”, McGraw Hill.
2. Andrew Tanenbaum “Computer Networks”, Prentice Hall.
3. Behrouz Forouzan, “TCP/IP Protocol Suite”, McGraw Hill.
P a g e | 126