You are on page 1of 181

1.

DATA COMMUNICATION

Data Communication is exchange of data between


two devices through some form of transmission media.
Its effectiveness is based on four characteristics.
1. Delivery : data delivery to correct destination
2. Accuracy : deliver the data accurately
3. Timeliness  data is delivered in timely
manner
4. Jitter  variation in packet arrival time
Components of a Data Communication Network
D a ta C om m u n ication C om p on en ts

M e ssage S en de r R e ceive r Tran sm ission P roto co ls


m e dia , th at S et of rule s th at go vern
is ph ysical p ath da ta com m un icatio n

Computer Networks is set of devices connected by


some communication link.
1. Data : Communication of data means a message
or data will be transmitted from one device and will be
received in the destination or target device. Thus the
first component in a data communication network is data
or message to that needs to be delivered and received.
Data or message can be of various forms such as text,
audio, video, image or combinations of these forms etc.
2. Sender : A data must has to be sent to a
destination from a source. This source is called the
sender. The device that sends the data to the
destination or target is the Sender. It can be a computer,
cell phone, video camera and so on.
3. Receiver : The destination of a transmitted data
is the receiver which will receive the data. The device
that receives the data that was sent by the Sender is the
Receiver. A receiver can again be a computer, cell
phone, video camera and so on.
4. Transmission medium : In data communication
network, the transmission medium is the physical path
for the data to travel to its destination after being sent by
the Sender. Receiver receives the data at one end of
this path and the sender sent from another end of the
path. Transmission medium could be like twisted-pair
cable, coaxial cable, fiber-optic cable etc.
5. Protocol : A protocol is nothing but a set of rules
that applies on the full data communication procedure.
This is like an agreement between the two devices to
successfully communicate with each other. For example,
how the data will be sent, how the data will be traveling,
how to ensure that full data has received, how to handle
errors in transmission etc. Both devices follow the same
set of rules or protocol so that they understand each
other.
Simplex
In a simplex transmission mode, the communication
between sender and receiver occurs only in one
direction. The sender can only send the data and the
receiver can only receive the data. The receiver cannot
reply to the sender. Simplex is like a one-way road in
which the traffic travels only in one direction, no vehicle
from the opposite direction is allowed to enter.
For example, the keyboard can only send the input
to the monitor and the monitor can only receive the input
and display it on the screen. The monitor cannot reply
nor send any feedback to the keyboard.
Half Duplex
The communication between sender and receiver
occurs in both the directions in a half duplex
transmission but, one at a time. The sender and receiver
both can send and receive the information but, only one
is allowed to send at a time. Half duplex is still
considered a one-way road, in which a vehicle traveling
in the opposite direction of the traffic has to wait till the
road is empty.
For example, in walkie-talkies, the speaker at both
ends can speak but they have to speak one by one.
Both cannot speak simultaneously.
Full Duplex
In a full duplex transmission mode, the
communication between sender and receiver can occur
simultaneously. The sender and receiver can both
transmit and receive at the same time. The full duplex
transmission mode is like a two-way road in which traffic
can flow in both directions at the same time.
For example, In a telephone, two people
communicate, and both are free to speak and listen at
the same time.
Analog and Digital Signals
Data Transmission can be digital or analog. In data
transmission, the digital signal can be transmitted from
sender to receiver or analog signal can be transmitted
from sender to receiver.
(a) Analog : Signal is continuous signal which has
infinite number of voltage level.
(b) Digital : Signal is discrete in nature.
Hence, it has finite no. of voltage level.
Analog Signal can be represented as :
(i) Periodic (Pattern is repeated)
(ii) Aperiodic (Pattern is not repeated)

Analog Signal has Three Properties


1. Amplitude
2. Frequency
3. Phase
Period (T) : Time required to complete one cycle.
1
F
T
Phase : The position of waveform at time t = 0

Digital Signal

In data transmission, we prefer periodic analog and


non-periodic digital signal during transmission.
Max data rate = 2 × B log2 L
For Noiseless Channel
where B : Bandwidth of channel
L : Level of Signal
Channel Capacity (For Noiseless and Noisy
Channels)
Channel capacity depends on :
(a) The bandwidth available
(b) Number of level in digital signal
(c) The quality of channel - level of noise
1. Noiseless Channel : Nyquist Bit Rate : It states
that,
Bit rate = 2B log2(L)
B = Bandwidth of channel
L = Number of signal levels
Since, bandwidth is fixed.
Bit rate  number of signal levels. But increasing
the level of signal may reduce the reliability of the
system.
2. Noisy Channel : In case of noisy channel.
Capacity = B + Log2 (1 + SNR)
B = Bandwidth
SNR = Signal to Noise Ratio
Ex. Consider a noiseless channel with a bandwidth of
3000 Hz transmitting a signal with two signal levels.
What is channel capacity ?
Sol. Capacity = 2 × B log2(L)
= 2 × 3000 × log2 (2)
= 6000 bps.

Ex. Assume SNR (dB) is 36 and the channel bandwidth


is 2 MHz. Calculate channel capacity.
Sol. SNR (dB) = 10 log10 (SNR)
SNR = 10(SNR)/10
SNR = 103.6
SNR = 3981
Thus, Capacity = 2 × 106 log2 (3982)
= 24 MHz
Bandwidth, Throughput and Latency
Bandwidth is a measure of rate of data flows over
the network, its capacity. This is measured as kbps.
Latency - Conversations are exchanges of data
from one point to another. Latency is used to measure
how quickly these conversations take place. The more
latency there is, the longer these conversations take to
hold. The level of latency determines the maximum
throughput of a conversation.
Throughput is the actual data transfer rate that
occurs on the network.
Latency vs Bandwidth
Latency and bandwidth have a close relationship
with each other. Latency measures the speed of packet
transfers whereas bandwidth is used to refer to the
maximum capacity of the network.
These two have a cause and effect relationship. For
instance, if we have the less bandwidth the longer it will
take data to reach its destination and the latency is
more. On the other hand, if we have more bandwidth
faster packets will reach their destination. In this case
we have low latency.
Throughput vs Bandwidth
Bandwidth describe the maximum amount of data
that can be transferred throughout the network. The
bandwidth of a network is limited to the standard of
internet connection and the capabilities of the network
devices.
It goes without saying that throughput is lower than
bandwidth. That is because bandwidth represents the
maximum capabilities of the network rather than the
actual transfer rate.
Analog and Digital Transmission
Analog transmission is a transmission method of
conveying information using a continuous signal which
varies in amplitude, phase, or some other property in
proportion to that information. It could be the transfer of
an analog source signal, using an analog modulation
method such as frequency modulation (FM) or amplitude
modulation (AM), or no modulation at all.
Digital transmission is the sending of information
over a physical communications media in the form of
digital signals.

Synchronous
 In synchronous serial transmission gaps are
not allowed between bytes.
 No additional bits will be transmitted only data
bits are transmitted.
 Sender and receiving clock are synchronized at
bit level.
Asynchronous
 In asynchronous serial transmission gaps are
allowed between consecutive bytes.
 In this transmission, in each byte atleast 2 bits
are added :
(a) Start bit
(b) Stop bit

Data Encoding and Modulation Techniques


Encoding is the process of converting the data or a
given sequence of characters, symbols, alphabets etc.,
into a specified format, for the secured transmission of
data. Decoding is the reverse process of encoding
which is to extract the information from the converted
format.
Data Encoding Techniques:
The data encoding technique is divided into the
following types, depending upon the type of data
conversion.
(A) Digital to Digital

(a) Unipolar : In unipolar technique we use only


'one' voltage level. Generally we represent a bit '1' by
positive voltage level and bit '0' by no voltage level.
N
S
r
S : Signal Rate (bauds)
N : Data Rate (bps)
r : Ratio between data and signal element
In unipolar technique
Signal rate = Data rate
S=N
Unipolar technique, is not self synchronized and
contains DC component problem.
Self Synchronized
 It states that if sending clock and receiving
clock are out of order, then the technique must
be robust enough to handle such situation.
 If technique handles such problem then that
technique will be self synchronized.
 If signal becomes constant for any data, then
technique will not be self synchronized.
DC Component
 To identify DC component problem, we take
average amplitude of the signal, if it is zero it
indicates DC component problem will not there
otherwise DC component problem will be there.
 In D.C. component, we have low frequency
signal and these low frequency signals are
generally not allowed by today's device.
(b) Polar : In polar technique we use 2 voltage
levels.
(i) NRZ Method (Non Return to Zero) : In this
method the signal will never come to zero.
NRZ-L : A bit '0' represent by positive voltage level
and bit '1' represented by negative voltage level.

S=N
It is not self synchronized and it contain DC
component.
NRZ-L (Non Return to Zero Inversion Method)
Bit 1 : Inversion
Bit 0 : No Change

S=N
It is not self synchronized but contains DC
component.
(ii) RZ (Return to Zero) : In this signal always
return to zero. In this method, the bit '1' represented by
positive to zero level and bit '0' represented by negative
to zero.
1
r
Here 2

 S = 2N
It is self synchronize and contain DC component.
(iii) Biphase : In this signal is inverted at the middle
of bit interval.
(1) Manchester : In this technique a bit '1' is
represented by negative to positive and bit '0' is
represented by positive to negative.

1
r
Here 2

 S = 2N
It is self synchronized and no DC component is
there.
Manchester technique invested a signal at the
middle of bit interval for both :
(a) Bit Representation
(b) Synchronization
(2) Differential Manchester : In this technique, the
signal is inverted at the middle of the bit interval for
synchronization.
Bit '0' represented by inversion at beginning of bit
interval and Bit '1' represented by non-inversion at
beginning of bit interval.

1
r
Here 2

 S = 2N
In this technique
Self Synchronization (Yes)
DC component (No)
(c) Bipolar : In this technique we use following
method :
(1) AMI (Alternate Mark Inversion)
(2) Pseudoternary
(3) B8ZS
(4) HDB3 (High Density Bipolar Three Method)
(1) AMI : In AMI,
bit '1' : Inversion
bit '0' : Zero voltage

r=1
S=N
In this
Self Synchronisation (No)
DC component (No)
(2) Pseudoternary (Opposite of AMI) :
Bit '1' : Zero Voltage
Bit '2' ; Inversion

S=N
In this
Self Synchronisation (No)
DC component (No)
(3) B8ZS (Bipolar Zero 8 Substitution Method) :
It is an extension of AMI method. It resolves the problem
of synchronization of AMI. In this method 8 consecutive
zero's are replaced by a specific pattern and this pattern
depends upon the polarity of previous non-zero voltage
level.
Case-I : When polarity of previous pattern is
positive
0, 0, 0, +ve, –ve, 0, –ve, +ve

Case-II : When polarity is negative


0, 0, 0, –ve, +ve, 0, +ve, –ve
In this method
S=N
It is Self Synchronised and no DC component is
there.
(4) HDB3 (High Density Bipolar 3 Method) : It is
also an extension of AMI. It replaces the four
consecutive zero with some pattern and pattern will
depend on two factors :
(1) The polarity of previous non-zero voltage level.
(2) The number of non-zero voltage level (may be
even and odd)
Case-I : Positive, even (–ve, 0, 0, –ve)
Case-II : Negative, even (+ve, 0, 0, +ve)
Case-III : Positive, odd (0, 0, 0, +ve)
Case-IV : Negative, odd (0, 0, 0, –ve)
In this no DC component and it is self synchronised.
Analog to Digital Conversion
In this technique the transmission convert analog
signal to digital signal.
(1) PAM (Pulse Amplitude Modulation)
(2) PCM (Pulse Code Modulation)
(1) PAM :
 In this technique we perform sampling to
convert analog to digital.
 In PAM method, to produce the original signal
at the receiving end, it is mandatory that
sampling must be done accurately at
transmitting end.
Sampling rate = 2fmax
where fmax = Max. frequency of original
signal.
 Since PAM technique totally rely on the
amplitude and noise affects the amplitude first.
Hence, this technique is not noise resistant.
Q. A complex low pass signal has bandwidth = 200
KHz. What is the maximum sampling rate for signal.
200 KHz
0 Hz f ma x

Bw = fmax – fmin
200 = fmax – 0
fmax = 200 KHz
Sampling rate = 2 × 200 = 400 KHz
(2) PCM :
 In this method three steps are used :
Step-1 : Perform Sampling
Step-2 : Quantization
Step-3 : Binary Encoding
 The Quantization is a process of assigning sub
integral value to each sample.
 The Integral value will be depending on number
of bits are used to represent each sample.
Example : 3 bit for each sample
23 = 8
If Vmax = 20 V
Vmin = – 20 V
 V  Vmin 
   max 
 L  (L : No. of Integral Values)
20  20
  5V
So, 8

Digital to Analog Method


Four methods are used :
(1) ASK (Amplitude Shift Key)
(2) PSK (Phase Shift Key)
(3) FSK (Frequency Shift Key)
(4) QAM (Quadrature Amplitude Modulation)
(1) Amplitude Shift Key (ASK) :
 In ASK we change the amplitude of carrier
signal to represent digital information by
keeping frequency and phase constant.

 This technique is not noise resistant.


 The constellation diagram represents the
amplitude and phase of any signal.

0 : Means small dis


1 : Means bigger dis
Here N = 2S
In 4ASK
for 2 ASK N = S
for 4 ASK N = 2S
8 ASK N = 3S
16 ASK N = 4S
Also Bandwidth of ASK (B) = (1 + d)S
d : fudge factor 0101
for min Bw d = 0
max Bw d = 1
S : signal rate

Q. An analog signal has bit rate of 8000 bps and band


rate of 1000 bands. How many data elements are
carries by each signal and compute max bit rate by
assuming given signal is ASK method.
Sol. N = 8000 bps
S = 1000 bands
N
r
S
N
S
 r
8000
r 8
1000
Max bit rate = (1 + 1)S
= 2S
Bandwidth = 2000 Hz
(2) Frequency Shift Key (FSK) : In FSK to
represent the digital information we vary frequency of
carrier signal by keeping amplitude and phase constant.
In case of FSK, all points are overlapping each
other in constellation diagram.
Bandwidth = (1 + d) S + 2 f
d = 0 to 1
2f = Difference between max. carrier
frequency and min. carrier frequency.
(3) Phase Shift Key (PSK) : In PSK, we vary phase
of carrier signal to represent digital data by keeping
amplitude and frequency as constant.

(4) QAM (Quadrature Amplitude Modulation) :


 It is the combination of ASK and PSK.
 In QAM we vary amplitude and phase of carrier
signal to represent the digital data by keeping
the frequency as constant.
4 QAM (2 Amplitude, 2 Phase)
8 QAM (4 Phase, 2 Amplitude)

Q. In the waveform (a) given below, a bit stream is


encoded by Manchester. The same bit stream is
encoded in a different encoding scheme in form (b).
The bit stream 8 coding scheme are :
(Gate 2007)

Sol. 1000010111 in (a)


Integral Manchester in (b)

Broadband and Baseband Transmission


The Broadband transmission employs analog
signals which include optical or electromagnetic wave
form of signal. The signals are sent into multiple
frequencies permitting multiple signals to be sent
simultaneously. Frequency division multiplexing is
possible in which the frequency spectrum is divided into
multiple sections of bandwidth. The distinct channels
can support different types of signals of varying
frequency ranges to travel simultaneously (at the same
instance).
The signals propagated at any point are
unidirectional in nature, in simple words the signal can
be travelled at only one direction, unlike baseband
transmission. It requires two data path that are
connected at a point in the network refer to as head end.
The first path is used for signal transmission from the
station to the headend. And the other path is used for
receiving propagated signals.
Key Differences Between Baseband and Broadband
Transmission
1. Baseband transmission utilizes digital
signalling while broadband transmission uses
analog signalling.
2. Bus and tree topologies, both works well
with the broadband transmission. On the other
hand, for the baseband transmission bus
topology is suitable.
3. Baseband involves Manchester and
differential Manchester encoding. In contrast,
broadband does not make use of any digital
encoding instead it uses PSK (Phase shift
keying) encoding.
4. The signals can be travelled in both the
direction in baseband transmission whereas in
broadband transmission the signals can travel
in only one direction.
5. In baseband transmission, the signals
cover shorter distances because at higher
frequencies the attenuation is most pronounced
which make a signal to travel short distances
without reducing its power. As against, in
broadband signals, the signals can be travelled
at longer distances.
6. In the baseband transmission the whole
bandwidth of the cable is utilized by a single
signal. Conversely, in the broadband
transmission, multiple signals are sent on
multiple frequencies simultaneously using a
single channel.
Comparison Chart
BASIS FOR BASEBAND BROADBAND
COMPARISON TRANSMISSION TRANSMISSION
Type of Digital Analog
signalling used
Application Work well with bus Used with a bus as
topology. well as tree
topology.
Encoding Used Manchester and PSK encoding.
Differential
Manchester
encoding.
Transmission Bidirectional Unidirectional
Signal range Signals can be Signals can be
travelled over travelled over long
short distances distances without
being attenuated.

Conclusion
The baseband and broadband transmissions are
the types of signalling. Baseband transmission uses
digital signalling and involves digital signal or electrical
impulse that can be carried in a physical media such as
wires. The broadband transmission uses analog
signalling which involves optical signals or signals in the
form of an electromagnetic wave. Baseband
transmission utilizes the whole bandwidth of the channel
to transmit a signal whereas in broadband transmission
the bandwidth is divided into variable frequency ranges
to transmit the different signals at the same instant.
Multiplexing
Multiplexing combines multiple analog or digital
signals bound for transmission through a single
communication channel.
Types of Multiplexing
1. Frequency Division Multiplexing (FDM)
FDM is an analog multiplexing that combines
analog signals.
M o du lato r

f1

+
f2

f3

In this type of multiplexing, signals are generated by


sending different device modulated carrier frequencies
and these are then combined to a single link.
To accommodate the modulated signal, the carrier
frequencies are separated with enough bandwidth.
2. Wavelength Division Multiplexing (WDM)
WDM is a technology is fibre optic communications
and high capacity communications.
The system uses multiplexer at transmitter to join
signals and demultiplexer to split signals apart i.e. at the
source to combine multiple light source into a single light
source at multiplexer and at the demultiplexer the single
light is converted into multiple light source.
WDM is designed to use the high data rate
capability of fibre optic cable.
1 TX RX 1

2 TX 1 , 2, 3 ... m RX 2

n TX RX n

MUX
Wavelength Division M ultiplexing

3. Time Division Multiplexing (TDM)


TDM is a technique used to transmit a signal over a
single communication channel by dividing the time frame
into slots - one slot for each time signal.
TDM is applied to analog/digital signals where low
speed channels are multiplexed into high speed
channels for transmission.
At both the ends i.e. the multiplexer and
demultiplexer are timely synchronized and
simultaneously switched to next channel.

Transmission Media
 Below physical layer but is under its direct
control.
 Transmission media is anything that carry
information from source to destination.

G uid ed (w ire d) U n gu ide d (w irele ss)

Tw iste d C o axia l cable F ib re


pa ir op tic ca ble

Guided Media
1. Twisted Pair Cable
It consists of two conductors (normally copper) each
with its own plastic insulation twisted together.

One of the wires carries signal, other is ground, the


receiver receives the difference of the two.
The wires are twisted, so that the unwanted signals
(interference and crosstalk) is balanced at the receiver
side.
Twisted pair are of two types
Unshielded twisted pair (UTP) Shielded
Twisted Pair (STP)
It is most common twisted pair cable In this
extra mesh covering that improves
quality used only in IBM
Applications
1. These are used in telephone lines to provide
voice & data channels. Local loops use UTP.
2. DSL lines used by telephone companies to
provide high data rate use UTP.
3. LAN network, 10-Base T & 100 Base T use
twisted pair cable.
Coaxial Cable
It carries signal of higher frequencies than in twisted
pair.
Instead of two wires, coaxial cable has a central
core conduction of solid or standard wire (usually
copper) enclosed in insulating sheath, in turn in outer
conductor of metal foil, or combination of two.
O uter C o nd ucto r
P lastic
C o ver
Inn er C o nd uctor
Insu lato r

Attenuation is much higher in coaxial cable than


twisted pair cable. Although coaxial cable has higher
bandwidth signal weakens rapidly.
So, requires frequent use of repeaters.
Application : Digital Telephone Networks
Cable TV Networks
Fibre Optic Cable
It is made of glass or plastic and transmit signals in
the form of light
le ss d en se

m o re d ense
I

When incident angle (I) > critical angle


 Attenuation is lesser in this case. So, less
number of repeaters are required than twisted
pair of coaxial cables.
 These are expensive
Applications
 Cable TV
 High speed LANs 100 Base FX, 1000 Base X.
Advantage
 Higher Bandwidth
 Less signal attenuation. Immune to noise
interference
 Light weight
 Resistance to corrosive materials
Disadvantage
 Installation & Maintenance is more
 Unidirectional with one optical fibre
 Cost is huge
Unguided Wireless Media
Transmission using e-m waves without using a
physical conductor.
R a dio w ave Ligh t
Infra red
& M icrow ave W ave
3 kH z 30 0 400 900
GHz THz THz

Radio Wave
 Omnidirectional i.e. signal flows in all direction
so, receiving & transmitting antennas need not
be aligned.
 It can penetrate walls.
 Long distance used in AM radio.
 Applications include  multicasting, AM, FM,
television, maritime radio, cardless phone,
paging.
Micro Wave
 Unidirectional i.e. signal flows in a single
direction thus, antennas need to be aligned.
 Very high frequency microwaves can not
penetrate walls.
 Microwave bond is wide, thus can be sub
divided and higher data rate is possible.
 Applications include unicast in cellular phones,
satellite networks, wireless LANs.
Infrared (300 GHz – 400 THz)
 It is useful for short range communication
 They cannot penetrate walls.
 Infrared cannot be used outside a building
because sunlight contain infrared waves that
can interfere with communication.
 Application include keyboards, mouse, PCS
and printers.

Q. Which of these is not an advantage of optical fibre


(A) Easy Installation and maintenance
(B) Immune to em interference
(C) Less signal attenuation
(D) Greater immunity to tapping
Sol. Correct Option is (A)

Q. Loss in signal power as light travels down the fibre


is called ?
(A) Attenuation (B) Propagation
(C) Scattering (D) Interruption
Sol. Correct Option is (A)

Q. Which type of EM waves are used for unicast


communication ?
(A) Infrared (B) Microwaves
(C) Radio Waves (D) Light Waves
Sol. Correct Option is (B)
Transmission Errors
In Communication Networks due to external
electromagnetic signals can cause incorrect delivery of
data therefore the data in the communication Networks
can be received incorrectly, data can be lost, or
unwanted Communication Networks data can be
generated. Any of these problems are called
transmission errors in communication networks.
Types of errors:
Interferences can change the timing and shape of
the signal. If the signal is carrying binary encoded data,
such changes can alter the meaning of the data. These
errors can be divided into two types: Single-bit error and
Burst error.
Single-bit Error
The term single-bit error means that only one bit of
given data unit (such as a byte, character, or data unit)
is changed from 1 to 0 or from 0 to 1 as shown in Fig.

Single bit errors are least likely type of errors in


serial data transmission. Imagine a sender sends data at
10 Mbps. This means that each bit lasts only for 0.1 s
(micro-second). For a single bit error to occur noise
must have duration of only 0.1s (micro-second), which
is very rare. However, a single-bit error can happen if we
are having a parallel data transmission. For example, if
16 wires are used to send all 16 bits of a word at the
same time and one of the wires is noisy, one bit is
corrupted in each word.
Burst Error:
The term burst error means that two or more bits in
the data unit have changed from 0 to 1 or vice-versa.
Note that burst error doesn't necessary means that error
occurs in consecutive bits. The length of the burst error
is measured from the first corrupted bit to the last
corrupted bit. Some bits in between may not be
corrupted.

Burst errors are mostly likely to happen in serial


transmission. The duration of the noise is normally
longer than the duration of a single bit, which means that
the noise affects data; it affects a set of bits.
Error Handling Mechanism
Error Control

E rro r D etectio n E rro r


m e cha nism correction

P arity bit H a m m in g cod e


(a) E ven
(b) O dd
CRC
C h ecksum

 In error detection mechanism, the receiver


detects the error within frame. Therefore, it
sends retransmission request to sender.
 In error correction, error needs to be
detected & corrected at the receiver end only.
In this no retransmission request will be sent.
Error

S ing le bit e rro r B urst error


E g - S e nt 1 0 0 0 0 0 0 1 S en t 1 0 0 0 0 0 0 1
R e ceive d 1 1 0 0 0 0 0 1 R e ceive d 1 1 0 0 0 0 1 1
H a m m ing dista nce = 2 i.e
2 b it ch an ge
Le ng th of bu rst error = 6

Parity Bit
In this one bit control information is appended as a
least significant bit with data word to be produced
Length of code word = [Length of dataword + 1]
Even parity - The number of 1’s within the code
word must be same even number
E.g.1 Dataword  11110000
Codeword  1 1 1 1 0 0 0 0 0
E.g.2 Dataword  10001111
Code word  1 0 0 0 1 1 1 1 1
At the receiver end in this method, the receiver
counts the number of 1’s within the received
codeword.
 If it is even no error otherwise error
Advantage
(1) The parity code can detect all single bit errors.
(2) The even parity code can detect all burst errors
with odd having distance.
Limitation
This code cannot detect burst error with even
hamming distance.
Odd parity
The number of one’s within code word must be odd.
E.g. : Dataword 11110000–
Codeword 1 1 1 1 0 0 0 0 1
Dataword 10001111
Codeword 1 0 0 0 1 1 1 1 0
CRC  Cyclic Redundancy Check
The various steps are
(1) Prepare a binary stream for the given
polynomial/generator polynomial g(x)
(2) Append n zero’s at the least significant position
of the given dataword.
Where n is degree of the given polynomial g(n)
Suppose polynomial is x3 + 1 n = 3.
(3) Perform binary division operation between
the binary number generated in step 1 and step
2
(4) The reminder is the CRC bits, that we
append at least significant bit of data word, to
produce the codeword.
CRC Checker
The receiver performs binary division operation
between received codeword and given polynomial.
If reminder is zero that means no error otherwise
error
Length of codeword = [Length of dataword + n]

Ex. The message to be transmitted is 100011 and


generator polynomial is 1 0 0 1. Perform the
operations at sender and receives side.
Sol. Sender side
(1) g(x) = 1 0 0 1
(2) D(x) = 1 0 0 0 1 1 0 0 0 0
1001 1000110000 1001111
1001

0011
0000
0111
0000
1110
1001
1110
1001
1110
1001
1110
1001
1 1 1 R e m in de r

(3) Data word


1 0 0 0 1 1 0 0 0 0
 1 1 1
1 0 0 0 1 1 0 1 1 1

Receiver Side
1001 1000110111 1001111
1001

0011
0000
0111
0000
1110
1001
1111
1001
1101
1001
1001
1001

Thus Remainder = 0 Means no error


The condition for selecting good generator
polynomial are —
(1) The given polynomial g(x) should not be
divisible by x
(2) The given polynomial g(x) should be a factor of
x+1
Suppose g(x) = x3 + 1 x+1=0
= (-1)3 + 1 (x = –1)
=0
Thus, x3 + 1 has factor (x + 1)
(3) Given polynomial should not be divisible by
xk+1 where 2  k  n – 1
Limitation
 CRC method can detect burst errors only upto
length n
Where n is degree of generator polynomial.

Q. The message 1 1 0 0 1 0 0 1 is to be transmitted


using CRC polynomial x3 + 1 to be protected from
errors.
The message transmitted is : —
(A) 1 1 0 0 1 0 0 1 0 0 0 (B) 1 1 0 0 1 0 0 1
011
(C) 1 1 0 0 1 0 1 0 (D) 1 1 0 0 1 0 0 1
0011
Sol. P(x) = 1 1 0 0 1 0 0 1
Divisor D(x) = 1 0 0 1
1001 11001001000 110100011
1001

1011
1001
01000
1001
001100
1001
1010 CRC = 0 1 1
1001
011

So, transmitted message = 1 1 0 0 1 0 0 1 0 1 1


Option (B) is correct.

Q. Consider the following message M = 1 0 1 0 0 0 1 1


01
The CRC for this using the divisor polynomial x5 +
x4 + x2 + 1 is : —
(A) 0 1 1 1 0 (B) 0 1 0 1 1
(C) 1 0 1 0 1 (D) 1 0 1 1 0
Sol. Here degree of generator is five so, append 5 more
zero’s
x5 + x4 + x2 + 1 = 1 1 0 1 0 1 is divisor
So, after division
110101 101000110100000
110101

111011
1 1 0 1 0 1 
111010
1 1 0 1 0 1 
111110
1 1 0 1 0 1 
101100
110101
111010
110101
01110
Remainder is 0 1 1 1 0
Correct option is (A).

Q. Let G(x) be the generator polynomial used for CRC


checking. What is the condition that should be
satisfied by G(x) to detect odd number of bits in
error.
(A) G(x) contain more than two terms
(B) G(x) does not divide 1 + xk, k  any frame
length
(C) 1 + x is a factor of G(x)
(D) G(x) has an odd number of terms.
Sol. Correct option is (C).

Checksum
In checksum error detection scheme,
Sender Side
1. The given dataword is divided into n bits where
n  length of checksum.
2. Perform binary addition operation to produce
the sum.
If sum contains a carry then that carry is also
added
3. Take the one's complement of the sum. This
one's complement of the sum is checksum.
These checksum bits will be appended to the
least significant bit within data word to produce
code word.
Receiving end
4. The receiver decompose the received
codeword into group of n bits perform the
binary addition.
5. If sum contains a larry, then that carry will also
be added to the sum.
6. Finally the receiver takes the one's
complement of sum and check whether value is
zero or not.
If it is zero then no error otherwise error
Advantage : It can detect all single bit errors.
Limitation : It can detect burst errors only upto
length 'n'
Example : Dataword is 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0
1 00001111
n=8
Sender
0 1 0 0 0 0 1 0
0 1 0 1 0 1 0 1
() 0 0 0 0 1 1 1 1
1 0 1 0 0 1 1 0

Checksum  0 1 0 1 1 0 0 1
Receiver : 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 0 0 0 1 1
11010111001
n=8
0 1 0 0 0 0 1 0
0 1 0 1 0 1 0 1
0 0 0 0 1 1 1 1
0 1 0 1 1 0 0 1

 1 1 1 1 1 1 1 1
Complement = 0 0 0 0 0 0 0 0 (no error)
Example : Let dataword be 10110011 10101011
01011010 11010101
n=8
Sender Receiver
10 1100 11 (1 )
10 1100 11 (1 ) 10 1010 11 (2 )
10 1010 11 (2 ) 01011110
01 011110 +1
+1 01 011111
01 011111 010110 10 (3 )
01 0110 10 (3 ) 10 111 00 1
10 111 00 1 11 01 01 01 (4 )
11 0101 01 (4 ) 1000 111 0
1
10 00 111 0
1 1000 1111
S um : 10 00 1111 01110 00 0 (5 )
C h ecksum 01110 00 0 (5 ) S um : 11111111
C o m ple m e nt = 0 00 00000
(N o E rror)
Two-Dimensional Parity Check
 This technique organised a number of binary
words being transmitted or received in
succession along two dimensions that is row
and columns.
 Two sets of parity bits are computed
Rows of data block  Longitudinal
Redundancy Check (LRC)
Columns of data block  Vertical Redundancy
Check (VRC)
 The parity bits are added to make sure the
parity should be even/odd
E.g.: Let Data be –
D ata P arity
0 1 0 0 0 1 1 1 0
0 1 1 0 1 1 1 1 0
0 1 1 0 1 1 1 1 0
0 1 1 0 0 1 0 0 1

0 0 1 0 0 0 1 1 1

Suppose data word received is –


erro r
0 1 1 0 0 1 1 1 0  O d d P arity
0 1 1 0 1 1 1 1 0
0 1 1 0 1 1 1 1 0
0 1 1 0 0 1 0 0 1

0 0 1 0 0 0 1 1 1

od d p arity

So, it can detect which bit is in error.


It can correct 1-bit, 2-bit, 3-bit & most 4-bit errors.
Q. Data transmitted on a link uses the following 2D
parity scheme
Each sequence of 28 bits is arranged in 4 × 7
matrix (row r0 – r3, columns d7 – d1) and is padded
with a column do and row r4 of parity. Computed
with even parity scheme. These u0 bits are
transmitted over the data link.
d7 d6 d5 d4 d3 d2 d1 d0
r0 0 1 0 1 0 0 1 1
r1 1 1 0 0 1 1 1 0
r2 0 0 0 1 0 1 0 0
r3 0 1 1 0 1 0 1 0
r4 1 1 0 0 0 1 1 0

The data shows what is received by receiver &


contains n errors. What are minimum possible
values of n? [Gate
2008]
(A) 1 (B) 2
(C) 3 (D) 4
Sol. (C) r1 has odd number of zeros
d5, d2, d0 have odd number of zeros
So, entry r1 d5 = 1
r1 d2 = 0
r1 d0 = 1
Minimum error = 3.

Q. Consider a parity check code with three data bits


and four check bits. Three of the code words are –
a : 0101011 b : 1001101 c : 1110001
Which of the following are also code word?
I. 0010111 II. 0110110
III. 1011010 IV. 0111010
(A) I and III (B) I, II and III
(C) II and IV (D) I, II, III, IV
Sol. (A) EXOR of two codewords is a codewords itself

Error Correction : Using Hamming code


In hamming code technique we add &
redundant bits to the m bit of data
n

m bits r bits

n=m +r

The no. of redundant bits added are,


2r  m  r  1
Q. For transmitting 11 bit codeword, how many
redundant bits are required to produce hamming
code.
Sol. Here m = 11
2r  (11 + r + 1)
2r  (12 + r)
Taking r = 4
24  12 + 4
16  16
Thus redundant bits to be added = 4

Q. For transmitting 10111 dataword, find the total


length of code word
Sol. Here m=5
2r  m + r + 1
2r  5 + r + 1
2r  6 + r
For r = 4, 24  6 + 4  16  10
Total Length of code word
=m+r
= 5 + 4 = (9)

Other Terms
Hamming Distance : It is the number of bit
positions in which two code words differ
100101
101010
 Hammin g Dis tan ce  4
Dmin : The smallest hamming distance between all
pairs of the code words is called min. Hamming
distance.
It is also equal to min Hamming weight (other than
0) of all codewords
Suppose, 0000
0111
0110
1100
1110 are the code words, what is the
minimum distance (dmin)
0000 H(w) = 0
0111 H(w) = 3
0110 H(w) = 2
1100 H(w) = 2
1110 H(w) = 3
Where, H(w) is hamming weight
dmin = 2
The minimum distance can,
(a) Detect S-error
Dmin  S + 1
(b) Correct t errors
Dmin  2t + 1
(c) Can detect S errors & correct t errors
simultaneously
Dmin  S + t + 1

Q. An error correcting code has following codewords


00000000, 00001111, 01010101, 10101010,
11110000. What is the maximum number of errors
that can be corrected?

(A) 0 (B) 1
(C) 2 (D) 3
Sol. (D) H(w) is hamming weight
00000000 H(w) = 0
00001111 H(w) = 4
01010101 H(w) = 4
10101010 H(w) = 4
11110000 H(w) = 4
dmin = 4
So, dmin  2t + 1
4  2t + 1
3  2t
3
t 2

t  1.5
So, 1 error can be corrected.

Construction of Hamming Code


1. Calculate the number of redundant bit
according to message length.
E.g.: For bit sequence 1001110
m=7
2r  m + r + 1
2r 8 + r
r=4
D4 D10 D9 P8 D7 D6 D5 P4 D3 P2 P1

So, 1 0 0  1 1 1  0  
2. Parity bits need to be calculated
 For P1 use D3 D5 D7 D9 D11 01101
Thus, For even parity P1 = 1
 For P2 use D3 D6 D7 D10 D11 01101 P2
=1
 For P4 use D5 D6 D7 111 P4 = 1
 For P8 D9 D10 D11 001 P8 = 1
Thus, hamming code transmitted,
(10011111011)
E.g. 2 Find Hamming code for dataword 0111. Even
Parity
D7 D6 D5 P4 D3 P2 P1
D 1 1  1  

For P1 use D3 D5 D7 110 P1 = 0


For P2 use D3 D6 D7 110 P2 = 0
For P4 use D5 D6 D7 110 P4 = 0
So, Codeword 0110100
E.g. Let the receiver has received the code word
'110010101'. Then correct this codeword if there is
some error using hamming code technique.
Sol. Calculate:
1 1 0 0 1 0 1 0 1
D9 P8 D7 D6 D5 P4 D3 P2 P1 

C1 : P 1 D 3 D 5 D 7 D 9 : 1 1 1 0 1 (even) 
C1 = 0
C2 : P 2 D 3 D 6 D 7 0 1 0 0 (odd)  C2 = 1
C4 : P 4 D 5 D 6 D 7 0 1 0 0  C4 = 1 (odd)
C8 : P 8 D 9 1 1  C8 = 0 (even)
C8 C4 C2 C1

Thus,
th
0 1 1 0  6 thus 6 bit is in error

Correct Codeword is
(110110101) Ans.

Q. The receiver has received the codeword 0110101.


Correct this codeword using hamming technique.
7 6 5 4 3 2 1
0 1 1 0 1 0 1

C1 : 1, 3, 5, 7 C1 : 1, 1, 1, 0  C1 = 1
C2 : 2, 3, 6, 7 C2 : 0, 1, 1, 0  C2 = 0
C4 : 4, 5, 6, 7 C4 : 0, 1, 1, 0  C4 = 0
C4 C2 C1
0 0 1  1st bit is in error.

Received Codeword = 0110101


Correct Codeword = 0110100 Ans.

2. COMPUTER NETWORKS

A network is a set of devices connected by links.


The links are often called communication channels.
Network Topologies
Physical Structures
(a) Types of connection
Point to Point Multipoint
Dedicated link between two Connection
in which more than 2 devices
devices share a single link.
E.g.: mesh star E.g.: Bus star
(b) Physical Topology
Refers to the way in which network is connected
physically.

M e sh S ta r B us R in g
1. Mesh: In this every system is connected to
every other system by a dedicated link or
channel.
1 2

 dedica ted link

3 4

If there are N devices


N(N  1)
Total No. of cables = 2

No. of parts = N – 1 (for each device)


Advantage
1. Security is high
2. Speed of communication is fast
Disadvantage
1. Cost of cables is high, if no. of systems
increases cost of cables increases
exponentially.
2. Cost of maintenance is also high.
2. Star Topology: Each device has a dedicated
point to point link only to a central controller
usually called a hub.
1

5 Hub 2

4 3

Hub can be passive (not intelligent) or active


(non broadcasting)
For N devices,
No. of cables required = N
No. of I/O ports = 1 (for each device)
Advantage
1. Less expensive than mesh.
2. Robustness : one link fail do not affect
other hub can monitor problems
Disadvantage
1. If hub goes down, whole system goes
down
2. More Cable than Ring or bus
Application : LAN, High Speed LANS
3. Bus Topology : Multipoint / Multidrop

S ha red C ab le

drop line s

Advantage
1. Ease of installation
2. Less Cabling
Disadvantage
1. Increase collision, so protocol like
CSMA/CD will be required
2. Difficult reconnection and fault isolation.
Application : Ethernet LANs
4. Ring Topology : Single shared medium on a
circular ring. Stations gain access to token &
can then only send the data.
M onito r
S ta tion

S ta tion A

S ta tion C

S tation B
In this there is no possibility of collision as
token is circulated.
Advantage
1. Easy to install and reconfigure.
2. Even if a device is not working it can issue
alarm, the network operator can see
problem and locate error.
Disadvantage
1. Unidirectional Traffic
2. Break in ring cause problem.
Application : LAN
Categories of Network
Netw ork

Local a re a N etw o rk M e trop olita n N e tw o rk W id e a rea N etw o rk


(L A N ) (M A N ) (W A N )

1. Local Area Network (LAN)


 It is usually privately owned and link the
devices in a single office, building or campus
 LAN is limited to few kilometers
 LAN topology – bus, star, ring, mesh.
 Data rate of LAN is 4 to 16 mbps. Now, a days
may have to 100 mbps to 1 gbps
2. Metropolitan Area Network (MAN)
 Network extended over entire city.
 It can be a single network (Cable N/W) or
connecting LANs. Technologies of MAN : ATM,
FDDI, DQDB, SMDS.
 Example include : part of the telephone
company that can provide high speed DSL
lines to customer or cable TV network. It is also
used for high speed data connection to
internet.
 Typical range : 5 to 50 kms.
3. Wide Area Network (WAN)
 Long distance communication of data, voice,
image over large geographical areas that
compromise a country, continent or even whole
world.
 WANs utilize public, leased or private
communication devices.
Difference between LAN, WAN, MAN
LAN MAN WAN
A network that It covers large It connects
connects region such as countries
computer in a cities, towns together
small
geographical
area
Owned Private Private or Public, Leased
Public
Speed High Moderate Low
Congestio Less More More
n
Devices Wifi Ethernet Modem, Optic Wire,
for Cable Wire/Cable Microwave,
communic Satellite
ation
Example Ethernet cables Cable TV Internet
connecting
computers

Wireless Networks
Wireless communication is one of the fastest
growing technologies. Wireless LANs can be found on
college campus, in office buildings and in many public
areas.
One of the standard for wireless LANs is
IEEE802.11 and Bluetooth, a technology for small
wireless LANs.
S erve r
or
D istrib utio n S yste m ga tew a y

AP AP AP

BSS BSS B SS

ESS : extended service set

BSS : Basic Service Set, AP : Access Points.


Basic Service Set (BSS)
It is a building block of a wireless LAN. A BSS is
made of stationary or mobile wireless stations and an
optional central base station known as access points
(APs)
Extended Service Set (ESS)
An ESS is made up of two or more BSS with APS.
The BSS are connected through a distribution system.
BLUE TOOTH
Bluetooth is a wireless LAN technology designed to
connect devices of different functions such as
telephones, notebooks, cameras and so on.
A bluetooth LAN is an adhoc network which means
that the network is formed spontaneously. The devices
sometimes called gadgets find each other and make a
network called piconet. Bluetooth LAN, by nature cannot
be large.
Bluetooth has two types of architecture
a) Piconet
P rim a ry

S econ da ry S econ da ry S econ da ry

A bluetooth network is called a piconet or a small


net. It can have 8 stations, one of which is called
primary, other secondaries. The communication
between primary and secondary can be one to one or
one to many.
Scatternet
Piconets can be combined to form what is called a
scatternet. A secondary station in one piconet can be
the primary in another piconet.
This station can receive messages from primary is
the first piconet (as a secondary) and acting as a
primary deliver them to secondaries in second piconet.
P rim a ry

S econ da ry

S econ da ry P rim a ry/


S econ da ry S econ da ry
P icon et
P iconet

Scatternet

Internetwork
The ability to share information over dissimilar
network is known as internetwork. By using a set of
standards, nodes in two (or more) data network can
share information reliability.
LA N R LA N

R R

LA N R W AN R LA N

R R

LA N R MAN

Internetw ork

internet vs Internet
(lowercase 'i') (upper case 'I')
An internet is a group of distinct network connected
to one another via a gateway. Any network that confirms
to standard defined in TCP/IP is an internet.
The Internet : In addition to world wide web (www),
it consists of a world wide collection of networks,
including academic institutions, government
organisations, various public as well as private network.
Intranets
An Intranet is an IP-based network that is
administered and controlled by a single entity. An
intranet is a controlled network, with only users who
have authorization to be on the network granted access
to it.
Example : A corporate LAN.
In intranet, security (firewall, encryption) is in place
this allows remote users to access applications over the
internet, while preventing unauthorized users from
gaining access.
Extranets
An extranet is an intranet that is opened up to allow
outside users access to intranet. The access normally is
provided by a server, which clients access over the
internet.
Virtual Private Network (VPN)
A VPN is an extranet that securely connects
separate networks to one another, as well as individuals
to networks.
VPN technology uses a public network (normally
internet) to connect users and networks to one another
in what are known as tunnels
VPN tunnelling protocols include :
 Generic Routing encapsulation (GRE)
 IPSEL
 Tunnelling protocols like PPTP, L2TP
These tunneling protocols ensure that data is
encrypted on sending end of tunnel and is decrypted at
the receiving end of the tunnel.

3. NETWORK MODELS
Layered Architecture
The basic elements of a layered model are
services, protocols and interfaces. A service is a set of
actions that a layer offers to another (higher) layer.
Protocol is a set of rules that a layer uses to exchange
information with a peer entity. These rules concern both
the contents and the order of the messages used.
Between the layers service interfaces are defined. The
messages from one layer to another are sent through
those interfaces. In an n-layer architecture, layer n on
one machine carries on conversation with the layer n on
other machine. The rules and conventions used in this
conversation are collectively known as the layer-n
protocol.
OSI Reference Model and its Protocols
 International standard organisation (ISO) is
1947.
 An ISO standard that covers all aspects of
network communications is the open system
interconnection Model (OSi) introduced in
1970.
 An open system is a set of protocols that allows
any two different systems to communicate
regardless of their underlying architecture.
 It is not a protocol, it is a model for
understanding and designing a network
architecture that is flexible, robust and
interoperable.
× ×
Interm ed ia te N od e
D e vice A D e vice B
P ee r to Pe er P roto col
7 A pp licatio n la yer A pp licatio n la yer
7-6 Interfa ce
6 P rese ntatio n la yer P rese ntatio n la yer
U se r
S up po rt
5 S essio n laye r S essio n laye r

4 Tran sp ort layer Tran sp ort la yer

3 N e tw o rk laye r N e tw ork laye r


N e tw o rk
S up po rt 2 D a ta link la yer D a ta link la yer
La yer
1 P hysical layer P hysical layer

P hysical C o m m unica tion

 Within a single machine, each layer calls upon


the services of the layer just below it. Layer 3
for example uses the services provided by
layer 2 and provides the services for layer 4.
 Between machines layer x one machine
communicates with layer x on another
machine. This communication is agreed upon
some protocols. These are called peer to peer
processes.
 Interface between layer : Each interface
define the information and services a layer
must provide for layer above it.
H7 D7 H7 D7

H6 D6 H6 D6

H5 D5 H5 D5

H4 D4 H4 D4

H3 D3 H3 D3

H2 D2 T2 H2 D2 T2

H1 01 01 01 ........... 1 00 0 H1 01 01 01 ........... 1 00 0

Tran sm ission M ed ia

1. Physical Layer
It deals with the mechanical and electrical
specifications of the interface and transmission
media.
Functions of Physical Layer are :
(a) Physical Characteristic of Interface and
Medium
(b) Encoding
(c) Data Rate : No. of bits sent per second
(d) Synchronization of bits
(e) Physical Topology
(f) Transmission Mode : Simplex, Half Duplex &
Full Duplex
(g) Link Configuration : Point to Point, Multipoint.
2. Data Link Layer (DLL)
The Data link layer transforms, the physical layer (a
raw transmission facility) to a reliable link.
Functions of data value layer are :
(a) Framing
(b) Physical Addressing
Frames are to be distributed to different system
on network.
(c) Flow Control –
Rate at which data is absorbed at receiver is
less than that of sender.
(d) Error Control
Achieved using trailer
(e) Access Control
When multiple device access same link, which
device has access to the media.
E nd link X
syste m
A B
en d
Hop to H op delivery
link X link
syste m
H op E
to H
op
F
Hop to H op

 If sender want to send data from A to F


then DLL at A send frame to B, DLL at B
sends different frame to DLL at E.
 The frame exchanged between three
nodes have different value in header &
trailer.
3. Network Layer
Network layer is responsible for the source to
destination delivery of packet. If two system are
attached to same link these is no need of network layer.
(a) Logical addressing : Packet travels across the
network, we need logical address.
(b) Routing : Provide routers.
4. Transport Layer
 Transport layer is responsible for process to
process delivery of entire message.
 A process is an application program running on
host. The network layer do source to
destination delivery but of individual packets
whereas have part layers ensure whole
message delivery.
Functions of Transport layer are :
(a) Service - point Addressing (port Addresses)
(b) Segmentation and Reassembly
(c) Connection Control
(d) Flow Control – Perform end to end
(e) Error Control
5. Session Layer
 Session layer is the network dialog controller.
Functions of Session layer are :
(a) Dialog Control – Allows two system to enter
into a dialogue.
(b) Synchronization
6. Presentation Layer
It is concerned with syntax and semantics of
information.
Functions of presentation layer are.
(a) Translation
(b) Encryption
(c) Compression
7. Application Layer
 It enables the user, to access the network.
Functions of Application layer are :
(a) File Transfer access and management
(b) Mail Services
(c) Directory Services
(d) Network Virtual Terminal
It is a software version of a physical terminal and it
allows a user to log on to remote host.
Addresses
Physical Logical Port Special
Addresses Addresses Addresses Addresses
It is also called It is usually 32 It is the It is the user
link address bit long that address that friendly
identify a host process needs address like
connected to to receive the email
the internet data
simultaneously
It is the It is independent of underlying
address of physical network
node defined
by its LAN or
WAN
Size & format of address
depend on network
It is of 48 bit
long

Q. In the following pairs of OSI protocol layer/sublayer


& its functionality, the INCORRECT pair is–
(A) Network layer and routing
(B) Data link layer & bit Synchronization
(C) Transport layer & End to end process
communication
(D) MAC and channel sharing
Sol. (B) Bit synchronization is functionality of physical
layer.
Q. Get the best match between List-I & List-II.
[Gate 2004]
List-I List-II
(a) Data Link Layer (i) Ensures
reliable transport of data
over a physical
point to point link
(b) Network Layer (ii)
Encodes/decodes data for
physical
transmission
(c) Transport Layer (iii) Allow end to
end communication
between two
process
(iv) Routes data from
one network
node to the next.
Codes :
(a) (b) (c)
(A) (i) (iv) (iii)
(B) (ii) (iv) (i)
(C) (ii) (iii) (i)
(D) (i) (iii) (ii)
Sol. Correct Option is (A)

Q. Which layer of OSI is responsible for decomposition


of messages and generation of sequence number
to ensure correct decomposition from end to end
network ?
(A) Physical (B) Data Link
(C) Transport (D) Application
Sol. Correct Option is (C)

Q. Match : [Net
2014]
List-I List-II
(a) Data Link Layer (i) Flow Control
(b) Network Layer (ii) Node to
Node Delivery
(c) Transport Layer (iii) Mail Service
(d) Application Layer (iv) Routing
Code :
(a) (b) (c) (d)
(A) (ii) (i) (iv) (iii)
(B) (ii) (iv) (i) (iii)
(C) (ii) (i) (iii) (iv)
(D) (ii) (iv) (iii) (i)
Sol. Correct Option is (B)

Q. Which of the following is not associated with


Session Layer ?
(A) Dialogue Control (B) Token
Management
(C) Semantics of Information (D)
Synchronization
Sol. Correct Option is (C)

TCP/IP Model
TCP/IP Model 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. The 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:
1. Process/Application Layer
2. Host-to-Host/Transport Layer
3. Internet Layer
4. Network Access/Link Layer
The diagrammatic comparison of the TCP/IP and
OSI model is as follows:

Difference between TCP/IP and OSI Model:


TCP/IP OSI
TCP refers to Transmission OSI refers to Open Systems
Control Protocol. Interconnection.
TCP/IP has 4 layers. OSI has 7 layers.
TCP/IP is more reliable OSI is less reliable
TCP/IP does not have very
OSI has strict boundaries
strict boundaries.
TCP/IP follow a horizontal OSI follows a vertical
approach. approach.
TCP/IP uses both session
OSI uses different session
and presentation layer in the
and presentation layers.
application layer itself.
TCP/IP developed protocols OSI developed model then
then model. protocol.
The first layer is the Process layer on the behalf of
the sender and Network Access layer on the behalf of
the receiver. During this article, we will be talking on the
behalf of the receiver.
1. Network Access Layer :
This layer corresponds to the combination of Data
Link Layer and Physical Layer of the OSI model. It looks
out for hardware addressing and the protocols present in
this layer allows for the physical transmission of data.
We just talked about ARP being a protocol of
Internet layer, but there is a conflict about declaring it as
a protocol of Internet Layer or Network access layer. It is
described as residing in layer 3, being encapsulated by
layer 2 protocols.
2. Internet Layer :
This layer parallels the functions of OSI's Network
layer. It defines the protocols which are responsible for
logical transmission of data over the entire network. The
main protocols residing at this layer are:
1. IP : stands for Internet Protocol and it is
responsible for delivering packets from the
source host to the destination host by looking
at the IP addresses in the packet headers. IP
has 2 versions:
IPv4 and IPv6. IPv4 is the one that most of
the websites are using currently. But IPv6 is
growing as the number of IPv4 addresses are
limited in number when compared to the
number of users.
2. ICMP : stands for Internet Control
Message Protocol. It is encapsulated within IP
datagrams and is responsible for providing
hosts with information about network problems.
3. ARP : stands for Address Resolution
Protocol. Its job is to find the hardware address
of a host from a known IP address. ARP has
several types: Reverse ARP, Proxy ARP,
Gratuitous ARP and Inverse ARP.
3. Host-to-Host Layer -
This layer is analogous to the transport layer of the
OSI model is responsible for end-to-end communication
and error-free delivery of data. It shields the upper-layer
applications from the complexities of data. The two main
protocols present in this layer are:
1. Transmission Control Protocol (TCP) : It
is known to provide reliable and error-free
communication between end systems. It
performs sequencing and segmentation of
data. It also has acknowledgment feature and
controls the flow of the data through flow
control mechanism. It is a very effective
protocol but has a lot of overhead due to such
features. Increased overhead leads to
increased cost.
2. User Datagram Protocol (UDP) : On the
other hand does not provide any such features.
It is the go-to protocol if your application does
not require reliable transport as it is very cost-
effective. Unlike TCP, which is connection-
oriented protocol, UDP is connectionless.
4. Process Layer -
This layer performs the functions of top three layers
of the OSI model: Application, Presentation and Session
Layer. It is responsible for node-to-node communication
and controls user-interface specifications. Some of the
protocols present in this layer are: HTTP, HTTPS, FTP,
TFTP, Telnet, SSH, SMTP, SNMP, NTP, DNS, DHCP,
NFS, X Window, LPD some of them are briefly describe
here as:
HTTP and HTTPS - HTTP stands for Hypertext
transfer protocol. It is used by the World Wide Web to
manage communications between web browsers and
servers. HTTPS stands for HTTP-Secure. It is a
combination of HTTP with SSL (Secure Socket Layer). It
is efficient in cases where the browser needs to fill out
forms, sign in, authenticate and carry out bank
transactions.
1. SSH : SSH stands for Secure Shell. It is a
terminal emulations software like Telnet. The
SSH is more preferred is because of its ability
to maintain the encrypted connection. It sets up
a secure session over a TCP/IP connection.
2. NTP : NTP stands for Network Time
Protocol. It is used to synchronize the clocks on
our computer to one standard time source. It is
very useful in situations like bank transactions.
Assume the following situation without the
presence of NTP. Suppose at a transaction,
our computer reads the time at 2:30 PM while
the server records it at 2:28 PM. The server
can crash very badly if it's out of sync.
ADDRESSING
Four levels of addresses are used in an internet
employing the TCP/IP protocols: physical address,
logical address, port address, and application-specific
address. Each address is related to a one layer in the
TCP/IP architecture, as shown in the following Figure.

Physical Addresses
The physical address, also known as the link
address, is the address of a node as defined by its LAN
or WAN. It is included in the frame used by the data link
layer. It is the lowest-level address. The size and format
of these addresses vary depending on the network. For
example, Ethernet uses a 6-byte (48-bit) physical
address that is imprinted on the network interface card
(NIC).
Most local area networks use a 48-bit (6-byte)
physical address written as 12 hexadecimal digits; every
byte (2 hexadecimal digits) is separated by a colon, as
shown below.

Unicast, Multicast, and Broadcast Physical


Addresses
Physical addresses can be either unicast (one
single recipient), multicast (a group of recipients), or
broadcast (to be received by all systems in the network).
Some networks support all three addresses.
A source address is always a unicast address-the
frame comes from only one station. The destination
address, however, can be unicast, multicast, or
broadcast. The least significant bit of the first byte
defines the type of address.
Logical Addresses
Logical addresses are necessary for universal
communications that are independent of underlying
physical networks. Physical addresses are not adequate
in an internetwork environment where different networks
can have different address formats. A universal
addressing system is needed in which each host can be
identified uniquely, regardless of the underlying physical
network. The logical addresses are designed for this
purpose. A logical address in the Internet is currently a
32-bit address that can uniquely define a host connected
to the Internet. No two publicly addressed and visible
hosts on the Internet can have the same IP address.
Example (1)
The Figure below shows a part of an internet with
two routers connecting three LANs. Each device
(computer or router) has a pair of addresses (logical and
physical) for each connection. In this case, each
computer is connected to only one link and therefore
has only one pair of addresses. Each router, however, is
connected to three networks (only two are shown in the
figure). So each router has three pairs of addresses, one
for each connection. Although it may be obvious that
each router must have a separate physical address for
each connection, it may. The computer with logical
address A and physical address 10 needs to send a
packet to the computer with logical address P and
physical address 95. The sender encapsulates its data
in a packet at the network layer and adds two logical
addresses (A and P). Note that in most protocols, the
logical source address comes before the logical
destination address (contrary to the order of physical
addresses). The network layer, however, needs to find
the physical address of the next hop before the packet
can be delivered. The network layer consults its routing
table and finds the logical address of the next hop
(router 1) to be F.

Another protocol, Address Resolution Protocol


(ARP) finds the physical address of router 1 that
corresponds to its logical address (20). Now the network
layer passes this address to the data link layer, which in
turn, encapsulates the packet with physical destination
address 20 and physical source address 10. The router
decapsulates the packet from the frame to read the
logical destination address P. Since the logical
destination address does not match the router's logical
address, the router knows that the packet needs to be
forwarded. The router consults its routing table and ARP
to find the physical destination address of the next hop
(router 2), creates a new frame, encapsulates the
packet, and sends it to router 2.
Note the physical addresses in the frame. The
source physical address changes from 10 to 99. The
destination physical address changes from 20 (router 1
physical address) to 33 (router 2 physical address). The
logical source and destination addresses must remain
the same; otherwise the packet will be lost. At router 2
we have a similar scenario. The physical addresses are
changed, and a new frame is sent to the destination
computer. When the frame reaches the destination, the
packet is decapsulated. The destination logical address
P matches the logical address of the computer. The data
are decapsulated from the packet and delivered to the
upper layer. Note that although physical addresses will
change from hop to hop, logical addresses remain the
same from the source to destination.

Unicast, Multicast, and Broadcast Logical


Addresses
The logical addresses can be either unicast (one
single recipient), multicast (a group of recipients), or
broadcast (all systems in the network).
Port Addresses
The IP address and the physical address are
necessary for a quantity of data to travel from a source
to the destination host. However, arrival at the
destination host is not the final objective of data
communications on the Internet. Computers are devices
that can run multiple processes at the same time. The
end objective of Internet communication is a process
communicating with another process. For example,
computer A can communicate with computer C by using
TELNET. At the same time, computer A communicates
with computer B by using the File Transfer Protocol
(FTP). For these processes to receive data
simultaneously, we need a method to label the different
processes.
In other words, they need addresses. In the TCP/IP
architecture, the label assigned to a process is called a
port address. A port address in TCP/IP is 16 bits in
length.
A port address is a 16-bit address represented by
one decimal number as shown.

Example (2)
The following Figure shows two computers
communicating via the Internet. The sending computer
is running three processes at this time with port
addresses a, b, and c. The receiving computer is
running two processes at this time with port addresses j
and k. Process a in the sending computer needs to
communicate with process j in the receiving computer.
Note that although both computers are using the same
application, FTP, for example, the port addresses are
different because one is a client program and the other
is a server program.

To show that data from process a need to be


delivered to process j, and not k, the transport layer
encapsulates data from the application layer in a packet
and adds two port addresses (a and j), source and
destination. The packet from the transport layer is then
encapsulated in another packet at the network layer with
logical source and destination addresses (A and P).
Finally, this packet is encapsulated in a frame with the
physical source and destination addresses of the next
hop. We have not shown the physical addresses
because they change from hop to hop inside the cloud
designated as the Internet. Note that although physical
addresses change from hop to hop, logical and port
addresses remain the same from the source to
destination.

 In the TCP/IP protocol suite, the port


numbers are integers between 0 and 65,535.
 The client program defines itself with a port
number, called the ephemeral port number
(chosen randomly). The word ephemeral
means short lived.
 The server process must also define itself
with a port number (called well-known port
numbers). This port number, however, cannot
be chosen randomly.
Switching
Switching technique reduces the requirement of
dedicated lines between computers

Circuit Switching

 Consist of switches connected by physical


links.
 Dedicated path exists.
 Circuit switching takes place in following
phases :
(a) Setup Phase : A physical path is
established between sender and receiver.
(b) Data Transfer Phase
(c) Tear Down Phase
 In this technique information will be transmitted
through a dedicated path. Resources are well
allocated in advance.
Advantage
(1) Delay is minimum
(2) Packets arrive in order
Disadvantage
No efficient utilization of resources.
Application
Telephone Talk : SST is used for setup and
teardown phase.
In circuit switching time for a packet from sender to
receiver
m d
S  (x  1)  T
B V
S = Setup Phase
m
B = (Message/Bandwidth) Transmission delay.
d
V= Propagation delay
T = Teardown phase
Packet Switching
The packet switching is used for data
communication.

No physical path exists.

Datagram Approach (IP) Virtual Circuit Approach


(ATM)
Frame (Relay V.25)
Each packet is independent Each packet is not
and can take different route. indepdent but follow some
virtual path to reach the
destination
Resources are allocated on In this technique, three steps
demand (a) Setup Phase (Virtual
Path)
(b) Data Transfer
(c) Tear Down
This technique works on the Reservation are allocated on
concept of store and forward demand
Each packet contains global There two types of address
address (source IP, (a) Global Address
destination IP) (b) Virtual Circuit Identifier
(VCI)

Advantage
Resource utilization better.
Disadvantage
 Delay on compared to circuit
 Reordering and unreliable (in case of
datagram)
Total time take for sending data :
m d
(x  1)  (n  1)
B V
x = routers
n = wires
m
B = transmission delay.
d
V = propagation delay
Note :
 If setup up time is greater than transmission
delay use virtual circuit approach.
 If setup time is small, circuit switching is better.
Message Switching
Whole message is stored at a switch and then
forward to next.
E.g. Email
Q. Which one of the following statement is False ?
(Gate 2004)
(A) Packet switching leads to better utilization of
bandwidth resource than circuit switching.
(B) Packet switching result in less variation in delay
than circuit switching.
(C) Packet switching requires more per packet
processing than circuit switching.
(D) Packet switching can lead to reordering unlike
in circuit switching.
Sol. (B)

4. FUNCTIONS OF OSI AND TCP/IP LAYERS

Framing
Framing means breaking the bit stream into frames.
fram e fram e

Tim e
ga p

There are four methods of framing —


1) Character count
Network layer : 4634785325896
4 4 6 3 4 3 7 8 5 6 3 2 5 8 9 6

fra m e 1 fra m e 2 fra m e 3

Problem — If count value changes then the sender


and receiver are out of synchronization.
2) Character stuffing
Each frame is preceded by transmission of ASCII
character sequence DLE SXT (data link escape and
start of text) and end by DLE ETX (Data link escape and
end of text)
(a ) N etw o rk laye r M N O

DLL STX D LE M N O DLE ETX

 sta rt of  En d o f
fram e  fram e 

(b ) N etw o rk laye r M DLE N

DLL STX D LE M DLE D LE N DLE ETX

Problem - We have to use 8-bit character and


ASCII code.
3) Bit stuffing
We add flag byte 01111110 and transmit with data.
Original Data : 01001111110111111
D a ta
strea m : 01111110 01 00 1111 010111110 1 01111110

flag stuffed b its

4) Physical layer coding violations


Only applicable to networks in which encoding on the
physical medium contains some redundancy. Some
LANs encode each bit of data into two physical bits.
Manchester coding is used.
Q. In a data link protocol, the frame delimeter flag is
given by 0111. Assuming that bit stuffing is
employed, the transmitter sends the dates
sequence 01110110 as —
(A) 01101011 (B) 011010110
(C) 011101100 (D) 0110101100
Sol. 0111 is flag
So, after every two 1’s insert a zero.
0110101100
 
Correct option is (D).

Q. A bit stuffing based framing protocol uses an 8-bit


delimeter pattern of 01111110. If the output bit
string after stuffing is 01111100101 then input bit
string is —
(A) 0111110100 (B) 0111110101
(C) 0111111101 (D) 0111111111
Sol. Flag is 01111110
Output string 01111100101
So Input string is 0111110101
Option (B) is correct.

Q. Consider bit stream


01111010111111011110111.
Using bit stuffing how many 0’s should be stuffed in
data using a flag pattern of ‘01111’ -
(A) 5 (B) 4
(C) 3 (D) 6
Sol. Flag - 01111
B it S tream - 0111 1010111 111 0111 10111

0 0 0 0 0

So 0’S inserted are 5


Option (A) is correct.

Q. The start and stop bits are used in serial


communication for —
(A) Error Detection (B) Error
Correction
(C) Synchronization (D) Slow down
communication
Sol. Option (C) is correct.

Flow and error control


The most important responsibility of data link layer
are flow and error control. Collectively these functions
are called data link control.
Flow control
Flow control coordinates the amount of data that
can be sent before receiving an acknowledgement.
It is set of procedures that tells the sender how
much data it can sent before it receives
acknowledgement from receiver.
For data transmission, each receiving device has a
block of memory called a buffer, reserved for storing
incoming data until they are processed. If the buffer
beings to fill, receiver must tell sender to halt the
transmission until once again able to receive.
Error control
Error control is both error detection and correction.
It allows receiver to inform the sender of any frames lost
or damaged in transmission and coordinates the
retransmission of those frames by sender.
At data link layer, error control is simple any time
error is detected, specified frames are retransmitted.
This is called automatic repeat request (ARQ).
Protocols

F or n oisele ss F or n oisy
cha nn el cha nn el
S im plest – stop an d w ait A R Q
S to p and w ait – G o B A C K -N A R Q
– S ele ctive R e peat A R Q

Here the protocols discussed are unidirectional.


Data frames travel from source to destination. In real life
data link protocols are bidirectional data flow in both
directions. In this situation, flow and error control
information such as ACKS and NACKS are included in
data frames in a technique called piggybacking.
Flow Control
Sliding window protocol
(1) Stop and wait ARQ
(2) Go-BACK N ARQ
(3) Selective Repeat ARQ
Flow control means that a fast sender should never
send more than what a receiver can receive.
(1) Stop & wait ARQ
 In this strategy a sender will send data and wait
for ACK, before sending next data.
 In this protocol sequence number will always
be modulo-2 i.e. 0, 1, 0, 1 ..
S en de r R e ceive r

d a ta
-1

0
ack -

d a ta
-0

1
ack -

ACK 0 here means that,


(1) The receiver is expecting next frame with
sequence number 0.
(2) It has successfully receive data frame with
sequence number 1.
Limitation of stop & wait - Less resource
utilization.
 Here window size i.e. the maximum
number of frames that can be sent by sender
without waiting for acknowledgement is 1.
For stop & wait sliding window size  1

 Efficiency, ()
total time spent in transmitting

Total cycle time
Tt

Tt  2Tp

1 Tp
 where a 
1  2a Tt

Here Tt is transmission time


Tp is propagation time
Tt
Tp

Tp

Tim ing dia gra m

 Bandwidth Delay  It is a metric which


specifies the maximum number of bits which
are required to fill the entire link.
BW delay / Capacity  BW  Round trip time (  2Tp )

 Throughput  It is the number of packets


sent per unit time
Throughput / link Utilization /
   BW
BW utilization / effective BW

where  is efficiency, BW = Bandwidth

1

Q. If efficiency in stop and wait ARQ then
2

what is the relation between Tt and Tp


1

Sol. 1  2a
1 1

2 1  2a
1 + 2a = 2
1 Tp
a 
2 Tt

Tt = 2 × Tp
Note : If Tt > 2Tp  is greater than ½. If T t is
very less than Tp more time is spent in
travelling thus efficiency is less.

Q. Suppose that stop and wait protocol is used on a


link with a bit rate of 64 kilobits/sec and 20 ms
propagation delay. The minimum frame size to
achieve a link utilization of atleast 50% is ______.
[GATE - 2015]
1

Sol. 1  2a
1 1

2 1  2a
1 + 2a = 2
2a = 1
1
a
2
tp 1

tt 2

tt = 2 t p
M
= 2 tp  M = 2 × 20 × 10–3 × 64 × 103
B

= 2560 bits
M = 320 bytes Ans.
Q. What is the window size for stop and wait protocol
for sender & receiver.
Sol. Sender window size = 1
Receiver window size = 1

Q. If it stop and wait ARQ, a sender sends 10 packets


in which every 4th packet is loss.
What are total number of transmissions.
Sol.
1 2 3 4 4 5 6 7 7 8 9 10 10
× × ×
(lo st) (lost) (lo st)

So, total transmissions = 13

Q. Assume that in stop and wait ARQ system, the BW


of the line is 1Mbps and 1 bit takes 20 ms to make a
round trip. What is BW delay product.
If system data frames are thousand bits in length,
what is utilization percentage of link.
Sol. BW delay product = BW × R.T.T
= 1 × 106 × 20 × 10–3
= 20 × 103
Message size 1000 bit

Also, here tt =
6
B.W 10 bits / sec

tt = 10–3 sec
tp = 10ms
tp
a
tt
10  10 –3
a
10 –3
a = 10
1

1  2a
1

1  20
1

21
1
%   100  5%
21 Ans.

S liding w ind ow protoco l (U sin g pipe lining )

go ba ck N S ele ctive R ep ea t

Motivation for pipelining


Suppose Tt = 1ms, Tp = 9.5 ms then what is the
efficiency of stop & wait protocol
1 1 1m s
 
1  2a t
12 p
tt
1

1  2  9 .5 19 m s  w he re
1 m o re p ackets
1 cou ld h ave b ee n
 (v e ry less ) sen t
20

Here,
Tt  2  Tp

Window size = Tt

window size  1  2a
ws
i.e.
 The minimum number of bits required in
Sequence number for window  log2 ws

 Here, efficiency
ws

1  2a

for stop & wait ws = 1.

Q. Consider the following situation, Tt = 1 ms, Tp =


100 ms in a sliding window protocol.
(a) What is the minimum number of bits required in
the sequence number field.
Tt  2  Tp
Ws 
Sol. Tt

1  2  100
  201 ms
1
No. of bits required = [log2 201]
= 7 bits.
But,
Window size = min (1 + 2a, 2 n) in case (efficiency)
is not 100%
= min (201, 27)
= min (201, 128)
Ws = 128
(b) Calculate the efficiency
Ws

1  2a
128 128
 
1  2 t p 1  2(100)
tt 1
128

201
  0.63
Ans.
Go-Back N : where N is window size (Conservative
protocol)
For Go BACK N
Sender window size (N) = 2n – 1
Receiver window size = 1
n = sequence number bits
N

1  2a

 The sequence number generated is modulo 2n.


 In Go-BACK N. Protocol the frames must
be received in order at the receiver. Once the
error will be detected, the receiver will become
silent and sender retransmits all the frames
which were already sent after previous
acknowledgement.
Example : Suppose window size = 3
In go back N, ws = 2n – 1 = 3
2n = 4
n2
bits in sequence number.
Sequence number generated are in modulo 2n
i.e. modulo 22 = modulo 4
Sequence number generated are 0, 1, 2, 3, 0, 1, 2,
3, 0
WR

0 1 2 3
ws
da ta 0
0 1 2 3 0 1
WR
ack 1
0 1 2 3
0 1 2 3 0 1
d a ta
1
x
d a ta WR
0 1 2 3 0 2
x
0 1 2 3
d a ta
3
x
0 1 2 3 0 R e tran sm its
d a ta
1
Rn
tim e o ut
ack 2 0 1 2 3

0 1 2 3 0 1

Q. In sliding window protocol,


packet size = 32 bytes
propagation delay = 80 ms
Bandwidth = 128 kbps
What is the number of bits required in sequence
number field?
tp
a
Sol. tt

80  10 3
a B
M
80  10 3
a  128  103
32  8
a = 40
Window size = 1 + 2a
= 1 + 2(40)
= 81
No. of bits required = [ log2 81 ]
No. of bits  7 bits
Ans.

Q. In Go back N where N = 3, 10 packets are sent and


every 5th packet is lost. What is total number of
transmission required?
Sol.
1 2 3 4 5 6 7
× × ×
5 6 7 8 9
pa cket lost × × ×
7 8 9 10
× ×
9 10

So, total = 18 transmissions

Q. Consider 0 network connecting two systems located


8000 kms apart. The bandwidth of the network is
500 × 106 bps. The propagation speed is 4 × 106
m/sec. Go BACK - N is used. The avg packet size is
107 bits. The minimum size in bits of sequence
number field is ________ if the n/w is fully utilized.
[GATE 2015]
Sol. d = 8000 km = 8000 × 103 , v = 4 × 106
B.W = 500 × 106 ,  = 100%
d 8000  103
tp    2 sec
v 4  106
M 107 1
tt   6
 sec .
B 500  10 50
Ws = 1 + 2a
tp
 1 2
tt

N = 1 + 2 × 2 × 50
N = 201
No. of bits required = [ log2 ws ]
= [ log2 201 ]
m = 8 bits
* as, full 201 packets can be sent with n = 7 bits
only 128 packets can be sent.

Q. A 1 Mbps satellite link connects two ground


stations. The altitude of the satellite is 36504 km &
speed of signal is 3 × 108 m/s. What should be
packet size for a channel utilization of 25% for a
satellite using go back 127. [GATE -
2008]
(A) 120 bytes (B) 60 bytes
(C) 240 bytes (D) 90 bytes
Sol. Ws = N = 127
N

1  2a
tp
a
tt
36504  103
tp 
3  108
x bytes x  8
tt  
1 106 106
36504  103 10 6
a 
3  108 x8
15210
a
x
127 127
 0.25 
1 2a  1 2a 
127
1  2a 
 0.25

 1 + 2a = 508
507
 a= 2
15210 507

 x 2
15210  2
x
 507
x  60 bytes
Ans.

Q. A 20 kbps satellite link has propagation delay of 400


ms. The transmitter employs ‘go back - N’ ARQ with
N = 10. Assuming each frame is 100 bytes long,
What is maximum data rate possible?
(A) 5 kbps (B) 10 kbps
[GATE - 2004]
(C) 15 kbps (D) 20 kbps
M 100  8
Tt    40ms
Sol. B 20  103

Tp = 400 ms.
Tp 400
a   10
Tt 40
ws 10 10
  
1  2a 1  20 21

Data Rate =  × BW
10
  20 kbps
21

Data Rate  10 kbps Correct option is (b).


In go back - N
ACK are of type 
(1) Cumulative - Go back N maintains a timer
called acknowledgement timer which starts
when any packet is received, when
acknowledgement timer expires a single
acknowledgement will be sent for all packets
within this time.
(2) Positive acknowledgement - Go back N
receiver only uses positive acknowledgement
i.e. if a packet gets corrupted, go back N will
silently discard, all subsequent packets will also
be discarded.
Selective Repeat ARQ
 In selective repeat ARQ,
Sender window size WS = 2n–1
Receiver window size WR = 2n–1
 Here receiver window size is > 1 equal to
sender window size which implies that receiver
can receive packets out of order and later can
rearrange it.
 In selective ARQ, acknowledgement are —
a) Independent - Acknowledgement timer is
zero
b) Negative Acknowledgement (NACK) -
Receiver can send negative acknowledgement
NACK = 4 means packet 4 is either
corrupted/lost and packets 1, 2, 3 are received
correctly.
 In selective repeat, the sequence number
is modulo 2n
Example : Let
0 1 2 3 0 1 2 3
d a ta
0
WS WR
d a ta
1

d a ta
2

d a ta
3
erro r
K3
NAC

d a ta
3

Q. If 10 packets are sent using selective repeat and


every 4th packet is lost. What are the number of
transmissions required?
Sol.
4 7 10
1 2 3 4 5 6 7 8 9 10
× × ×
Total transmissions = 13

Q. Consider the following data,


Bandwidth = 10 Mbps
Frame size = 100 bits
Round trip time = 1000 s
No. of sequence bits in go back - N and selective
repeat ARQ.
tp
a
Sol. tt

10000  106
  10  106
100
a = 100
Window size = 1 + 2a = 1 + 2(100)
= 201
No. of bits required =  log2 201 
No. of bits required = 8 bits
WS WR
In go - back N 28  1 1

WS = 255 WR = 1
In Selective Repeat 28–1 28–1
WS = 127 WR = 127

Q. The maximum window size for data transmission


using selective reject with n-bit frame sequence
number is —
(A) 2n (B) 2n–1
(C) 2n – 1 (D) 2n–2
Sol. Correct option is (B).

Comparison of Go Back N & Selective Repeat


(1) In go back N
WS = 2n – 1 WR = 1
In selective Repeat
WS = 2n–1 WR = 2n–1
(2) Retransmissions are more in case of go back N
thus more bandwidth requirement.
(3) Sorting and searching logic is required in selective
repeat so, more CPU time is required in case of
selective Repeat.
HDLC
 It is a bit oriented protocol which is used for
communication, both point to point and
multipoint.
It works in two mode :
(i) NRM (Normal Response Mode)
(ii) ABM (Asynchronous Balance Mode)
 In NRM mode, HDLC support both point to
point and multipoint.
In ABM mode, it supports only point to point.
 In NRM mode, one machine works as primary
whereas other machine works as secondary
machine. (only respond)
In ABM mode, any machine can work as
primary as well as secondary.
 In HDLC, we have three frames to transfer
information

U -fra m e I-fram e S -fram e


U n -nu m b erd fra m e Inform atio n fram e S up erviso ry fram e

The information frame are used to transport user


data and control information related to the user data.
The supervisory frame are used only to transport
control information e.g. related to flow control, error
control etc.
Unnumbered frame are used to exchange the
control information related to the session management
between the connected devices.
Frame Format
Flag Address Control User Information FCS Flag I  frame

Flag Address Control FCS Flag S  frame

Flag Address Control Management inf ormation FCS Flag U  frame

1. Flag Field : both identifies beginning and end


of frame 01111110
2. Address Field : address of secondary station.
3. Control Field : (1 or 2 byte field) used for flow
and error control.
4. Information field : Contain's user data.
5. FCS Field : It is HDLC error detection field.
The Control Field : It define the type of frame and
define its functionality.
0 P /F I-F ra m e
N (S ) N (R )

0 means the frame is I-frame


N(S) – sequence number of the frame
N(R) – acknowledgement number if piggybacking is
used.
P/F (Poll/Final)
P/F = 1, Poll means frame sent from primary to
secondary final means secondary to a primary station
frame is sent.
1 0 P /F S -F ra m e
C o de N (R )

 1 0 means s-frame
2. Code (2-bit)
00 – Receiver Ready (RR)
acknowledge the receipt of a safe and sound
frame
10 – Receiver not Ready (RNR)
It acknowledge the receipt of a frame and it
announces that the receiver is busy and cannot
receive more frames.
01 – Reject (REJ)
It is NAK used in GO-BACKN
11 – Selective Reject (SREJ)
It is NAK used in selective repeat.
1 1 P /F U -Fram e
C ode C o de
It does not contain user data, but management info.
Some common type of command are –
Code
00 001 SNRM – Set normal response mode
00 110 UA – Unnumbered acknowledgement
00 010 RD – Disconnect
11 001 Reset
10 001 FRMR – Frame reject
Carrier Sense Multiple Access (CSMA)
To minimum collision CSMA was developed. The
chance of collision reduces if station senses the medium
before trying to use it.
CSMA requires that each station should first listen
to the medium before sending. i.e. sense before sending
or listen before talk.
CSMA can reduce collision but cannot eliminate it.
The possibility of collision exists due to propagation
delay.
So, vulnerable time CSMA is propagation time : TP

Persistence Methods
What if the channel is busy ?
(1) 1-Persistent : In this, after the station finds the
line if sends frame immediately with a probability 1. This
method has highest chance of collision.
(2) Non-Persistent : In this a station that has frame
to send senses the line. If line is idle sends immediately.
If line is not idle waits for random time and senses line
again.
 Collision will be there if the station waits for
some random time.
 This method reduces the efficiency of network
because medium remains idle when there are
many station to send.
(3) P-Persistent : This method is used when the
channel has time slots with slot duration equal to or
greater than maximum propagation time.
 This method reduces the chance of collision as
well as improves efficiency.
 In this method, after the station finds the station
idle does the following :
1. With probability P sends its frame
2. With probability q = 1 – p station waits for
beginning of next time slot and checks line
again :
(a) If the line is idle go to step 1.
(b) If line is busy, it acts as though
collision has occurred and uses back
off procedure.
(a) 1-Persistent

(b) Non Persistent


(c) P-Persistent

Carrier Sense Multiple Access with Collision


Detection (CSMA/CD)
 CSMA/CD helps the CSMA algorithm to handle
collision.
 In this method, a station monitors the medium
after it sends a frame to see transmission was
successful. If so, station is finished. If however,
there is a collision, the frame is sent again.
Minimum Frame Size
For CSMA/CD to work, we need a restriction on the
frame size. Before sending last bit of frame, the sending
station must detect collision, if any abort transmission.
 This is so because once the entire frame is
sent station does not keep copy of it.
Therefore, transmission time must be atleast twice
of max. propagation time TP.
Tt  2 T P
m d
2
B V
d
m2 B
V
Q. A network using CSMA/CD has a bandwidth of 10
Mbps. If the maximum propagation time is 25.6 s.
What is minimum size of frame ?
m
 2 TP
Sol. B

m  2 × 25.6 × 10–6 × 10 × 106


m  512 bits
or message size = 64 Bytes
Efficiency Calculation

Let T.P. = Transmission Period


C.P. = Contention Period
I.P. = Idle Period
Transmission Period (T.P.)

T.P.  Contention Period (C.P.)  Idle Period (I.P.)
T.P.

T.P.  C.P. (Idle Period = 0)
Let N : Total number of systems in network.
P : Probability of a station to send data
1 – P : Probability of a station not to send data
Then, P(1 – P)N–1 is the probability of success
for a single station.
Then Probability of success for an arbitrary station
among n stations.
(A) = nP(1 – P)n–1
1
The number of contention slots = A

if N
1
A
 e

Thus, No. of contention slots


1 1
  e
A 1/ e
Contention Period (CP)
= No. of contention slots × slot duration
CP = e × 2 TP
T.P.

So, T.P.  C.P.
L
 B
L d
 2  e
B V
1

2dBe
1
LV
That is, if load increase, efficiency decreases.
If packet size increase, efficiency also increases.
T.P.

T.P.  C.P.  t prop
Tt

Tt  2TP  e  TP
1

tp tp
1 2 e 
Tt Tt
1

1  2ae  a
1

1  6.44 a

i.e. every station must wait for one fraction of time


after collision, aborting bits from collision point.
Carrier Sense Multiple Access with Collision
Avoidance (CSMA/CA)
Collision detection using energy level is possible in
case of wired medium. However in case of wireless
medium much of the sent energy is lost in transmission.
Thus, energy level cannot be used for collision
detection.
So, we need to avoid collision on wireless networks
because they cannot be detected.
CSMA avoids collision using three strategies :
Interframe space, the contention window and
acknowledgements.

Interframe Space (IFS)


First collisions are avoided by deferring
transmission even if it finds channel idle by waiting for
short interframe space.
IFS is used for priority. E.g. A station that is
assigned a shorter IFS has higher priority.
If after IFS time channel is idle, the station can send
but still needs to wait for time equal to contention
window.
Contention Window
It is amount of time divided into slots. A station that
is ready to send chooses a random number of slots as
its wait time.
Acknowledgement
With all these precautions, there still may be
collision. The positive acknowledgement and time out
timer can help guarantee that the receiver has received
the frame.

Q. Consider a CSMA/CD network that transmits data


at rate of 100 Mbps over a 1 km cable with no
repeaters. If minimum frame size required for this
network is 1250 bytes. What is signal speed
(Km/sec) is the cable ? (Gate 2015)
(A) 8000 (B) 10000
(C) 16000 (D) 20000
Sol. (D) Tt  2 × TP
m d
2
B V
1250 2  1 103

100  106 V
2  10  10  106
3
V
1250  8

V  20000

Controlled Access
In controlled access the stations consult one
another to find which station has the right to send. A
station cannot send unless. It has been authorized by
other stations. Methods :
(a) Reservation : A station makes a reservation
before sending data. Time is divided into intervals. In
each interval, a reservation frame proceeds the data
frame sent in the interval.
If there are N stations, there are exactly N
reservation minislots in the reservation frame. Each
minislot belongs to a station. When a station needs to
send a data frame, it makes a reservation in its own
minislot.
Example
(b) Polling : Polling works with topologies in which
one device is designated as a primary station and other
as secondary stations. Primary device control the link.
If primary wants to receive data, it asks
secondaries. If they have anything to send this is called
poll function. If the primary wants to send data, it tells
the secondary to get ready to receive. This is called
select function.

(c) Token-Passing : The stations are organised in


a logical ring. Thus each stations has a predecessor and
successor. The predecessor is the station which is
logically before the station in ring and successor is the
station after in the ring.
A special packet called a token circulates through
the ring. The possession of token gives the station the
right to access the channel and send its data. When a
station has data to send, it waits unit it receives token
from its predecessor. It then holds the token and sends
the data. When the station has no more data to send, it
just releases the token, passing to next logical station.
Fig. : Token in a Ring Network
Channelization
Channelization is a multiple access method in which
the available bandwidth of a link is shared in time,
frequency or through code between different stations.
Three channelization protocols :
(a) FDMA
(b) TDMA
(c) CDMA
(a) Frequency Division Multiple Access (FDMA) :
In FDMA, the available bandwidth is divided into
frequency bands. Each station is allocated a band to
send its data. In other words, each band is reserved for
a specific station all the time.
Each station also uses a band pass filter to confine
the transmitter frequencies. To prevent interference the
allocated bands are separated by guard bands. FDMA
Used in telephone system.
(b) Time Division Multiple Access (TDMA) : The
station share the bandwidth of the channel in time. Each
station is allocated a time slot during which it can send
data. Each station transmits its data in its assigned time
slot.

The main problem with TDMA lies in achieving


synchronization between different station. Each station
needs to know the beginning of its time slot and location
of time slot. This may be difficult to achieve because
propagation delays introduced in the system if stations
are spread over large area.
In TDMA the bandwidth is just one channel that is
time shared between different stations.
(c) Code Division Multiple Access (CDMA) :
CDMA differs from FDMA because only one channel
occupies the entire bandwidth of the link. It differs from
TDMA because all stations can send data
simultaneously. There is no time sharing.
In CDMA one channel carries all transmission
simultaneously.
Idea
We have four stations 1, 2, 3 and 4 connected to
same channel. The data from station 1 are d1, station 2
are d2 and so on. The code assigned to first station C 1
to second is C2 and so on.
Assigned codes have two properties :
1. If we multiply each code by another we get 0.
2. If we multiply each code by itself, we get 4. (the
number of stations)
Sending of Data
Station 1 multiplies its data by its code to get d 1c1',
station 2 multiplies its data by its code to get d 2c2' and
so on. The data that go on the channel are sum of these
terms.
Now suppose station 1 and 2 are talking to each
other. Station 2 wants to hear what station 1 is saying. It
multiplies the data on the channel by c1' the code of
station 1.
(Remember c1.c1 = 4 but (c2.c1), (c3.c1) and
(c4.c1) are all 0's, station 2 then divides result by 4.)
data = (d1.c1 + d2.c2 + d3.c3 + d4.c4)c1
= d1.c1.c1 + d2.c2.c1 + d3.c3.c1 + d4.c4.c1
data = 4 × d1
Network Devices
A pp licatio n &
Tran sp ort la yer G atew a y

N e tw o rk La yer R o uter o r thre e la yer sw itch

D ata Lin k B rid ge o r tw o laye r

P hysical L aye r R e pe ater


or h ub
P assive h ub  Just a sim p le
con ne ction

1. Repeater
1. Repeater can extend physical length of LAN
like 10 Base 5 is limited to 500 m
R e pe ater

It connect to 0 segments of LAN (not LAN


itself) but they should be of same type
X N ot p ossib le
E thernet Token R ing

2. It is regenerating device not an amplifier.


3. It is a passive device, forwards everything with
no filtering capacity.
4. No software is required as at physical layer
5. Collisions are possible inside the repeater
A B
So, collision domain = N (unaffected)
2. HUB – Multiport Repeater
A
A C  C

B D
A sen ds to C bu t a ll rece ives it

(a) Pure electronic device, no software attached to


it.
(b) No filtering, forward to all
(c) Collision occur insider hub as not store &
forward device. Collision domain N.
3. Bridge (at physical & data link layer)
B rid ge
E th erne t Toke n R in g

(a) Can connect two different types of LAN.


(b) Operates at
ph ysical layer & D a ta link la yer

R e ge ne rate sig na l C h eck M A C a dd ress


(filtering cap ab ility)

(c) Collision domain is reduced as store and


forward device.
B rid ge
C o llisio n he re o nly

(d) Broadcast domain does not change (as not on


network layer)
Transparent Bridge
It is a bridge in which stations are completely
unaware of Bridges extension.
Here the table made by bridge is dynamic a bridge
gradually learns from frame movements. For this, bridge
use destination address & source address
destination address – forwarding decision
source address – adding entries to label & for
updating
A B

E A dd P ort A dd P ort A dd P ort


A 1 A 1 A 1
B rid ge
E 3 E 3
B 1
F
(a ) A sen ds (b) E sen ds (c) B se nd s
da ta to D da ta to A to C

C D

But here loops should be prevented


A B
A dd P ort a b B2

A a A dd P ort
d B1 B2
a A b
d d c

be cau se o f lo op

So, to avoid loops use spanning tree algorithm


Spanning Tree Algorithm
1. Every bridge has built-in Id, Bridge with
smallest Id is root bridge.
2. Make one port of each bridge closest to root
bridge on root port.
3. Every LAN choose a bridge closest to it as a
designated bridge for that LAN make the
corresponding port as designated part.
4. Make the root port and designated port is
forwarding port and block remaining.
LA N 1
1 1

B1 B2
1 2
B3
2 2
LA N 2 LA N 3
1 1
3
B4 B5

2 2

LA N 4
Note : In routers to avoid loops we use field called
TTL, In DDL-spanning tree bridge
 B1 is root bridge
 Root port
for B2  1
B3  1
B4  1
B5  2 (for it both 1, 2 are at same
distance)
 Designated Bridge
LAN 1  B1
LAN 2  B1
LAN 3  B2 or B3 (take small Id) So, B2
LAN 4  B3
 Designated Port
B1  1 

B1  2 

B3  3 
B2  2 

So
S pa nn ing tre e is 
1
B1 B2 M a rked w ith
2 B3 ( )
1
B4 3 B5
N o loop s

Switch (2.layer)
Instead of connecting LAN to host connect host
directly
O
O O

S w itch O
O O
O

 No collision within a switch as store and


forward
 Can't stop broadcasting as not on network
layer
 Traffic very less as compared to hub but
costlier
 New type of switch called cut through switch
forward frame as soon as check MAC address
of header.
Routers
 Route packets based on logical address
 Store and forward no collision
 Broadcast domain is reduced by router
 Responsibilities
Forwarding
Filtering
Routing
It Route packets of similar network (Internet)
O ne N e tw ork R o uter O ne N e tw ork
X .2 5 X .2 5
AT M X X .2 5
no t p ossib le

Gateway
 It operates at all the 5 layers
 Connect devices between two inter networks
 It can provide the following features
(a) Protocol conversion
(b) Proxy
(c) NAT / Network address translation
(d) Firewall
(e) DPI – Deep Packet Inspection
(f) Buffer Management
(g) Slow down high speed servers
Broadcast Domain & Collision Domain of all Devices
Broadc a s t Domain Collision Domain
Re peater Same Same
Hub Same Same
Bridge Same Re duces
Switch Same Re duces
Router Re duces Re duces
Gateway Re duces Re duces

Q. Assume that source S and destination D are


connected through two intermediate routers R.
Determine how many time each packet has to visit
the network layer and data link layer during
transmission from S to D.
S R R D

(A) Network layer – 4 times, Data Link Layer – 4


times
(B) Network layer – 4 times, Data Link Layer – 3
times
(C) Network layer – 4 times, Data Link Layer – 6
times
(D) Network layer – 4 times, Data Link Layer – 6
times
Sol. (C)
(S ) (S )
AL AL
TL (R ) (R ) PL
N etw o rk N etw o rk
NL NL
DL DL DL DL
DL DL
PL PL PL PL PL PL

So, network layer is visited 4 times, data link layer is


visited 6 times.
Option is (C)

IP (Network Layer)
Application Layer Sends data of any
size
(Data is fragmented into
65495 B each)
Transport Layer (TCP)

Network Layer

Data Link Layer

IP (Internet Protocol)
For delivery of packets (host to host delivery) at the
network layer and for routing packets.
IPv4 (Inter Protocol version 4) delivery protocol used
by TCP/IP.
IPv4 is unreliable and connection less datagram
protocol best effort delivery.
If reliability is important, IPv4 is paired with TCP.

Version : It tells whether IPv4 or IPv6.


Header : Indicates header length.
Min value = 5
So, 5 × 4 = 20 B
Max value = 15
So, 15 × 4 = 60 B
Total Length : 16 bit field indicating total size of
IP header + IP data max = 216 – 1 = 65535
Types of Service

D = Minimize Delay
T = Max Throughput
R = Max Reliability
C = Min Cost
Eg. : Default service
SMTP 0100 Max Throughput
TLENET 1000 Min delay
Bits Used in Fragmentation
(1) Identification
When datagram is sent it is given a value. When
that datagram is fragmented, then that value is copied to
all its fragment.

(2) Flags

D(Do not fragment)


D = 1 m/c must not fragment data
D = 0 fragmentation is necessary
M(More fragment)
M = 1 (data is not last fragment)
M = 0 (last fragment)
(3) Fragment Offset
Position of fragment with respect to whole
datagram.
Eg. : Offset = 175
So 175 × 8 = 1400 (start)
Checksum : It is used to detect error within header
of IP only.
Protocol : Higher level protocol which supports this
IP datagram TCP, UDP, SCTP, ICMP, IGMP.
Options
(1) Record Route (Debug and Management
Purpose) : Record router address that handles
datagram. Upto 9 addresses can be recorded.
(2) Strict Source Route : Use by source to
predetermine a route for datagram as it travels through
the network.
(3) Loose Source Route : It is less strict as in this,
each router must be visited, but can visit other routers
as well.
(4) Timestamp : Time of datagram processing by a
router.

Ex.1
IPv6 (128 bits)

PRI (Priority)

Extension Headers
(1) Hop by Hop Option : Source needs to pass
information to all routers visited by IP datagram.
(2) Fragmentation : Same as IPv4, but in IPv6 only
source can fragment the data.
(3) Authentication
(4) Encryption Security Payload (ESP)
(5) Destination Option : Source need to pass
information to destination only.
Transport Layer (UDP/TCP)
UDP (User Datagram Protocol)
UDP is called connectionless unreliable transport
protocol. It does not add anything to services of IP
except to provide process to process communication.

TCP (Transmission Control Protocol)


The second transport layer protocol is TCP
Features :
(1) Process to Process Communication : Like
UDP, TCP, is process to process communication.
(2) Stream Delivery Services : TCP, Unlike UDP is
a stream oriented protocol. In UDP, application sends
data, UDP adds header.
TCP allows the sending process to deliver data and
stream of bytes by creating an imaginary tube.
(3) Full Duplex Communication
(4) Connection Oriented Service
(5) Reliable Service : TCP uses acknowledgment.
(6) Flow Control
(7) Error Control
(8) Congestion Control
Segment
A packet in TCP is called a segment

Sequence Number (32 bit) number assigned to


first byte of data in this segment.
Acknowledgment Number (32 bit) : If receiver has
received X byte number, then ack is X + 1.
Acknowledgment and data can be piggy backed
together.
Header Length
5 × 4 = 20 B
15 × 4 = 60 B
Control

URG : Urgent pointer field is valid.


ACK : Value of ack field is valid.
PSH : Push the data (PSH = 0 Info will not be
buffered)
RST : Reset the connection (RST = 1 connection
needs to be re-established)
SYN : Synchronize sequence numbers during
connection
(SYN = 1 connection
establishment request)
FIN : Terminate connection (FIN = 1)
Window Size : Size of window (in B) that party
must maintain.
Max window size = 216 – 1 = 65535 B.
At time of connection establishment, window size is
advertized as MSS.
Urgent Pointer : This 16 bit field which is valid if
urgent pointer set to 1. This is used when segment
contains urgent data.

IP Addressing
An IP address is a numerical label assigned to each
device connected to a computer network that uses
internet protocol of communication.
IPv4 defines an IP address as a 32-bit number.
There are two notations in which IP address is
written :
 Dotted decimal notation
 Hexadecimal notation
Dotted Decimal Notation
Hexadecimal Notation

Having an IP address allows a device to


communicate with other device over an IP based
address network like Internet.
IP address are broken into classes. Classes where
used when IP addresses were first inverted. Depending
upon how large your organisation was, depended upon
which class of IP address you were given.
IPv4 address is divided into two parts :
(a) Network ID
(b) Host ID
Each ISP or network administrator assigns IP
address to each device that is connected to its network.
IP address globally is managed by Internet
Assigned Numbers Authority (IANA).
First IP address of any network is the network
number and last IP address is reserved for broadcast IP.
Therefore total number of host IP address count is
always decreased by 2.
IP Addressing
(i) Classful Addressing
IPv4 uses 32 bit address
address space = 232 = 4294 967 296 (4 billion)
So if no restriction 4 billion devices can be
connected to internet.
Class A

NID = 27No. of Host = 224 – 2


 For large international company.
Class B

NID = 214 No. of Host = 216 – 2


 For medium size networks like university campus.
Class C

NID = 221 No. of Host = 28 – 2


 Small business.
Class D : Used for multi casting

Class E : Reserved (Experimental Purpose)

Network Mask : Used to calculate Net Id.


Default Mask for
A = 255 . 0 . 0 . 0
B = 255 . 255 . 0 . 0
C = 255 . 255 . 255 . 0
To Find the Network Address : Perform masking
between IP address and default mask.
To Find Broadcast Address for Each IP : Make
the host Id bits equal to 1's.
Maximum Number of Networks Possible
Maximum Number of Host/Computer that can be
Connected
Class A = 224 – 2
Class B = 216 – 2
Class C = 28 – 2

Q. Identify the class for the given IP address


(1) 10 . 2 . 0 . 0
Class A
(2) 179 . 0 . 0 . 2
Class B
(3) 193 . 168 . 2 . 255
Class C

Q. Find the network address for the following IP


address :
(A) 10 . 2 . 0 . 0 (B) 131 . 229 . 0 . 1
(C) 141 . 39 . 244 . 0 (D) 196 . 23 . 244 .
25
Sol. (A) Belong to Class A
10 . 2 . 0 . 0
255 . 0 . 0 . 0
10 . 0 . 0 . 0

(B) Belong to Class B


131 . 229 . 0 . 1
255 . 255 . 0 . 0
131 . 229 . 0 . 0
(C) 141 . 39 . 244 . 0
Belong to Class B
141 .39 . 244 . 0
255 . 255 . 0 . 0
141 . 39 . 0 . 0

(D) 196 . 23 . 244 . 25


Belongs to Class C
196 .23 . 244 . 25
255 . 255 . 255 . 0
196 . 23 . 244 . 0

Q. Find the broadcast address of :


(A) 10 . 2 . 0 . 0
(B) 196 . 23 . 244 . 25
Sol. (A) 10 . 0 . 0 . 0 is network id.
So, Broadcast = 10 . 255 . 255 . 255
(B) 196 . 23 . 244 . 25
Network = 196 . 23 . 244 . 0
Broadcast = 196 . 23 . 244 . 255

Special Address
(1) Directed Broadcast to the Network : Received
by all host connected to the network.
[<net id> <all 1's>]
Eg. : 193 . 168 . 2 . 255,
129 . 22. 255 . 255
(2) Limited Broadcast : (Called limited because
routers are not allowed to forward then) Just used host
startup.
[<all 1's> <all 1's>]
i.e. Eg. : 255 . 255 . 255 . 255
(3) This Network, This Host : Used by a host at
bootstrap time when it does not know IP address.
[<all 0's> <all 0's>]
(4) A Host on this Network :
[<all 0's> <host id>]
(5) Loopback Address : It is used to test the
communication or medium.
[127 . <any>]

Ex. Match the following :


List-I List-II
(1) 200 . 10 . 192 . 100 (a) Class A
(2) 7 . 10 . 230 . 1 (b) Limited
Broadcast
(3) 128 . 1 . 1 . 254 (c) Directed
Broadcast
(4) 255 . 255 . 255 . 255 (d) Class C
(5) 100 . 255 . 255 . 255 (e) Class B
Sol. (1) – Class C
(2) – Class A
(3) – Class B
(4) – Limited Broadcast
(5) – Direct Broadcast
First and Last Host of a Network
Consider an IP 24 . 31 . 13 . 16
Network 24 . 31 . 13 . 16 (Class A)
255 . 0 . 0 . 0
24 . 0 . 0 . 0

First host 24 . 0 . 0 . 1
Last host 24 . 255 . 255 . 254
[24 . 0 . 0 . 0 and 24 . 255 . 255 .
255 are reserved]
Sub Netting
In this a network is divided into smaller subnetworks
having its own subnetwork address.
It increases the number of 1's in the network id that
is borrowed from the host ids.
AIM of Subnetting
Is to minimize wastage of IP addresses.
Subnet Mask
The number of 1's in a default mask is
predetermined. In a subnet mask the number of 1's is
more than the corresponding default mask.

Number of Subnetworks
It can be found by counting the number of 1's that
are extra. Eg : in above 3, 1's are extra.
So, no. of subnetwork = 23 = 8
Super Netting
Class A and B are almost depleted Class C address
are still available. However size of Class C is 256
addresses that are too less to satisfy needs of an
organisation.
Solution is Supernetting & Organisation can
combine several C block to create a larger range of
addresses.
If decreases the number of 1's in the default mask.
Q. If the subnet mask of class B is 255 . 255 . 240 . 0.
Calculate no. of subnets and no. of host in each
subnets.
Sol. Default = 255 . 255 . 0 . 0
11111111 . 11111111 . 00000000 . 00000000
11111111 . 11111111 . 11110000 . 00000000
No. of subnets = 24 – 2 = 14
No. of hosts = 212 – 2 = 4094

Q. Consider IP address 197 . 111 . 121 . 199


Subnet Mask 255 . 255 . 255 . 240
(i) Calculate Subnetwork Address
(ii) 1st Subnetwork Address
(iii) Last Subnetwork Address
(iv) Last Host of Last Subnetwork
Sol. (a)
IP  197 . 111 . 121 . 11000 111 (199)
Subnet Mask  255 . 255 . 255 . 1111 0000
197 . 111 . 121 . 192

(b) 1st subnetwork


0001
197.111.121.  0000
= 197.111.121.16
2nd subnetwork
197.111.121.0010. 0000
= 197.111.121.32
(c) Last sub network
1110 
197.111.121.  0000
= 197.111.121.224
(d) Last host of last subnetwork
1110  1110 
197.111.121.  
= 197.111.121.238
 If two IP’s belong to same network they will
have same network Id
 It two IP’s belong to same subnetwork they will
have same subnetwork Id.

CIDR  Classless interdomain Routing


– No classes, no blocks
– Ist address of a block should be divisible by
number of addresses in a block
– Every address in a block must be power of 2
– address must be contiguous.

Q. Let an IP address be 167. 199. 170. 82/27.


Find number of addresses 1st address & last
address.
111
Sol. Mask 11111111. 1111111.  00000
No. of address = 232 – 27 = 25
1st address
16 7. 19 9. 1 70. 010 10 01 0
all 0's
0000 0

So, 167. 199. 170. 64


Last address
11110
167. 199. 170. 010  

So, 167. 199. 170. 95

Routing
It is the process of creating routing tables for the
purpose of forwarding.
Routing

S ta tic R o utin g D yn am ic R o uting

N o chan ge in the W h en eve r th ere is a cha ng e


ro utin g tab le. in n etw o rk such a s b re akdo w n
of lin k a uto m atica lly up da te s
H o od ing the rou ting ta ble .
D ijkstra A lgo rithm

Intra d om ain R ou tin g Inter d om ain R ou ting


W ith in o ne a uton om ou s B etw ee n tw o
syste m au ton om o us syste m

P ath Ve cto r
D istan ce Ve cto r Link sta te R o uting
R o uting (D V R ) R o uting
BGP
R IP OSPF (B orde r G ate w a y
(R o utin g Inform atio n (O pe n S ou rce P roto co l)
P roto co l) S ho rtest P ath
F irst)

Flooding  In flooding algorithm, each router


broadcast the received packet to all the connecting
nodes, except the node from where the packet has
come.
 The objective of this algorithm is to spread some
information earliest over the network.
(2) Distance Vector Routing (DVR) / Bellman ford
In DVR, each router updates its routing table
periodically.
– Each router maintains two fields information within
their routing table.
Next hop field Length

Next hop field indicates the next router through


which the packet will pass.
Length - indicates delay of a packet from the router
to the next router.
Consider a network,
D 11 C

7
1 3

A 2 B

Steps 1 :
Each router makes its own routing table initially.
A Dert Next hop B C
A 0 A A 2 A A 
B 2 B B 0 B B 3 B
C  C 3 C C 0 C
D 1 D D 7 D D 11 D
D
A 1 A
B 7 B
C 11 C
D 0 D

Steps 2 :
Each Router will share routing table with its
neighbours only & update according to them.
At C :
C ' s table D ' s table B ' s table
A  A 1 A 2
B 3 B 7 B 0
C 0 C 11 C 3
D 11 D 0 D 7
11 3
(C reach D by 11) (C reach B by 3)

So,
via via via
C C D B
A  12 5  minimum of these
B 3 18 3
C 0 22 6
D 11 11 10

C new table
A 5 B
B 3 B
C 0 C
D 10 B

Problem
DVR suffers from count infinity problem (Bad news
travel late)
2 4
X A B

X 2 – X 6 A

4
X A B

X  – X 6 A

4
X A B

X 10 B X 6 A

 
 

Solutions
(1) Define infinity  Define infinity as large value
such as 16.
(2) Split horizon  Only sends part of table. If B
knows optimum route to X via A, does not
advertise to A.
(3) Split horizon with poison reverse 
advertise the value with “do not use this value”
RIP  Routing information protocol is an intra
domain routing protocol. It is based on DVR with
Following considerations —
(a) Infinity is defined as 16.
(b) Metric used to measure distance is hop count.

Q. Count to infinity problem is associated with —


(A) Link state routing (B) Distance vector
routing
(C) DNS while resolving host name (D) TCP for
congestion control
Sol. Correct option is (B).

Q. For the Network below —


A B

C D

E G
F

Suppose that F delay to its neighbours A, E, D & G


are 8, 10, 12, 6. The routing table of A, E, D, G are
shown
Routing table of A Routing table of E Routing table of D Routing table of G
A 0 A 24 A 20 A 21
B 40 B 27 B 8 B 24
C 14 C 7 C 30 C 22
D 17 D 20 D 0 D 19
E 21 E 0 E 14 E 22
F 9 F 11 F 7 F 10
G 24 G 22 G 22 G 0

F if updates its rating table according to DVR


What is table of F : —
(a) A 8 (b) A 21 (c) A 8 (d) A 8
B 20 B 8 B 20 B 8
C 17 C 7 C 17 C 7
D 12 D 19 D 12 D 12
E 10 E 14 E 10 E 10
F 0 F 0 F 16 F 0
G 6 G 22 G 6 G 6

Sol.
A B C D E F G

F via A 8 48 22 25 29 0 32
F via D 32 20 42 12 26 0 34

F via E 34 37 17 30 10 0 32


F via G 27 30 28 25 28 0 6

 - Minimum among them.

Q. Linked Questions
Consider a network
7
R2 R4 8
6

R1 2 1 R6
4
9
3 R3 R5
R1 - R6

(1) All routers use distance vector based


routing algorithm to update routing table. After
all the routing tables stabilize, how many links
in the network will never be used?
(A) 4 (B) 3
(C) 2 (D) 1
(2) Suppose all unused links in the question
are charged to 2 weights & DVR is used again.
How many links will now remain unused.
Sol. (1) Routing table are
R1 R2 R3
R2 5 R3 R1 5 R3 R1 3 R1
R3 3 R3 R3 2 R3 R2 2 R2
R4 12 R3 R4 7 R4 R4 9 R4
R5 12 R3 R5 8 R4 R5 9 R5
R6 16 R3 R6 12 R4 R6 13 R5
R4 R5 R6
R1 12 R2 R1 12 R3 R1 16 R5
R2 7 R2 R2 8 R4 R2 12 R5
R3 9 R2 R3 9 R3 R3 13 R5
R5 1 R5 R4 1 R4 R4 5 R5
R6 5 R5 R6 4 R6 R5 4 R5
6 8
R1 R2 R4 R6
So, link s and
Will never be used
Correct option is (C).
(2) In this,
7
R2 R4 8 2
6
2

R1 2 1 R6
3 4
9
R3 R5

Now applying same method link R5 - R6 will


not be used.

Q. Consider the network


3 1
N5 N2 N1

4 6

2
N4 N3

After applying DVR, the stablised links are —


N1 : (0, 1, 7, 8, 4)
N2 : (1, 0, 6, 7, 3)
N3 : (7, 6, 0, 2, 6)
N4 : (8, 7, 2, 0, 4)
N5 : (4, 3, 6, 4, 0)
(1) The cost of link N2 - N3 reduces to 2 (in
both directions). After the next round of
updates, what will be new distance at node
N3?
(A) (3, 2, 0, 2, 5) (B) (3, 2, 0, 2,
6)
(C) (7, 2, 0, 2, 5) (D) (7, 2, 0, 2,
6)

(2) After the update in previous question, the


link N1 - N2 goes down. N2 reflect this change
immediately. After the next round of update,
What will be cost of N1 in the distance vector of
N3?
(A) 3 (B) 9
(C) 10 (D) 
Sol. (1) In next round, every node will send &
receive distance vector to & from neighbours &
update its distance vector.
N3 will receive (1, 0, 2, 7, 3) from N2 & it
will update distances to N1 and N5 as 3, 5
Correct option is (A)
(2) In next round, N3 will receive distance
from N2 to N1 as . It will receive distance
from N4 – N1 as 8.
So, it will update distance to N1 as 8 + 2 =
10.
Correct option is (C).

Link State Routing./ Dijesktra


In link state routing, each node has the entire
topology of the domain. Each node uses the same
topology to create a routing table.
 In this algorithm, each router also updates its
routing table periodically. In this algorithm,
each router shares information about its
neighbours to all the routers using Hooding
algorithm.
 For sharing this information each router creates
a special packet called link state packet (LSP)
Suppose the network is given as,
5
A B
2 4

3 C

4
D E

Steps :
(1) Creation of LSP packet
LSP of A
Identification
Age (TTL)
B 5
C 2
D 3

(2) Dissemination of LSP packet to every other


router using flooding.
(3) Formation of shortest path tree using dijkstra
algorithm.
5
A B
2 4

3 C 3 Top olog y
4

D E

The various steps are as follows.


0 A 0 A B 5 0 A B 5

C 2 2 C

3 D 3 D E 6

(a ) (b ) (c)

0 A B 5 0 A B 5

C 2 2 C

3 D E 3 D E 6

(d ) (e )
S ho rtest p ath tre e

(4) Each router has shortest path tree & based on


this calculate Routing table.
for A Node Cost Next
A 0 
B 5 
C 2 
D 3 
E 6 c

Disadvantage
(1) Need lot of resources
(2) Heavy traffic due to flooding.
OSPF (Open Source Shortest Path First)
Metric - OSPF allow administrator to assign a cost
to each route based on type of service like minimum
delay, maximize throughput.
Path Vector Routing
It is similar to distance vector routing, in this we
assume there is one node in each autonomous system
(System under one administration) that acts on the
behalf of entire autonomous system. It is called speaker
node.
 Only speaker node communicate with each other
A S1 AS3

A2 A3 C2 C3

A4 A1 C1

AS2 A S4
B 1 Tab le
B3 D1 D4
B1 AS2
B2 AS2 B1
B3 AS2
B4 AS2
B2 B4 D2 D3

BGP - Border gateway protocol is an interdomain


routing protocol using path vector routing.
 The exchange of routing information between
two routers takes place using BGP sessions.
 There are two types of sessions :
(a) Internal
(b) External
A2 A3 B3

A1 B1 B4

A4 A5 B2

– External BGP session


– Internal BGP session
Hierarchical Routing
In DVR, each router maintains one entry
corresponding to all the router that may be huge.
We can reduce these number of entries using
hierarchical routing.
R e gio n 1 R e gio n 2

R2
R1 R5 R6
C lu ste r 1
R4 R3 R7

R e gio n 3 R e gio n 4

R8 R9
C lu ste r 2 R 12 R 13
R 11 R 10

Let x  Clusters
y  Regions
z  Routers
Number of entries at each router.
z  (y  1)  (x  1)

Total No. of routers x  y  z


 Multicasting Routing Protocols
Difference between multicasting and multiple
unicasting.
In multicasting  Single packet from source that is
duplicated by every router.
Multiple Unicasting  Five different packets from
source with different destination address.
Multicast routing  Forwarding of single packet to
members of a group requires a shortest path tree. If we
have n groups, n shortest path tree.
Solution

S ou rce B ased Tre e G rou p S ha red Tre e

E ach ro ute r ha s o ne Instea d o f e ach ro ute r ha ving


sho rtest pa th fo r ea ch m sho rtest pa th tree, o nly
grou p on e d esig na te d ro ute r calle d
re nd ezvo us rou ter distribu te
traf fic
Protocols

S ou rce B ased Tre e G rou p S ha red Tre e

MO SPF DVMRP P IM - P IM - S M CBT


DM
P IM

(1) Multicast DVR


(a) Flooding - but creates loops
(b) Reverse Path Forwarding (RPF) - to
prevent loops only one copy is forwarded rest
are dropped.
(b) Reverse Path Broad Casting (RPB) - one
parent for each network. A network can receive
multicast packet from a source only through
designated router.
(d) Reverse Path Multicasting - RPM uses
pruning & drafting.
(e) CBT (Core Based Tree) - Group shared
protocol that uses core as root of tree.
(f) PIM (Protocol Independent Multicast)
for Broad casting algorithms use
(1) Flooding
(2) Multidestination routing
Q. Two popular routing algorithms are Distance Vector
(DV) and Link State (LS). Which of the following is
true?
S1 : Count to infinity problem is only with DV not LS
S2 : In LS, the shortest path algo is run only at one
node
S3 : In DV, shortest path algorithm is run only at
one node
S4 : DV requires less number of network messages
than LS
(A) S1, S2, S4 (B) S1, S2, S3
(C) S1 & S3 (D) S1, S4
Sol. S1 is true.
S2, S3 are both false as shortest path algorithm is
run at all the nodes
S4 is true, as link state requires flooding. So more
messages.
Correct option is (D).
TCP Connection
TCP is connection oriented. It establishes a virtual
path between source and destination.
It requires three phase :
1. Connection Establishment
2. Data Transfer
3. Connection Termination
Connection Establishment : It is done using three
way handshaking.
C lie nt S erve r
S yn (
s eq = 800
0)

S yn + a ck
(se q 15 00 0
Ac a ck 8 00 1)
(S e q
8000 k
ack 1
5001
)

S yn A ck

1 0 R e qu est

1 1 R eply

0 1 P ure P ig gy B acking

SYN Flooding Attack : The connection


establishment procedure in TCP is susceptible to
serious security problem.
An attacker can send large number of SYN
segments to a server pretending each come from a fake
client.
Server reply for large number of client by SYN +
ACK and may run out of resource.
Thus, denial of service
Data Transfer
After connection establishment, bidirectional data
transfer can take place.
C lie nt S eq = 90 01 S erve r
ack = 15 00 1
D a ta (90 01 – 10 00 0)

S eq = 15 00 1
ack = 10 00 1
D a ta (15 00 1 – 1 70 00 )
Tim e

Pushing Data : (PSH) In this case TCP must not


wait for window to be filled
It must create segments & send it immediately.
URG Data : The sending application tells the
sending TCP that the piece of data is urgent. It creates a
segment & insert at beginning of segment.
When receiving TCP gets data with urgent pointer
set it removes the urgent data and sends it out of order
to receive application.
Connection Termination
3-way hand shake
S ha ke  S erve r
C lient F in

F in + A ck

A ck

Half Close
One end can stop sending data while still receiving
data.
C lie nt F in S erve r

A ck

D a ta

A ck

F in

A ck

Q. The three way handshake for TCP connection


establishment is shown below –
[Gate
2008]
C lie nt S erve r
S YN

SYN + ACK

ACK

Which of the following statements are true ?


S1 : Loss of SYN + ACK from server will not
establish a connection
S2 : Loss of ACK from client will not establish
connection
(A) S1 (B) S2
(C) Both S1 & S2 (D) Neither S1
nor S2
Sol. (A) S1 is true
S2 is false
Correct Option is (A)

Q. What is the maximum size of data that the


application Layer can pass on to the TCP layer
below?
(A) Any Size (B) 216 – Size of TCP
header
(C) 216 B (D) 1500 B
Sol. (A) Application Layer can send any amount of
data.
Correct Option is (A)

Q. Consider a TCP connection in a state with no


outstanding ACKS. The sender sends the segments
back to back with sequence number 230 & 290
respectively. The first segment was lost. But second
received correctly. Let X be amount of data carried
in first segment (B) & Y be ACK number sent by
receiver. The value of X & Y are –
(A) 60 & 290 (B) 230 & 291
(C) 60 & 231 (D) 60 & 230
Sol. (D) Bytes = 290 – 230 = 60 B
ACK sent is next expected by receiver i.e. 230
as it was not received by it.

Flow Control
Flow control balances the rate of producers creates
with the rate at which a consumer uses the data.
 To achieve flow control, TCP forces sender and
receiver to adjust their window sizes although
size of buffer for both parties is fixed when
connection is established.
C lie nt 00 S erver
adv = 10
10 00 B
d a ta = 1
00 B
90 0
0
adv = 90
d a ta =
700
0 20 0
adv = 20
da ta = 2 00

adv = 0
P ersiste nce tim e dum m y D u m m y segm en ts are
sen t w h en clien t
can ’t se nd no rm a l
seg m e nts

Window Shutdown
Instead of shrinking the send window, the receiver
can temporarily shut down the window by sending rwnd
of 0. This happens if receiver does not went to receive
data for some time.
Even when window is shut down from receiver,
sender can always send 1 byte of data. This is called
probing & used to prevent a deadlock.
Silly Window Syndrome
A serious problem occurs when either sender
produces data slowly or receiver receives data slowly.
E.g.-If TCP sends 1 bytes of data that means 41 byte
datagram (20 B of TCP header + 20 B of IP) to transfer
only 1 byte. Overhead in this case is 41/1. This is called
silly window syndrome.
Syndrome by Sender : If sender creates data
slowly, for e.g. 1 byte at a time. Solution would be to
wait & collect data before sending.
Nagle's Algorithm
1. When TCP data come into sender TCP one
byte at a time just send first byte as a single
TCP segment.
2. After that buffer all the data till either
acknowledgement is received or enough data
is accumulated till the maximum segment size.
Not useful  in case of interactive applications.
Syndrome by Receiver : Receiver may create a
syndrome if it is consuming data slowly e.g. 1 byte at a
time.
Here,
R e ceive r bu ffe r is fu ll

R e ad 1 bytes data

R o om for o ne b yte

W in do w up da te sen t

N e w b yte arrives b y se nd er

R e ceive r bu ffe r fu ll

Silly W indow Syndrom e by Receiver

Clark's Solution
Prevent the receiver from sending a window update
for 1 byte of data.
The window is not advertised till there is enough
space to accommodate a segment of max size or until
half of receiver buffer is empty.
TCP Error Control
TCP provides reliability using error control. Error
control includes mechanisms for detecting & resending
corrupted segments, resending cost segments, storing
out or order segments.
TCP achieves this using
(1) Checksum
(2) Acknowledgement
(3) Time out
Checksum
 TCP checksum is calculated for TCP headers,
TCP payload & pseudoheader.
 If in transit, the IP header gets corrupted & IP
checksum gets modified. In such case, TCP
will detect error using pseudoheader. Also,
TCP doesn't calculate checksum for entire IP
header, just a part of header as, IP header
changes though transit.
(TTL, offset, options, MF, checksum)
Acknowledgement
TCP uses acknowledgements to confirm receipt of
data segments.
Ack segments do not consume
Acknowledgement type
1. Cumulative acknowledgement : Acknowledge
data cumulatively.
2. Piggybacking : ack with the data
3. Selective acknowledgement : It does not
replace ack but provides additional information
such as block of bytes duplicated or out of
order. SACK are implemented in TCP options.
Retransmission
The sending TCP maintains one retransmission
time out CRTO; for each connection. When timer
expires, TCP resends the data and restart the timer.
TCP uses a highly dynamic algorithm that
constantly adjust timeout interval.
Jacobson's Algorithm
Basic Algorithm
 Estimated RTT =  initial RTT + (1 – ) New
RTT
(round triptime)
0  1 is a constant
 Time out = 2 RTT
Example : Let IRTT = 30 sec
NRTT = 40 sec
 = 0.9
Estimated RTT =  IRTT + (1 – ) NRTT
= 0.9 × 30 + 0.1 × 40
= 31 sec
Time out = 2 × 31
= 62 sec
Jocobson used another variable deviation (D).
Deviation is given by :
Whenever an acks comes in, its initial RTT & New
RTT is observed.
D = | IRTT – NRTT |
A smoothed value of Deviation is maintained,
D(estimated) =  Dinitial + (1 – ) Dnew
Time out = RTT + 4  D(expected)
Example : Consider IRTT = 30 sec
NRTT = 40 sec
 = 0.9
Initial Deviation (Di) = 5
Then D(new) = | IRTT – NRTT |
= |30 – 40|
= 10 sec
Deviation (expected) =  Dinitial + (1 – )Dnew
= 0.9 × 5 + (1 – 0.9)10
= 5.5
RTT (expected) = IRTT + (1 – )NRTT
= 0.9 × 30 + 0.1 × 40
= 31
Time out = 4 × D(expected) + RTT (expected)
= 4 × 5.5 + 31
= 53
Karn's Algorithm
Consider a situation below
d a ta 1 d a ta 1
0 0
tim e o ut tim e o ut
d a ta 1 d a ta 1
0 0

A c k 11

11
k
Ac

Which acknowledgement should be considered to


calculate the retransmission timer.
(a) From original packet
(b) Retransmitted packet
Thus karn proposed a solution, for every time out
double the timeout till we get proper acknowledgement
then continue with Jacobson's Algorithm.
Q. Consider the following statements
[Gate 2015]
I. TCP connections are full duplex
II. TCP has no option for selective
acknowledgement.
III. TCP connection are message streams
(A) Only I correct (B) I, II correct
(C) II, III correct (D) All of the I, II, III
correct
Sol. (A) TCP is byte stream and has an option for
selective acknowledgement.
Correct Option is (A)

Timers in TCP
1. Retransmission Timer
 When a segment is sent a retransmission timer
is started.
 If segment is acknowledged before timer
expires, the timer is stopped.
 If timer goes off, then the segment is
retransmitted.
2. Keep alive Timer
It is used to check for connection integrity when it
goes off (because of long time of inactivity) one side
check of other side is available.
3. Persistence Timer
It is to avoid deadlock
 Receiver sends a packet with window size = 0
latter it resends with larger window size but this
segment gets lost.
 Both receiver & transmitter are waiting for each
other.
Persistence timer is used at the sender side, that
when goes off produces a probe packet & make receiver
advertised window once again.
4. Timed Wait State Timer
When connection is close, it runs for maximum
packet lifetime to make sure connection is closed & all
packets relating to this has died.

Q. Consider the following statements about time out


value used in TCP.
(i) Time out is set to RTT measured during TCP
connection establishment for entire duration of
the connection.
(ii) Appropriate RTT estimation algorithm is used
to set the time out value of a TCP connection.
(iii) Time out value is set to twice propagation delay
from sender to receiver.
Which of the following holds –
[Gate 2007]
(A) i-false, (ii), (iii)-true (B) (i) & (iii)-
false, (ii)-true
(C) (i) & (ii)-false (iii) true (D) (i) (ii) (iii) are
false
Sol. (A) (i) False RTT is measured every time an ACK
is received.
(ii) Jacobson algorithm is available for
estimation of time out.
(iii) It is true, RTT is set to twice of RTT
estimation.
Correct Option is (A)

Congestion Control in TCP


TCP does flow control by advertising receiver
window size. This guarantees that receiver is never
overflowed with bytes i.e. estimation will never get
congested.
However intermediate router, buffer in router can
become congested.
Policy Used in TCP
Slow Start : Exponential Increase : It is based on
the idea that the size of congestion window (cwnd) is 1
MSS but it increases each time one acknowledgement
arrives.
The sender starts with cwnd = 1. After the first ack
arrives,
Start cwnd = 1  2°
After 1 ack cwnd = 2  21
After 2 ack cwnd = 4  22
After 3 ack cwnd = 8  23
The sender keeps track of ssthresh (slow-start
threshold) when threshold is reached, slow start stope &
next phases starts.
Congestion Avoidance : Additive Increase
This increases cwnd additively instead of
exponentially till congestion is detected.
Congestion Detection
Congestion can be detected in 2 ways
(i) 3 duplication Acks
(ii) Time out

Q. Assume that bandwidth for TCP is 1048560 b/s. Let


 be value of RTT in ms (round off to nearest
integer) after which TCP window scale option is
needed. Let  be maximum possible window size
with window scale option. Then what are values of 
& [Gate
2015]
Sol. Max window size is amount of data that can be sent
in an RTT
65535  8
RTT   500 ms
1048560 bps

For scaling factor 14 bits are used.

3 duplicate Acks : Whenever congestion is


detected because of 3 duplicate Acks; it will indicate
congestion is not severe, new threshold is half of current
cwnd & algo enters congestion avoidance phase.
Time Out  This indicates congestion is severe &
new threshold is set to half of the current congestion
window & algo starts slow start phase.
Example : In slow start let threshold be at 8 MSS.
So,
cw n d = 1 M SS
cw n d = 2 M SS
acks re ceive d
cw n d = 4 M SS
cw n d = 8 M SS
T hresh olds rea che d
cw n d = 9 M SS
cw n d = 1 0 M S S
acks re ceive d
cw n d = 11 M SS
cw n d = 1 2 M S S
Tim eo ut fo r 12 M S S
cwnd 12 MSS

Threshold 2 = 6 MSS
2

Start again, cwnd = 1 MSS


cwnd = 2 MSS
cwnd = 4 MSS

Q. Let the size of congestion window of a TCP


connection be 32 KB when a timeout occurs. The
RTT of the congestion is 100 msec & maximum
segment size used is 2 KB. The time taken by TCP
connection to get back 32 KB of congestion window
is _______ [Gate
2014]
Sol. Congestion Window = 32 KB
Threshold = 16 kB
1 M SS  2 KB
4 KB
e x p o n e n t ia l 8 KB
in c r e a s e
16 KB
T h r e s h o ld
18 KB
20 KB
22 KB
24 KB
a d d itiv e
26 KB
in c r e a s e
28 KB
30 KB
32 KB

So, 12 segments.
Time taken = 12 × 100 msec = 1200 msec

Q. Consider an instance of TCP's additive increase


multiplicative Decrease (AIMD) algo where window
size at start of slow start phase is 2 MSS threshold
is 8 MSS. Assume time out occurs at 5th
transmission. Find out congestion window at the
end of tenth transmission.
[Gate 2012]
(A) 8 MSS (B) 14 MSS
(C) 7 MSS (D) 12 MSS
Sol. (C) 1st transmission  2 MSS
2nd transmission  4 MSS
3rd transmission  8 MSS
————— Threshold
4th transmission  9 MSS
5th transmission  10 MSS
————— Timeout
10
Threshold = = 5 MSS 2

6th  2 MSS
7th  4 MSS
8th  5 MSS
———— Threshold
9th  6 MSS
10th  7 MSS
Correct Option is (C)

Q. Which of the following statements are true ?


[Gate 2008]
S1 : TCP handles both congestion & flow control.
S2 : UDP handles congestion but no flow control.
S3 : Fast retransmit deals with congestion but not
flow control.
S4 : Slow start deals with both congestion and flow
control.
(A) S1, S2, S3 (B) S1, S3
(C) S3, S4 (D) S1, S3, S4
Sol. (B) S1 : TCP handles both flow & error control. So,
S1 is correct.
S2 : UDP does not do error & flow or
congestion control.
S3 : Fast retransmit is used by TCP to
overcome the problem of out of order segments
by retransmission. It helps is congestion control
by quickly recover lost data packets.
S4 : Slow start deals with congestion control.
Correct Option is (B).

5. WORLD WIDE WEB (WWW)

World Wide Web (WWW) is a repository of


information linked together from points all over the
world. It is distributed client - server service, in which a
client using browser can access a service using a
server. The service is distributed across multiple
locations called sites.
C lie nt S ite A S ite B

R e qu est

w e b pa ge A
R e qu est

w e b pa ge A

Client (Browser)
These interprets and displays a web document. It
consist of 3 parts —
(a) Controller  Receives input from keyboard &
use client program to assess the document.
(b) Client protocol  One of the protocol is used
like FTP, HTTP
(c) Interpreters  Display the document on the
screen.
HTM L

C lie nt
Java scrip t

HTTP FTP SM TP •••


Java

Server - webpage is stored at the server.


Uniform Resource Locator (URL)
A client that wants to access a web page needs the
address. To facilitate the access of documents
distributed world wide HTTP uses locators.
 URL defines four things : protocol, host
computer, port and path.
protocol : // Host : Port / Path
Protocol  that is used to retrieve document eg.
FTP or HTTP
HOST  is computer where information is located
Port  URL can optionally mention port number of
server.
Path name  Name of file where information is
stored.
Domain Name System (DNS)
It translates domain name into IP addresses.
 It is using UDP and the purpose is to keep
track of computers and services in the network
environment.
 It has four applications —
Name translations
Host Aliasing
Mail Aliasing
Load balancing
Name Translations
Name space - to be unambiguous, the names
assigned to machines must be carefully selected from a
name space with complete control over binding between
names and IP addresses.
The various domains are —
R o ot

cou ntry
Inve rse do m a ins
do m a in ge ne ric
do m a ins
Generic domains  It defines registered host
according to their generic behaviour.
Eg :- • .com - commercial organisations
• .edu - educational institutes
• .gov - government institutes
Country domains - The country domains uses two
- character country abbreviations e.g. - US for United
States or Ca.us for California, United States.
Inverse domains - It is to map an address to a
name.
Resolution
Mapping a name to an address or an address to a
name is called resolution.
Resolver – DNS is designed as a client/server
application. A host that needs to map address to a name
or name to an address is called a resolver.
Mapping names to addresses – if the domain
name is from generic domain, the resolver receives a
query & it sends the query to local DNS for resolution.
Mapping Address to names - A client can send IP
address to a server to be mapped to a domain name.
This is called PTR query.
The IP address is reversed and two labels in-addr
and orpa are appended. The domain name is then
received by local DNS and resolved.
(a) Recursive resolution - The client
(resolver) can ask for a recursive answer i.e. it
expects the server to supply the final answer.
(b) Iterative resolution - In this if the server is
authority for the name it sends the answer
otherwise it sends the IP address of free server
it thinks can resolve the query.
So, it uses 4 types of servers
Root name server
Top level domain server
Authoritative server
Local DNS server
Information about computer and services are stored
in these servers in the terms of resource records.
 Each resource records consists of 5 attributes.
Name
TTL
Class
Type
Value
ne arest R o ot S e rver
ro uter (h old in g top
ISP RJ le vel D N S )
ISP
w w w. xyz. co m
U se r Lo cal D N S 10 . 1 . 1 . 1.
server state in th is
router Top leve l
T LD
do m ain

S t ra i IP ss
C ont ght Aw ay AS P ad
d re
r o ls w
it h it get I
A utho ritative
S erve r • C om
(each D N S • go v
store s it)

 Once a request for a website is sent, it gets


stored in ISP and the local router, whenever
again a request of some website is sent than
there is no need to visit all the servers and
there is only subsequently request simply it
shows the website without visiting root server
 Mainly 70% of internet services are provided by
ISP & local routers.
When Top level domain servers
maintained in terms of clusters. They are
connected with MESH topology. It helps to
improve efficiency & reliability.
Electronic Mail (E-Mail)
One of the most popular internet service is e-
mail.
It consist of 3 components 
(1) User Agents
(2) Mail Servers
(3) Simple Mail Transfer Protocol : SMTP
U se r U se r
A ge nt A ge nt

S en de r R e ceive r

m a il m a il
server server

User Agent (UA)


The first component of email is user agent
(UA).
It provides services to the user to make the
process of sending & receiving mail easier.
Services :
(1) Composing messages
(2) Reading messages
(3) Replying to messages
(4) Forwarding messages
(5) Handling mailboxes
MIME (Multipurpose Internet Mail Extensions)
Email has a simple structure. It can send messages
only in 7 bit ASCII - Format. That is it comes with a
limitation that it cannot be used for language such as
French, German.
 MIME is a supplementary protocol that
allows non ASCII data to be sent through
email.
MIME transfers non ASCII date at sender side
to NVT ASCII & deliver to client MTA.
U se r U se r

N o n A SC II N o n A SC II

M IM E M IM E

7 b it N V T A S C II 7 b it N V T A S C II

7 b it N V T A S C II
M TA M TA

MIME allows seven different types of data :


(1) Text including plain, HTML
(2) Multiport where body contains different
datatypes
(3) Message
(4) Image jpeg, gif format
(5) Video mpeg format
(6) Audio
(7) Application - binary data, Adobe post script
Message Transfer Agent : SMTP
The actual mail transfer is done through mail
transfer agents (MTA). Simple mail transfer protocol
(SMTP) is used two times, between sender and sender’s
mail and between two mail servers.
SM TP SM TP

M a il Interne t M a il
server server
SMTP uses port 25 at TLP. It is host to host
transport protocol.
It is a port of push mechanism i.e. it is used to push
the mail.
 SMTP Uses commands & responses to
transfer messages between MTA client and
server.
 The various commands include —
HELLO, MAIL FROM, RCPTTO, DATA QUIT,
HELP etc.
The various responses include —
System status, Start mail input, Service not
available.
Message Access Agent : POP AND IMAP
SMTP is just a push protocol i.e. it push the
message from server to client. However, the client must
pull messages from server
For this two protocols POP and IMAP are used.
S en de r
S M TP S M TP P O P 3/
IM A P

R e ceive r

M a il Interne t M a il
server server

POP3 (Post office protocol version 3)


It is simple and limited in functionality
 Mail access starts with the client when user
needs to download email from the mailbox to
mail server. The client opens TCP connection
at port TCP port 110.
 POP has two modes :-
(1) Keep mode – mail is in mailbox after
retrieval
(2) Delete mode - User can save and
organised the received mail after reading
or replying.
IMAP4 (Internet mail access protocol)
 IMAP4 is similar to POP3 but has more
features like :-
(1) User can check email header prior to
downloading.
(2) User can search the contents of email.
(3) A user can partially download contents of
email.
It is useful if bandwidth is limited & email
contains multimedia with high bandwidth
requirement.
(4) A user can create, delete or rename mailboxes
on the mail server.
(5) A user can create a hierarchy of mailboxes in a
folder for email storage.

Q. Consider different activities related to email


[GATE 2011]
m1 :Send an email from a mail client to a mail
server
m2 :Download an email from mailbox server to mail
client.
m3 :Checking email in web browser
(A) m1 : HTTP m2 : SMTP m3 : POP
(B) m1 : SMTP m2 : PTP m3 : HTTP
(C) m1 : SMTP m2 : POP m3 : HTTP
(D) m1 : POP m2 : SMTP m2 : IMAP
Sol. SMTP : is used to send mail from client to server
POP : is used to download mail
HTTP : is used for web browser
Correct Option is (C).

Q. Match the following : -


[GATE - 2007]
P. SMTP 1. Application
layer
Q. BGP 2. Transport layer
R. TCP 3. Data link layer
S. PPP 4. Network layer
5. Physical layer
(A) P - 2 Q-1 R-3 S-5
(B) P - 1 Q-4 R-2 S-3
(C) P - 1 Q-4 R-2 S-5
(D) P - 2 Q-4 R-1 S-3
Sol. Correct option is (B).

Q. Which transport layer protocol is used to support


electronic email? [GATE - 2012]
(A) SMTP (B) IP
(C) TCP (D) UDP
Sol. Correct option is (C).
i.e. TCP is used as a transport layer protocol to
support email.

Q. SMTP uses port number ?


(A) 22 (B) 23
(C) 24 (D) 25
Sol. Correct option is (D).

TELNET : Remote Logging


(Terminal Network)
Telnet enables the establishment of a connection to
a remote system in such a way that the local terminal
appears to be a terminal at the remote system.
 When doing remote logging, the user sends the
keystrokes to the terminal driver where the
local operating system accepts the character
but do not interpret them.
The characters are then send to TELNET
Client, Which transforms the characters to a
universal character set called network virtual
terminal (NVT) and delivers them to local
TCP/IP protocol stack.
 The commands or text in NVT travel through
Internet and arrive as TCP/IP stack at the
remote machine. Here characters are sent to
TELNET server which changes to a form
readable by remote computer.
Proxy Server
HTTP support proxy server. It is a computer that
keeps copies of responses to recent request. The HTTP
client sends request to proxy server. The proxy server
checks its cache, if it is not stored in cache, the proxy
server sends request to corresponding server.
 Proxy server reduces the load on original
server, decrease traffic and improves latency.
File Transfer - transferring files from one computer
to other.
File Transfer Protocol (FTP)
 It is a client server protocol that differs from
others as here two connections are made.
Data connection (Using port 20)
Control connection (Using port 21)
 It is a stateful protocol and uses TCP for
reliability.
 The FTP client sends an FTP request to FTP
server on port 21 of TCP (this occurs through a
command connection), initially authorization is
required which takes username and password.
 After authorization some commands are sent
through control connection (e.g. download a file
from server), the FTP server in response opens
a data connection with the client on port 20 &
downloading takes place.
 After that the connection terminates i.e. the
server closes the connection but remembers
about client i.e. authorization hence stateful.
 It is also called out of band connection because
control & data connection takes place through
2 different paths.
Anonymous FTP
To use FTP, a user needs account (user name) and
password. Some sites have set of files available for
public access to enable anonymous FTP for this
username and passwords are not required.

Q. Which of the following is/are examples of stateful


application layer protocols?
(1) HTTP (2) FTP
[GATE 2016]
(3) TCP (4) POP3
(A) (1) & (2) (B) (2) & (3)
(C) (2) & (4) (D) (4) Only
Sol. Correct option is (C)
Here, HTTP - Stateless
FTP - Stateful
TCP - not an application layer protocol
POP3 – stateful

6. NETWORK SECURITY

It can provide the following services.


C o nfid e ntia lity

Integ rity
M e ssa ge
A uthe ntica tio n

N o n re pu dia tion
S ecurity S ervices

E ntity A uthe ntica tio n

Confidentiality / Privacy : It means that the


transmitted message must make sense only to receiver.
To all other messages must be garbage. This is done
using cryptography.
Message Integrity : Data must arrive at the
receiver exactly as they were sent. There must be no
change. This is done using message digest (using hash
function SHA–1)
Message Authentication : Message Authentication
is a service beyond message integrity. In this receiver
needs to be sure of sender's identity and that imposter
has not send the message. This is done using MAC.
Message Non-repudiation : Sender must not be
able to deny sending a message that he/she infact did
send. This is done using digital signature.
Entity Authentication : Entity/user is verified prior
to access the system. This is done using passwords.
C ryp tograp hy
(M e ssag e C o nfid e ntia lity)

S ym m etric A sym m etric


(S ecret K e y C ryp tog rap hy) (P ub lic Ke y C rypto gra phy)

RSA

D i ffie H e llm a n
Trad ition al S im ple M od ern M o de rn
C ip he rs C ip he rs

Substitution XOR DES


M o no alp ha be tic cip he r 3D ES
P olya lph ab etic S -bo x AES
Tran sp ositio n ID E A
cip he r P -bo x
B low fish
C A S T.12 8

Cryptography : It is a technique to achieve


confidentiality.
S ende r (en cryptio n) R e ceiver (de cryptio n)

E K (P ) = C D K (C ) = P

K  Key
C  Ciphertext
P  Plain text
Symmetric Key Cryptography
In symmetric key cryptography both sender and
receiver use the same key for encryption and
decryption.
The general idea behind symmetric key
cryptography is,
S en de r
P P

E ncryp tion S ha red S ha red D e cryptio n


algo key key algo

C C
C h an ne l
E ncryp tion C = E K (P ) D e cryptio n P = D K (C )

Traditional Ciphers : Work on characters rather


than bits
Substitution Cipher
A character of plaintext is substituted by some other
character generally by some addition to it. They are also
known as Caesar Shift Cipher
Ex-Let,
Plain text be Hello and Key (K) = 15. What is cipher
text
H7 (7 + 15) mod 26 = 22  W
E4 (4 + 15) mod 26 = 19  T
L  11 (11 + 15) mod 26 = 00  A
L  11 (11 + 15) mod 26 = 00  A
O  14 (14 + 15) mod 26 = 03  D
Hello will be sent as WTAAD
Disadvantage : They are only 26 keys. So, better
to create a mapping between plain text & cipher text.
Monoalphabetic : A character of plain text is
replaced by some other character irrespective of how
many times it occurs.
E.g.: Book is Plain text
A B C D E F G H I J K L M N O
N O T R B E C F U X D Q G Y L

So, Book will be encoded is OLLD


Polyalphabetic : Each occurrence of a character
can have a different substitution. E.g.: A can be replaced
by B in middle, C if in start or F if it occurs at the last.
Transposition Cipher : We change the position of
characters in plaintext to produce the ciphertext.
Sender writes plaintext row by row according to the
key. Then the key is arranged. After that the receiver
reads the plain text column by column according to the
key.
Example : Let the plaintext to be encrypted is
COMPUTER NETWORK using key LAYER. What is the
cipher text. [June 2015]
Solution. Key  L A Y E R
C O M P U
T E R N E
T W O R K
Arranged Key
A E L R Y
O P C U M
E N T E R
W R T K O

So, cipher text is O E W P N R C T T U E K M R O

Q. Suppose plain text is given EXTRA NET. They key


is as follows
3 5 2 1 4 Cipher text
1 2 3 4 5 plain t ext

(A) T A X E R T Z E N Z (B) Z Z T A X
ENERT
(C) Z T E X R T Z E N (D) R Z T T E
NAZXE
Sol. (D)
1 2 3 4 5
E X T R A

N E T Z Z
 given in ques as bogus character
4 3 1 5 2
R T E A X
Z T N Z E

RZTTENAZXE
Correct Option is (D)

Simple Modern Ciphers


These are working on bits rather than characters.
(1) XOR

At receiver

(2) S-Box (Substitution Box Method)


m bits (0 to 2 55 )
S -B o x  Ke y (P m o d 8 )
n b its

Suppose : Plaintext P = 245


n = 3 bits
So, 245 mod 8 = 5
= (101) represented in 3 bits
(3) P-box (Permutation Box)
Let Plaintext be 10101. If mapping be
1 2 3 4 5
3 5 1 4 2
What is ciphertext using P-box
P lain te xt  1 0 1 0 1
1 2 3 4 5

3 5 1 4 2
1 1 1 0 0  C ip her te xt

Modern Cipher
1. Data Encryption Standard (DES)
64 -b it p la intext

Initia l pe rm u ta tion

K1
R oun d 1
64 bit
R o un d-ke y g en erator
K2 (8 -bit p arity cod e)
R o un d 2
64 bit 56 bit ciph er ke y

K 16
R o un d 16
64 bit

F in al p erm u tatio n

64-b it cip he rtext

So in DES
1. Stages in DES  18
2. Rounds in DES  16
3. Plaintext and ciphertext length  64 bit
4. Round key generation use same method only
key changes (56)
3-DES
This is an extension of DES method which applies
DES cipher algorithm three times to each data block.
Encryption : Cipher text = EK3 (DK2 (EK1 (P) ) )
Decryption : Plain text = DK1 (EK2 (DK3 (C) ) )
Keying Option
1. All keys are dependent
3 × 56 = 168 independent Keys bits
2. K1 & K2 independent K1 = K3
2 × 56 = 112 Key bits
3. K1 = K2 = K3
56 bit key equivalent to DES
AES (Advance Encryption Standard Method)

Size of No. of Key


data block Rounds Size
128
10
bits
192
128 bits 12
bits
256
14
bits

Q. AES is a round cipher based on the Rijndael


algorithm. Algorithm uses 128 bit block of data. AES
has 3 different configurations _________ rounds.
With key size of 128 bits, _____ rounds with key
size of 192 bits & __________ rounds with a key
size of 256 bits.
[Net 2014]
(A) 5, 7, 15 (B) 10, 12, 14
(C) 5, 6, 7 (D) 20 12, 14
Sol. Correct Option is (B)
Q. Which of the following substitution technique have
the relationship between a character in the plaintext
& a character in cipher text as one to many ?
[Net 2014]
(A) Monoalphabetic (B) Polyalphabetic
(C) Transpositional (D) None of above
Sol. Correct Option is (B)

Q. How many distinct stages are there is DES which is


parameterized by a 56 bit key ?
(A) 16 (B) 17
(C) 18 (D) 19
Sol. Correct Option is (A)

Q. Find the false statement


(A) In modern crypto system, symmetric key
algorithm use same key for encryption &
decryption
(B) Symmetric DES was widely used
(C) The AES crypto system allow variable key
lengths of size 56 bits & 124 bits
(D) Public key algorithm use two different key for
encryption & decryption
Sol. Correct Option is (C)

Asymmetric Key Cryptography


In this two different keys are used at the sender &
receiver side
S en de r : A R e ceive r : B
B ’s B ’s
P ub lic P rivate
K ey E K 1 (P ) = (C ) K ey
E ncryp tion D e cryptio n
algo algo

P = D K2 (C )

At sender side
K1 = Public key of receiver
At receiver side
K2 = Private key of receiver
RSA  Rivest Shamir Adleman
The various steps are –
1. p, q are large prime number, n = p × q
2.  = (p – 1) (q – 1)
e  public key of Receiver
d  public key of Receiver
3. e × d mod  = 1
4. Cipher text = Pe mod n
P  plain text
5. Plain text P = Cd mod n
Ex. Let plaintext P be 5
P=3
q = 11
d=7
Find the cipher text
Sol. (1) n = p × q
= 3 × 11
n = 33
(2)  = (p – 1) (q – 1)
 = (2) (10)
p = 20
(3) (e × d) mod 20 = 1
(e × 7) mod 20 = 1
e3

(4) C = Pe mod n
C = 53 mod 33
C = 26
Diffie Hellman Cipher : It is used to resolve the
problem of symmetric key cryptography i.e. how to share
a private key between sender and receiver.
Let p and g be public keys
Sender Receiver
x y
R 1 = g m od p R 2 = g m od p
R1 R2

K = (R 2 ) x m od p K = (R 1) y m od p

Here x & y are private key


xy

So, k  g modp
Comparison between symmetric & Asymmetric key
Cryptography

Assymmetric Symmetric
Cryptography Cryptography
Use two independent keys It uses only one key
public & private key. It uses i.e. private key
one to encrypt & other to
decrypt
It is slower. So, not used It is faster & used for
for long messages long messages
It is less secure than
It is much more secure
assymmetric
Total no. of keys n(n–
Total No. of keys 2n
1)/2
Public and Private Key Algorithm
Private and public key are part of encryption that
encodes the information.
Public Keys :
Public key uses asymmetric algorithm that converts
messages into unreadable format. A person who has a
public key can encrypt the message intended for a
specific receiver. The receiver with the private key can
only decode the message which is encrypted by the
public key. The key is available via the public accessible
directory.
Private Keys :
The private key is a secret key that is used to
decrypt the message and the party knows it that
exchange message. In traditional method, a secret key
is shared within communicators to enable encryption
and decryption the message, but if the key is lost, then
system becomes void. To avoid this weakness, PKI
(Public key infrastructure) came into force where a
public key is used along with the private key. PKI
enables internet users to exchange information in a
secure way with the use of public and private key.
P ub lic K e y P rivate K ey

A BC en cryp tio n de cryp tio n A BC

P lain text C ip he rtext P lain text

Digital Signature :
 Uses pair of asymmetric keys. Like
conventional signature, digital signature prove
the authenticity of sender as the sender of
message. (Non - repudiation) sender cannot
later deny that the message is generated by
him.
Comparison between digital & conventional
signature
Digital Signature Conventional S ignature

S ign ature it sent as sep arate S ign ature is includ ed in th e


do cum en t do cum en t
N o co py of sign atu re is store d C o py of sign ature is use d
in ste ad sign ature is ava ilab le to verify d ocu m en t
& v erificati o n a lgo is u sed .
1 : 1 relatio n ea ch m e ssag e 1 : M relation b/w sign atu re
ha s its o w n sig na tu re an d d ocu m en ts
C o py of sign ature can no t b e C o py of sign ature can be
distingu ish ed unle ss tim e distingu ish ed
stam p ed

Method
R e ceive r
S en de r
S en de r's S en de r's
private pu blic
key key

sig ne d do cum e nt
P en cryp tio n de cryp tio n P
sig nin g verifying
algo rithm

Digital Signature provides


(1) Message integrity
(2) Message authentication
(3) Message Non Repudiation.
Some security Attacks are –
Security Attacks

S nooping M odi fi cation Denial of service


U n au th orized a ccess A tta cker m o difies in fo S low d ow n /C rash
or intercep tio n o f d ata acco rd ing to h is service by sen ding
ow n be ne fit lo t o f b ogus req ue st
Traffi c Analysis
C a n ob tain so m e type M asquerading/spoo fing
of in fo rm a tion like A tta cker im p erso na te T hrea ts to
em ail o f se nd er som e on e e lse eg : ava ila bility
m ig ht ste al p an k
T hrea ts to P IN n um b er
con fi de ntia lity
Replaying
R e pla y sa m e m e ssag e
ag ain an d a ga in
Repudiation
B y se nd er/R e ceive r
w h o de ny to eith er
sen d/receive

T hrea ts to
in te grity

Q. Anarkali digitally signs a message & sends it Salim.


Verification of the signature by Salim requires—
[GATE - 2016]
(A) Anarkali’s public key (B) Salim’s
public key
(C) Salim’s private key (D) Anarkali’s
private key
Sol. Correct option is (A).

Q. Consider that B wants to send a message m that is


digitally signed to A. Let pair of private & public keys
for A & B be denoted by kx– & kx+ for x = A, B
Let kx(m) represent operation of encrypting m with
key kx & H(m) be message digest. Which one
indicates correct way of sending message m along
with digital signature of A?
(A) {m, kB+H(m)} (B) {m, k B–
H(m)}
(C) {m, kA– (H(m)} (D) {m, k A+
(m)}
Sol. Message is digested H(m) & encrypted with
sender’s private key kB-(H(m)) to create a sign &
send it along with original message m.
{m, kB–(H(m))}
Correct option is (B).

Q. Which of the following are used to generate a


message digest by network security protocols?
(P) RSA (Q) SHA-1
[GATE - 2014]
(R) DES (S) MDS
(A) P & R (B) Q & R
(C) Q & S (D) R & S
Sol. Correct option is (C).
Q. Using public key cryptography, x adds a digital
signature  to message M, encrypts < M,  > &
sends it to y, where it is decrypted. Which one of
the following sequence of keys is used for
operation?
(A) Encryption : x’s private key followed by y’s
private key
(B) Decryption : x’s public key followed by y’s
public key
(C) Encryption : x’s private key followed by y’s
public key
(D) Decryption : y’s private key followed by x’s
public key
Sol. Correct option is (D).
 The message over the network should be
encrypted by y’s public key. So order of
encryption is n’s private key & y’s public key.
 On receiving the encrypted message, y will
decrypt it using its private key & x’s public key
for signature. So, order of decryption is y’s
private key followed by x’s public key.

Q. The total number of keys required for a set N


individuals to be able to communicate with each
other using shared key & public key cryptosystems
respectively are : -
(A) n(n – 1) & 2n (B) 2n & n(n – 1)/2
(C) n(n – 1)/2 & 2n (D) n(n – 1)/2 & n
Sol. Correct option is (C).

Q. Using data p = 3 q = 11, n = pq, d = 7 in RSA


algorithm. Find ciphertext of given plain text
S U Z A N N E.
(A) B U T A E E Z (B) xyz ABCD
(C) S U Z A N N E (D) ABCD xyz
Sol. p = 3 q = 11 n = 3 × 11 = 33
d=7
  = (p – 1) (q – 1) = 2 × 10 = 20
 (e × d) mod 20 = 1
e3
(e × 7) mod 20 = 1
S U Z A N N E, s = 16 C = Pe mod n
C = (19)3 mod 33
= 6859 mod 3
= 28 = B SB
Correct option is (A).

Firewalls
A firewall is a device (usually a router or computer)
installed between the internal network of an organisation
and rest of internet.

Interne t

F ire w a ll

1. Layer-3 Firewall : It can filter packets based


on first 3 layers - Physical Layer, DLL, Network
Layer.
E.g.:
(a) Source IP and destination IP as block a
host with IP address 104.32.1.0.
(b) IP datagram has protocol field (TCP, UDP,
ICMP, IGMP)
E.g.: Block ICMP Packets (ICMP echo
request, reply will be blocked)
(c) Block a protocol on particular host.
2. Layer-4 Firewall : It can filter packets based
on information of first 4 layers i.e. Physical
Layer, Data Link Layer, Network Layer,
Transport Layer.
Layer 3 Capabilities
+
(a) Port number (Block a service completely)
E.g.: No one send email (SMTP : 25) or
browse internet (HTTP : 80)
(b) Particular Server on Particular host
3. Proxy Server (Layer-5 firewall)
Layer-4 Firewall
+
(a) Application Layer – Authentication that is
using username and password
(b) Block User

You might also like