Computer Networks Notes
Computer Networks Notes
Introduction-
1. Simplex channel
2. Half duplex channel
3. Full duplex channel
1. Simplex Channel-
A simplex communication channel can send the signals only in one direction.
Thus, entire bandwidth of the channel can be used during the transmission.
Example-
Radio station
Radio station is a good example of a simplex communication channel.
A radio station always sends signals to its audience.
It never receives signals from the audience.
2. Half Duplex Channel-
A full duplex communication channel can send signals in both the directions at the same
time.
Full duplex communication channels greatly increases the efficiency of communication.
Example-
Telephone
Telephone is a good example of a full duplex channel.
Both the persons can speak as well as hear each other at the same time.
Channel Capacity-
The total number of bits a channel can hold is called as its capacity.
To gain better understanding about communication channels in networking,
Flow Control in Computer Networks-
In computer networks, flow control is defined as-
A set of procedures which are used for restricting the amount of data that a sender can send to
the receiver.
There are various flow control protocols which are classified as-
Stop and Wait Protocol-
It works under the following assumptions-
Communication channel is perfect.
No error occurs during transmission.
Working-
Analysis-
Now, let us analyze in depth how the transmission is actually carried out-
Sender puts the data packet on the transmission link.
Data packet propagates towards the receiver’s end.
Data packet reaches the receiver and waits in its buffer.
Receiver processes the data packet.
Receiver puts the acknowledgement on the transmission link.
Acknowledgement propagates towards the sender’s end.
Acknowledgement reaches the sender and waits in its buffer.
Sender processes the acknowledgement.
These steps are illustrated below-
otal Time-
Assume-
Queuing delay and processing delay to be zero at both sender and receiver side.
Transmission time for the acknowledgement to be zero since it’s size is very small.
Under the above assumptions.
We know,
Propagation delay depends on the distance and speed.
So, it would be same for both data packet and acknowledgement.
So, we have-
Efficiency-
Efficiency of any flow control control protocol is given by-
where-
Useful time = Transmission delay of data packet = (Transmission delay)packet
Useless time = Time for which sender is forced to wait and do nothing = 2 x Propagation
delay
Total time = Useful time + Useless time
Thus,
Advantages-
The advantages of stop and wait protocol are-
It is very simple to implement.
The incoming packet from receiver is always an acknowledgement.
Limitations-
The limitations of stop and wait protocol are-
Point-01:
It is extremely inefficient because-
It makes the transmission process extremely slow.
It does not use the bandwidth entirely as each single packet and acknowledgement uses
the entire time to traverse the link.
Point-02:
If the data packet sent by the sender gets lost, then-
Sender will keep waiting for the acknowledgement for infinite time.
Receiver will keep waiting for the data packet for infinite time.
Point-03:
Number of Sequence Numbers Required-
Number of Sequence Numbers Required-
NOTE
For any sliding window protocol to work without any problem,
the following condition must be satisfied-
Available Sequence Numbers >= Sender Window Size + Receiver Window Size
Stop and wait ARQ is a one bit sliding window protocol where-
Sender window size = 1
Receiver window size = 1
Thus, in stop and wait ARQ,
Minimum number of sequence numbers required
= Sender Window Size + Receiver Window Size
=1+1
=2
Thus,
Minimum number of sequence numbers required in Stop and Wait ARQ = 2.
The two sequence numbers used are 0 and 1.
How Stop and Wait ARQ Solves All Problems?
1. Problem of Lost Data Packet-
Time out timer helps to solve the problem of lost data packet.
After sending a data packet to the receiver, sender starts the time out timer.
If the data packet gets acknowledged before the timer expires, sender stops the time out
timer.
If the timer goes off before receiving the acknowledgement, sender retransmits the same
data packet.
After retransmission, sender resets the timer.
This prevents the occurrence of deadlock.
It assumes that the communication channel is It assumes that the communication channel is
perfect and noise free. imperfect and noisy.
Limitation of Stop and Wait ARQ-
The major limitation of Stop and Wait ARQ is its very less efficiency.
To increase the efficiency, protocols like Go back N and Selective Repeat are used.
Explanation-
In stop and wait ARQ,
Sender window size is 1.
This allows the sender to keep only one frame unacknowledged.
So, sender sends one frame and then waits until the sent frame gets acknowledged.
After receiving the acknowledgement from the receiver, sender sends the next frame.
The major limitation of Stop and Wait ARQ is its very less efficiency.
To increase the efficiency, protocols like Go back N and Selective Repeat are used.
Explanation-
In stop and wait ARQ,
Sender window size is 1.
This allows the sender to keep only one frame unacknowledged.
So, sender sends one frame and then waits until the sent frame gets acknowledged.
After receiving the acknowledgement from the receiver, sender sends the next frame.
Here,
Sender uses Tt time for transmitting the packet over the link.
Then, sender waits for 2 x Tp time.
After 2 x Tp time, sender receives the acknowledgement for the sent frame from the
receiver.
Then, sender sends the next frame.
This 2 x Tp waiting time is the actual cause of less efficiency.
Efficiency Improvement-
The efficiency of stop and wait ARQ can be improved by increasing the window size.
This allows the sender to keep more than one unacknowledged frame in its window.
Thus, sender can send frames in the waiting time too.
Th
This gives rise to the concept of sliding window protocols.
PRACTICE PROBLEMS BASED ON STOP AND WAIT PROTOCOL-
Problem-01:
If the bandwidth of the line is 1.5 Mbps, RTT is 45 msec and packet size is 1 KB, then find the
link utilization in stop and wait.
Solution-
Given-
Bandwidth = 1.5 Mbps
RTT = 45 msec
Packet size = 1 KB
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 1 KB / 1.5 Mbps
= (210 x 8 bits) / (1.5 x 106 bits per sec)
= 5.461 msec
Calculating Propagation Delay-
Propagation delay (Tp)
= Round Trip Time / 2
= 45 msec / 2
= 22.5 msec
Calculating Value Of ‘a’-
a = Tp / Tt
a = 22.5 msec / 5.461 msec
a = 4.12
Calculating Link Utilization-
Link Utilization or Efficiency (η)
= 1 / 1+2a
= 1 / (1 + 2 x 4.12)
= 1 / 9.24
= 0.108
= 10.8 %
Problem-02:
A channel has a bit rate of 4 Kbps and one way propagation delay of 20 msec. The channel uses
stop and wait protocol. The transmission time of the acknowledgement frame is negligible. To
get a channel efficiency of at least 50%, the minimum frame size should be-
1. 80 bytes
2. 80 bits
3. 160 bytes
4. 160 bits
Solution-
Given-
Bandwidth = 4 Kbps
Propagation delay (Tp) = 20 msec
Efficiency >= 50%
Let the required frame size = L bits.
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= L bits / 4 Kbps
Calculating Value Of ‘a’-
a = Tp / Tt
a = 20 msec / ( L bits / 4 Kbps)
a = (20 msec x 4 Kbps) / L bits
Condition For Efficiency To Be At least 50%-
For efficiency to be at least 50%, we must have-
1 / 1+2a >= 1/2
a <= 1/2
Substituting the value of ‘a’, we get-
(20 msec x 4 Kbps) / L bits <= 1/2
L bits >= (20 msec x 4 Kbps) x 2
L bits >= (20 x 10-3 sec x 4 x 103 bits per sec) x 2
L bits >= 20 x 4 bits x 2
L >= 160
From here, frame size must be at least 160 bits.
Thus, Correct Option is (D).
Problem-03:
What is the throughput achievable in stop and wait protocol by a maximum packet size of 1000
bytes and network span of 10 km.
Assume the speed of light in cable is 70% of the speed of light in vaccum.
Solution-
We have-
In the given question, we are not provided with the network’s bandwidth.
So, in the above formula of throughput, we have ignored the term Tt from the
denominator.
Although it is incorrect, but we still ignore it for solving the question.
Now, Given-
L = 1000 bytes
d = 10 km = 104 m
v = 70% of 3 x 108 m/sec = 2.1 x 108 m/sec
Substituting the values in the above relation, we get-
Throughput
= 1000 bytes / [ 2 x 104 m / (2.1 x 108 m/sec)]
= 1.05 x 107 bytes per sec
= 10.5 MBps
Problem-04:
If the packet size is 1 KB and propagation time is 15 msec, the channel capacity is 109 b/sec, then
find the transmission time and utilization of sender in stop and wait protocol.
Solution-
Given-
Packet size = 1 KB
Propagation time (Tp) = 15 msec
Channel capacity = Bandwidth (here) = 109 b/sec
NOTE-
Generally, channel capacity is the total number of bits which a channel can hold. So, its
unit is bits.
But here, channel capacity is actually given as bandwidth because its unit is b/sec.
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 1 KB / 109 bits per sec
= 210 bits / 109 bits per sec
= 1.024 μsec
Calculating Value Of ‘a’-
a = Tp / Tt
a = 15 msec / 1.024 μsec
a = 15000 μsec / 1.024 μsec
a = 14648.46
Calculating Sender Utilization-
Sender Utilization or Efficiency (η)
= 1 / 1+2a
= 1 / (1 + 2 x 1468.46)
= 1 / 29297.92
= 0.0000341
= 0.00341 %
Problem-05:
Consider a MAN with average source and destination 20 Km apart and one way delay of 100
μsec. At what data rate does the round trip delay equals the transmission delay for a 1 KB
packet?
Solution-
Given-
Distance = 20 Km
Propagation delay (Tp) = 100 μsec
Packet size = 1 KB
We need to have-
Round Trip Time = Transmission delay
2 x Propagation delay = Transmission delay
Substituting the values in the above relation, we get-
2 x 100 μsec = 1 KB / Bandwidth
Bandwidth = 1 KB / 200 μsec
Bandwidth = (210 x 106 / 200 ) bytes per sec
Bandwidth = 5.12 MBps or 40.96 Mbps
Problem-06:
Consider two hosts X and Y connected by a single direct link of rate 106 bits/sec. The distance
between the two hosts is 10,000 km and the propagation speed along the link is 2 x 108 m/sec.
Host X sends a file of 50,000 bytes as one large message to host Y continuously. Let the
transmission and propagation delays be p milliseconds and q milliseconds respectively.
Then the value of p and q are-
1. p = 50 and q = 100
2. p = 50 and q = 400
3. p = 100 and q = 50
4. p = 400 and q = 50
Solution-
Given-
Bandwidth = 106 bits/sec
Distance = 10,000 km
Propagation speed = 2 x 108 m/sec
Packet size = 50,000 bytes
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 50000 bytes / 106 bits per sec
= (5 x 104 x 8 bits) / 106 bits per sec
= ( 4 x 105 bits ) / 106 bits per sec
= 0.4 sec
= 400 msec
Calculating Propagation Delay-
Propagation delay (Tp)
= Distance / Propagation speed
= 10000 km / (2 x 108 m/sec)
= 107 m / (2 x 108 m/sec)
= 50 msec
Thus, Option (D) is correct.
Problem-07:
The values of parameters for the stop and wait ARQ protocol are as given below-
Bit rate of the transmission channel = 1 Mbps
Propagation delay from sender to receiver = 0.75 ms
Time to process a frame = 0.25 ms
Number of bytes in the information frame = 1980
Number of bytes in the acknowledge frame = 20
Number of overhead bytes in the information frame = 20
Assume that there are no transmission errors. Then the transmission efficiency (in %) of the stop
and wait ARQ protocol for the above parameters is ___________ . (correct to 2 decimal places)
Solution-
Problem-07:
The values of parameters for the stop and wait ARQ protocol are as given below-
Bit rate of the transmission channel = 1 Mbps
Propagation delay from sender to receiver = 0.75 ms
Time to process a frame = 0.25 ms
Number of bytes in the information frame = 1980
Number of bytes in the acknowledge frame = 20
Number of overhead bytes in the information frame = 20
Assume that there are no transmission errors. Then the transmission efficiency (in %) of the stop
and wait ARQ protocol for the above parameters is ___________ . (correct to 2 decimal places)
Solution-
Calculating Total Time-
Total time
= Transmission delay of data frame + Propagation delay of data frame + Processing delay of data
frame + Transmission delay of acknowledgement + Propagation delay of acknowledgement
= (1980 bytes / 1 Mbps) + 0.75 msec + 0.25 msec + (20 bytes / 1 Mbps) + 0.75 msec
= 15.840 msec + 0.75 msec + 0.25 msec + 0.160 msec + 0.75 msec
= 17.75 msec
Calculating Efficiency-
Efficiency (η)
= Useful time / Total time
= 15.680 msec / 17.75 msec
= 0.8833
= 88.33%
Problem-08:
A sender uses the stop and wait ARQ protocol for reliable transmission of frames. Frames are of
size 1000 bytes and the transmission rate at the sender is 80 Kbps. Size of an acknowledgement
is 100 bytes and the transmission rate at the receiver is 8 Kbps. The one way propagation delay is
100 msec.
Assuming no frame is lost, the sender throughput is __________ bytes/sec.
Solution-
Given-
Frame size = 1000 bytes
Sender bandwidth = 80 Kbps
Acknowledgement size = 100 bytes
Receiver bandwidth = 8 Kbps
Propagation delay (Tp) = 100 msec
Calculating Transmission Delay Of Data Frame-
Transmission delay (Tt)
= Frame size / Sender bandwidth
= 1000 bytes / 80 Kbps
= (1000 x 8 bits) / (80 x 103 bits per sec)
= 0.1 sec
= 100 msec
Calculating Transmission Delay Of Acknowledgement-
Transmission delay (Tt)
= Acknowledgement size / Receiver bandwidth
= 100 bytes / 8 Kbps
= (100 x 8 bits) / (8 x 103 bits per sec)
= 100 msec
Calculating Useful Time-
Useful Time
= Transmission delay of data frame
= 100 msec
Calculating Total Time-
Total Time
= Transmission delay of data frame + Propagation delay of data frame + Transmission delay of
acknowledgement + Propagation delay of acknowledgement
= 100 msec + 100 msec + 100 msec + 100 msec
= 400 msec
Calculating Efficiency-
Efficiency (η)
= Useful time / Total time
= 100 msec / 400 msec
=1/4
= 25%
Calculating Sender Throughput-
Sender throughput
= Efficiency (η) x Sender bandwidth
= 0.25 x 80 Kbps
= 20 Kbps
= (20 x 1000 / 8) bytes per sec
= 2500 bytes/sec
Problem-09:
Using stop and wait protocol, sender wants to transmit 10 data packets to the receiver. Out of
these 10 data packets, every 4th data packet is lost. How many packets sender will have to send
in total?
Solution-
Optimal Window Size-
In a sliding window protocol, optimal sender window size = 1 + 2a
Derivation-
We know,
NOTE-
When minimum number of bits is asked, we take the ceil.
When maximum number of bits is asked, we take the floor.
Choosing a Window Size-
The size of the sender’s window is bounded by-
1. Receiver’s Ability-
Receiver’s ability to process the data bounds the sender window size.
If receiver can not process the data fast, sender has to slow down and not transmit the
frames too fast.
2. Sequence Number Field-
Number of bits available in the sequence number field also bounds the sender window
size.
If sequence number field contains n bits, then 2n sequence numbers are possible.
Thus, maximum number of frames that can be sent in one window = 2n.
For n bits in sequence number field, Sender Window Size = min (1+2a , 2n)
Implementations of Sliding Window Protocol-
The two well known implementations of sliding window protocol are-
1. Go back N Protocol
2. Selective Repeat Protocol
Efficiency-
Efficiency of any flow control protocol may be expressed as-
Example-
In Stop and Wait ARQ, sender window size = 1.
Thus,
Efficiency of Stop and Wait ARQ = 1 / 1+2a
PRACTICE PROBLEMS BASED ON SLIDING WINDOW PROTOCOL-
Problem-01:
If transmission delay and propagation delay in a sliding window protocol are 1 msec and 49.5
msec respectively, then-
1. What should be the sender window size to get the maximum efficiency?
2. What is the minimum number of bits required in the sequence number field?
3. If only 6 bits are reserved for sequence numbers, then what will be the efficiency?
Solution-
Given-
Transmission delay = 1 msec
Propagation delay = 49.5 msec
Part-01:
To get the maximum efficiency, sender window size
= 1 + 2a
= 1 + 2 x (Tp / Tt)
= 1 + 2 x (49.5 msec / 1 msec)
= 1 + 2 x 49.5
= 100
Thus,
For maximum efficiency, sender window size = 100
Part-02:
Minimum number of bits required in the sequence number field
= ⌈log2(1+2a)⌉
= ⌈log2(100)⌉
= ⌈6.8⌉
=7
Thus,
Minimum number of bits required in the sequence number field = 7
Part-03:
If only 6 bits are reserved in the sequence number field, then-
Maximum sequence numbers possible = 26 = 64
Now,
Efficiency
= Sender window size in the protocol / Optimal sender window size
= 64 / 100
= 0.64
= 64%
Problem-02:
If transmission delay and propagation delay in a sliding window protocol are 1 msec and 99.5
msec respectively, then-
1. What should be the sender window size to get the maximum efficiency?
2. What is the minimum number of bits required in the sequence number field?
3. If only 7 bits are reserved for sequence numbers, then what will be the efficiency?
Solution-
Given-
Transmission delay = 1 msec
Propagation delay = 99.5 msec
Part-01:
To get the maximum efficiency, sender window size
= 1 + 2a
= 1 + 2 x (Tp / Tt)
= 1 + 2 x (99.5 msec / 1 msec)
= 1 + 2 x 99.5
= 200
Thus,
For maximum efficiency, sender window size = 200
Part-02:
Minimum number of bits required in the sequence number field
= ⌈log2(1+2a)⌉
= ⌈log2(200)⌉
= ⌈7.64⌉
=8
Thus,
Minimum number of bits required in the sequence number field = 8
Part-03:
If only 6 bits are reserved in the sequence number field, then-
Maximum sequence numbers possible = 27 = 128
Now,
Efficiency
= Sender window size in the protocol / Optimal sender window size
= 128 / 200
= 0.64
= 64%
PRACTICE PROBLEMS BASED ON SLIDING WINDOW PROTOCOL-
Problem-01:
A 3000 km long trunk operates at 1.536 Mbps and is used to transmit 64 byte frames and uses
sliding window protocol. If the propagation speed is 6 μsec / km, how many bits should the
sequence number field be?
Solution-
Given-
Distance = 3000 km
Bandwidth = 1.536 Mbps
Packet size = 64 bytes
Propagation speed = 6 μsec / km
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 64 bytes / 1.536 Mbps
= (64 x 8 bits) / (1.536 x 106 bits per sec)
= 333.33 μsec
Calculating Propagation Delay-
For 1 km, propagation delay = 6 μsec
For 3000 km, propagation delay = 3000 x 6 μsec = 18000 μsec
Calculating Value Of ‘a’-
a = Tp / Tt
a = 18000 μsec / 333.33 μsec
a = 54
Calculating Bits Required in Sequence Number Field-
Bits required in sequence number field
= ⌈log2(1+2a)⌉
= ⌈log2(1 + 2 x 54)⌉
= ⌈log2(109)⌉
= ⌈6.76⌉
= 7 bits
Thus,
Minimum number of bits required in sequence number field = 7
With 7 bits, number of sequence numbers possible = 128
We use only (1+2a) = 109 sequence numbers and rest remains unused.
Problem-02:
Compute approximate optimal window size when packet size is 53 bytes, RTT is 60 msec and
bottleneck bandwidth is 155 Mbps.
Solution-
Given-
Packet size = 53 bytes
RTT = 60 msec
Bandwidth = 155 Mbps
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 53 bytes / 155 Mbps
= (53 x 8 bits) / (155 x 106 bits per sec)
= 2.735 μsec
Calculating Propagation Delay-
Propagation delay (Tp)
= Round Trip Time / 2
= 60 msec / 2
= 30 msec
Calculating Value of ‘a’-
a = Tp / Tt
a = 30 msec / 2.735 μsec
a = 10968.921
Calculating Optimal Window Size-
Optimal window size
= 1 + 2a
= 1 + 2 x 10968.921
= 21938.84
Thus, approximate optimal window size = 21938 frames.
Problem-03:
A sliding window protocol is designed for a 1 Mbps point to point link to the moon which has a
one way latency (delay) of 1.25 sec. Assuming that each frame carries 1 KB of data, what is the
minimum number of bits needed for the sequence number?
Solution-
Given-
Bandwidth = 1 Mbps
Propagation delay (Tp) = 1.25 sec
Packet size = 1 KB
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 1 KB / 1 Mbps
= (210 x 8 bits) / (106 bits per sec)
= 8.192 msec
Calculating Value of ‘a’-
a = Tp / Tt
a = 1.25 sec / 8.192 msec
a = 152.59
Calculating Bits Required in Sequence Number Field-
Bits required in sequence number field
= ⌈log2(1+2a)⌉
= ⌈log2(1 + 2 x 152.59)⌉
= ⌈log2(306.176)⌉
= ⌈8.25⌉
= 9 bits
Thus,
Minimum number of bits required in sequence number field = 9
With 9 bits, number of sequence numbers possible = 512.
We use only (1+2a) sequence numbers and rest remains unused.
Problem-04:
Host A is sending data to host B over a full duplex link. A and B are using the sliding window
protocol for flow control. The send and receive window sizes are 5 packets each. Data packets
(sent only from A to B) are all 1000 bytes long and the transmission time for such a packet is 50
μs. Acknowledgement packets (sent only from B to A) are very small and require negligible
transmission time. The propagation delay over the link is 200 μs. What is the maximum
achievable throughput in this communication?
1. 7.69 x 106 Bps
2. 11.11 x 106 Bps
3. 12.33 x 106 Bps
4. 15.00 x 106 Bps
Solution-
Given-
Sender window size = Receiver window size = 5
Packet size = 1000 bytes
Transmission delay (Tt) = 50 μs
Propagation delay (Tp) = 200 μs
Calculating Bandwidth-
We know,
Transmission delay = Packet size / Bandwidth
So, Bandwidth
= Packet Size / Transmission delay (Tt)
= 1000 bytes / 50 μs
= (1000 x 8 bits) / (50 x 10-6 sec)
= 160 Mbps
Calculating Value of ‘a’-
a = Tp / Tt
a = 200 μsec / 50 μsec
a=4
Calculating Optimal Window Size-
Optimal window size
= 1 + 2a
=1+2x4
=9
Calculating Efficiency-
Efficiency (η)
= Sender window size / Optimal window size
=5/9
= 0.5555
= 55.55%
Calculating Maximum Achievable Throughput-
Maximum achievable throughput
= Efficiency (η) x Bandwidth
= 0.5555 x 160 Mbps
= 88.88 Mbps
= 88.88 x 106 bps or 11.11 x 106 Bps
Thus, Option (B) is correct.
Problem-05:
Station A uses 32 byte packets to transmit messages to station B using a sliding window
protocol. The round trip delay between A and B is 80 msec and the bottleneck bandwidth on the
path between A and B is 128 Kbps. What is the optimal window size that A should use?
1. 20
2. 40
3. 160
4. 320
Solution-
Given-
Packet size = 32 bytes
Round Trip Time = 80 msec
Bandwidth = 128 Kbps
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 32 bytes / 128 Kbps
= (32 x 8 bits) / (128 x 103 bits per sec)
= 2 msec
Calculating Propagation Delay-
Propagation delay (Tp)
= Round Trip Time / 2
= 80 msec / 2
= 40 msec
Calculating Value of ‘a’-
a = Tp / Tt
a = 40 msec / 2 msec
a = 20
Calculating Optimal Window Size-
Optimal window size
= 1 + 2a
= 1 + 2 x 20
= 41 which is close to option (B)
Thus, Option (B) is correct.
Sliding Window Protocol-
Before you go through this article, make sure that you have gone through the previous article
on Sliding Window Protocol.
The two well known implementations of sliding window protocol are-
1. Go back N Protocol
2. Selective Repeat Protocol
Go and Back N protocol
Go back N protocol is an implementation of sliding window protocol
Point-01:
In Go back N,
Sender window size = N. Example in Go back 10, sender window size will be 10.
Receiver window size is always 1 for any value of N.
Point-02:
In Go back N,
Receiver maintains an acknowledgement timer.
Each time the receiver receives a new frame, it starts a new acknowledgement timer.
After the timer expires, receiver sends the cumulative acknowledgement for all the
frames that are unacknowledged at that moment.
NOTE-
A new acknowledgement timer does not start after the expiry of old acknowledgement
timer.
It starts after a new frame is received.
Point-03:
The above point does not mean that Go back N can not use independent
acknowledgements.
Go back N may use independent acknowledgements too if required.
The kind of acknowledgement used depends on the expiry of acknowledgement timer.
Example-
Consider after the expiry of acknowledgement timer, there is only one frame left to be
acknowledged.
Then, Go back N sends the independent acknowledgement for that frame.
Point-04:
Go back N does not accept the corrupted frames and silently discards them.
In Go back N,
If receiver receives a frame that is corrupted, then it silently discards that frame.
The correct frame is retransmitted by the sender after the time out timer expires.
Silently discarding a frame means-
“Simply rejecting the frame and not taking any action”
Point-05:
Go back N does not accept out of order frames and silently discards them.
In Go back N,
If receiver receives a frame whose sequence number is not what the receiver expects,
then it silently discards that frame.
All the following frames are also discarded.
This is because receiver window size is 1 and therefore receiver can not accept out of
order frames.
Point-06:
Go back N leads to retransmission of entire window if for any frame, no ACK is received by the
sender.
In Go back N,
Receiver silently discards the frame if it founds the frame to be either corrupted or out of
order.
It does not send any acknowledgement for such frame.
It silently discards the following frames too.
Thus,
If for any particular frame, sender does not receive any acknowledgement, then it
understands that along with that frame, all the following frames must also have been discarded
by the receiver.
So, sender has to retransmit all the following frames too along with that particular frame.
Thus, it leads to the retransmission of entire window.
That is why, the protocol has been named as “Go back N“.
Point-07:
Go back N leads to retransmission of lost frames after expiry of time out timer.
In Go back N,
Consider a frame being sent to the receiver is lost on the way.
Then, it is retransmitted only after time out timer expires for that frame at sender’s side.
Efficiency of Go back N-
Efficiency of any flow control protocol is given by-
In Go back N protocol, sender window size = N.
Thus,
PRACTICE PROBLEMS BASED ON GO BACK N PROTOCOL-
Problem-01:
A 20 Kbps satellite link has a propagation delay of 400 ms.The transmitter employs the “go back
n ARQ” scheme with n set to 10.
Assuming that each frame is 100 bytes long, what is the maximum data rate possible?
1. 5 Kbps
2. 10 Kbps
3. 15 Kbps
4. 20 Kbps
Solution-
Given-
Bandwidth = 20 Kbps
Propagation delay (Tp) = 400 ms
Frame size = 100 bytes
Go back N is used where N = 10
Calculating Transmission Delay-
Transmission delay (Tt)
= Frame size / Bandwidth
= 100 bytes / 20 Kbps
= (100 x 8 bits) / (20 x 103 bits per sec)
= 0.04 sec
= 40 msec
Calculating Value Of ‘a’-
a = Tp / Tt
a = 400 msec / 40 msec
a = 10
Calculating Efficiency-
Efficiency (η)
= N / (1+2a)
= 10 / (1 + 2 x 10)
= 10 / 21
= 0.476
= 47.6 %
Calculating Maximum Data Rate Possible-
Maximum data rate possible or Throughput
= Efficiency x Bandwidth
= 0.476 x 20 Kbps
= 9.52 Kbps
≅ 10 Kbps
Thus, Correct Option is (B)
Problem-02:
Consider the Go back N protocol with a sender’s window size of ‘n’. Suppose that at time ‘t’, the
next inorder packet the receiver is expecting has a sequence number of ‘K’. Assume that the
medium does not reorder messages.
Answer the following questions-
Part-01:
What are the possible sets of sequence numbers inside the sender’s window at time ‘t’. Assume
the sender has already received the ACKs.
1. [K-1, K+n-1]
2. [K, K+n-1]
3. [K, K+n]
4. [K+n, K-1]
Part-02:
If acknowledgements are still on their way to sender, what are all possible values of the ACK
field in the messages currently propagating back to the sender at a time ‘t’?
1. [K-n, K-1]
2. [K-1, K-n]
3. [K, K-n]
4. [K-n, K+1]
Solution-
Part-01:
In Go back N protocol, the receiver window size is 1.
It is given that receiver expects the packet having sequence number ‘K’.
It means it has processed all the packets ranging from 0 to K-1.
It is given that sender has received the acknowledgement for all these packets.
So, outstanding packets in sender’s window waiting for the acknowledgement starts from
K.
Sender window size = n.
Therefore, last packet in sender’s window will have sequence number K+n-1.
Thus, Option (B) is correct.
Part-02:
Acknowledgement number is the next expected sequence number by the receiver.
Receiver expects the packet having sequence number ‘K’ at time ‘t’.
It means it has received the packets ranging from 0 to K-1 whose acknowledgements are
are on the way.
For the (K-1)th packet, acknowledgement number would be ‘K’.
For the (K-2)th packet, acknowledgement number would be ‘K-1’ and so on.
Now,
At any time, maximum number of outstanding packets can be ‘n’.
This is because sender’s window size is ‘n’.
Therefore, the possible values of acknowledgement number ranges from [K-n+1, ……,
K-3, K-2, K-1, K] (total n values)
Here, we have assumed that the acknowledgement for all the packets are sent
independently.
Thus, Option (C) is correct.
Problem-03:
Station A needs to send a message consisting of 9 packets to station B using a sliding window
(window size 3) and go back n error control strategy. All packets are ready and immediately
available for transmission.
If every 5th packet that A transmits gets lost (but no ACKs from B ever get lost), then what is the
number of packets that A will transmit for sending the message to B?
1. 12
2. 14
3. 16
4. 18
Solution-
Given-
Total number of packets to be sent = 9
Go back N is used where N = 3
Every 5th packet gets lost
Step-01:
ince sender window size is 3, so sender sends 3 packets (1, 2, 3)-
In SR protocol,
Sender window size = Receiver window size
The size is of course greater than 1 otherwise the protocol will become Stop and Wait
ARQ.
If n bits are available for sequence numbers, then-
Sender window size = Receiver window size = 2n/2 = 2n-1
Point-02:
In SR protocol,
Receiver acknowledges each frame independently.
As receiver receives a new frame from the sender, it sends its acknowledgement.
Point-03:
SR protocol does not accept the corrupted frames but does not silently discard them.
In SR protocol,
If receiver receives a frame that is corrupted, then it does not silently discard that frame.
Receiver handles the situation efficiently by sending a negative acknowledgement
(NACK).
Negative acknowledgement allows early retransmission of the corrupted frame.
It also avoids waiting for the time out timer to expire at the sender side to retransmit the
frame.
Point-05:
SR protocol accepts the out of order frames.
In SR protocol,
Consider receiver receives a frame whose sequence number is not what the receiver
expects.
Then, it does not discard that frame rather accepts it and keeps it in its window.
Point-06:
In SR protocol,
Receiver window is implemented as a linked list.
When receiver receives a new frame, it places the new frame at the end of the linked list.
When the received frames are out of order, receiver performs the sorting.
Sorting sorts the frames in the correct order.
Point-07:
In SR protocol,
Receiver does not reject the out of order frames.
Receiver accepts the out of order frames and sort them later.
Thus, only the missing frame has to be sent by the sender.
For sending the missing frame, sender performs searching and finds the missing frame.
Then, sender selectively repeats that frame.
Thus, only the selected frame is repeated and not the entire window.
That is why, the protocol has been named as “Selective Repeat Protocol“.
Point-08:
SR protocol leads to retransmission of lost frames after expiry of time out timer.
In SR protocol,
Consider a frame being sent to the receiver is lost on the way.
Then, it is retransmitted only after time out timer expires for that frame at sender’s side.
Efficiency of SR Protocol-
Efficiency of any flow control protocol is given by-
In selective repeat protocol, if sender window size = N, then-
PRACTICE PROBLEMS BASED ON SELECTIVE REPEAT PROTOCOL-
Problem-01:
The maximum window size for data transmission using the selective repeat protocol with n bit
frame sequence numbers is-
1. 2n
2. 2n-1
3. 2n-1
4. 2n-2
Solution-
We know-
With n bits, total number of sequence numbers possible = 2n.
In SR Protocol, sender window size = receiver window size = W (say)
For any sliding window protocol to work without any problems,
So, we have-
2n = W + W
2n = 2W
W = 2n-1
Therefore, maximum window size possible of sender and receiver = 2n-1
Thus, Option (B) is correct.
Problem-02:
In SR protocol, suppose frames through 0 to 4 have been transmitted. Now, imagine that 0 times
out, 5 (a new frame) is transmitted, 1 times out, 2 times out and 6 (another new frame) is
transmitted.
Problem-02:
In SR protocol, suppose frames through 0 to 4 have been transmitted. Now, imagine that 0 times
out, 5 (a new frame) is transmitted, 1 times out, 2 times out and 6 (another new frame) is
transmitted.
At this point, what will be the outstanding packets in sender’s window?
1. 341526
2. 3405126
3. 0123456
4. 654321
Solution-
In SR Protocol, only the required frame is retransmitted and not the entire window.
Step-01:
Frames through 0 to 4 have been transmitted-
4,3,2,1,0
Step-02:
0 times out. So, sender retransmits it-
0,4,3,2,1
Step-03:
5 (a new frame) is transmitted-
5,0,4,3,2,1
Step-04:
1 times out. So, sender retransmits it-
1,5,0,4,3,2
Step-05:
2 times out. So, sender retransmits it-
2,1,5,0,4,3
Step-06:
6 (another new frame) is transmitted-
6,2,1,5,0,4,3
Thus, Option (B) is correct.
Problem-03:
The selective repeat protocol is similar to Go back N except in the following way-
1. Frame Formats are similar in both the protocols
2. The sender has a window defining maximum number of outstanding frames in both the
protocols
3. Both uses piggybacked acknowledgements where possible and does not acknowledge
every frame explicitly.
4. Both uses piggyback approach that acknowledges the most recently received frame
Solution-
Also Read-Go back N Protocol
Option (A)-
Both the protocols use the same frame formats because both are sliding window
protocols.
The variation occurs only in the coding and implementation.
Option (B)-
In both the protocols, sender has a window which defines the maximum number of
outstanding frames.
Option (C)-
Both the protocols use piggybacked acknowledgements wherever possible.
Sending acknowledgements along with the data are called as piggybacked
acknowledgements.
But Go back N protocol uses cumulative acknowledgements and does not acknowledge
every frame explicitly.
On the other hand, Selective repeat protocol acknowledges each frame independently.
Option (D)-
Both the protocols use piggyback approach.
Go back N acknowledges the most recently received frame by sending a cumulative
acknowledgement which includes the acknowledgement for previous packets too if any.
On the other hand, Selective Repeat protocol acknowledges all the frames independently
and not only the recently received frame.
Thus, Options (C) and (D) are correct.
Problem-04:
Consider a 128 x 103 bits/sec satellited communication link with one way propagation delay of
150 msec. Selective Retransmission (repeat) protocol is used on this link to send data with a
frame size of 1 KB. Neglect the transmission time of acknowledgement. The minimum number
of bits required for the sequence number field to achieve 100% utilization is ________ .
Solution-
Given-
Bandwidth = 128 x 103 bits/sec
Propagation delay (Tp) = 150 msec
Frame size = 1 KB
Now,
To achieve 100% utilization, efficiency must be 100%.
Efficiency is 100% when sender window size is optimal i.e. 1+2a
Calculating Transmission Delay-
Transmission delay (Tt)
= Frame size / Bandwidth
= 1 KB / (128 x 103 bits per sec)
= (1 x 210 x 8 bits) / (128 x 103 bits per sec)
= 64 msec
Calculating Value of ‘a’-
a = Tp / Tt
a = 150 msec / 64 msec
a = 2.34
Calculating Optimal Sender Window Size-
Optimal sender window size
= 1 + 2a
= 1 + 2 x 2.34
= ⌈5.68⌉
=6
Calculating Number Of Sequence Numbers Required-
In SR Protocol, sender window size and receiver window size are same.
So, sender window size = receiver window size = 6
Now,
For any sliding window protocol, minimum number of sequence numbers required
= Sender window size + Receiver window size
=6+6
= 12
Calculating Bits Required in Sequence Number Field-
To have 12 sequence numbers,
Minimum number of bits required in sequence number field
= ⌈log2(12)⌉
=4
Thus,
Minimum number of bits required in sequence number field = 4
With 4 bits, number of sequence numbers possible = 16
We use only 12 sequence numbers and rest 4 remains unused.
Flow Control Protocols-
In computer networking, there are various flow control protocols-
Sliding Window Protocol-
Sliding window protocol allows the sender to send multiple frames before needing the
acknowledgements.
It is more efficient.
Read More-Sliding Window Protocol
Implementations-
Various implementations of sliding window protocol are-
1. Stop and Wait ARQ
2. Go back N
3. Selective Repeat
In this article, we will compare these sliding window protocols.
Comparison Table-
Go back N and
Selective Repeat
Efficiency 1 / (1+2a) N / (1+2a) N / (1+2a) gives better
efficiency than Stop
and Wait ARQ.
Buffer requirement
in Selective Repeat
Sender Window Sender Window Sender Window is very large.
Size = 1 Size = N Size = N If the system does
Window Size Receiver Window Receiver Window not have lots of
Receiver Window
Size = 1 Size = N memory, then it is
Size = 1
better to choose Go
back N.
Selective Repeat
Minimum number of requires large
sequence numbers 2 N+1 2xN number of bits in
required sequence number
field.
Selective Repeat is
Retransmissions Only the lost Only the lost far better than Go
The entire window
required if a packet is packet is packet is back N in terms of
is retransmitted
lost retransmitted retransmitted retransmissions
required.
Bandwidth
requirement is high
because even if a Selective Repeat is
single packet is lost,
Bandwidth Bandwidth better than Go back
Bandwidth entire window has
requirement is requirement is N in terms of
Requirement to be retransmitted.
Low moderate bandwidth
Thus, if error rate is requirement.
high, it wastes a lot
of bandwidth.
High due to
Go back N is better
searching and
than Selective
CPU usage Low Moderate sorting required at
Repeat in terms of
sender and
CPU usage.
receiver side
Go back N is better
Complex as it
than Selective
Level of difficulty in requires extra logic
Low Moderate Repeat in terms of
Implementation and sorting and
implementation
searching
difficulty.
Sending cumulative
Uses cumulative acknowledgements
acknowledgements reduces the traffic
Uses independent Uses independent
(but may use in the network but if
Acknowledgements acknowledgement acknowledgement
independent it is lost, then the
for each packet for each packet
acknowledgements ACKs for all the
as well) corresponding
packets are lost.
Go back N and
Selective Repeat are
Type of Transmission Half duplex Full duplex Full duplex
better in terms of
channel usage.
Conclusions-
Go back N is more often used than other protocols.
SR protocol is less used because of its complexity.
Stop and Wait ARQ is less used because of its low efficiency.
Depending on the context and resources availability, Go back N or Selective Repeat is
employed.
Selective Repeat and Stop and Wait ARQ are similar in terms of retransmissions.
Go back N and Selective Repeat are similar in terms of efficiency if sender window sizes
are same.
SR protocol may be considered as a combination of advantages of Stop and Wait ARQ
and Go back N.
SR protocol is superior to other protocols but because of its complexity, it is less used.
Important Notes-
Note-01:
Protocols at data link layer like HDLC (Low level protocols) use Go back N.
This is because-
1. Bandwidth is high
2. CPU is very busy doing routing job
3. Error rate is low since out of order packets are not possible in wired medium
Note-02:
Protocols at transport layer like TCP (High level protocols) use selective repeat.
PRACTICE PROBLEMS BASED ON SLIDING WINDOW PROTOCOLS-
Problem-01:
If the bandwidth between the sender and receiver is sufficient, CPU and buffers are moderate,
then which flow control protocol would you suggest to use?
Solution-
The suggested protocol would be Go back N.
Problem-02:
If the bandwidth between the sender and receiver is moderate, CPU and buffers are sufficient,
then which flow control protocol would you suggest to use?
Solution-
The suggested protocol would be Selective Repeat.
Flow Control Protocols-
In computer networking, there are various flow control protocols-
REMEMBER
If there are n packets to be transmitted and p is the probability of packet error, then-
Number of transmission attempts required
= n + np + np2 + np3 + …… + ∞
= n / (1-p)
Substituting the given values, we get-
Average number of transmission attempts required = 100 / (1-0.2) = 125.
Thus, Option (B) is correct.
Problem-03:
Compute the fraction of the bandwidth that is wasted on overhead (headers and retransmissions)
for a protocol on a heavily loaded 50 Kbps satellite channel with data frames consisting of 40
bits header and 3960 data bits. Assume that the signal propagation time from the earth to the
satellite is 270 msec. ACK frames never occur. NAK frames are 40 bits. The error rate for data
frames is 1% and the error rate for NAK frames is negligible.
1. 1.21 %
2. 2.12 %
3. 1.99 %
4. 1.71 %
Solution-
Consider 100 frames are being sent. Then, we have-
Useful Data Sent-
Since each frame contains 3960 data bits, so while sending 100 frames,
Useful data sent
= 100 x 3960 bits
= 396000 bits
Useless Data Sent / Overhead-
In general, overhead is due to headers, retransmissions and negative acknowledgements.
Now,
The error rate for data frames is 1%, therefore out of 100 sent frames, error occurs in one
frame.
This causes the negative acknowledgement to follow which causes the retransmission.
So, we have-
Overhead due to headers = 100 x 40 bits = 400 bits.
Overhead due to negative acknowledgement = 40 bits.
Overhead due to retransmission = 40 bits header + 3960 data bits = 4000 bits.
From here,
Total overhead
= 400 bits + 40 bits + 4000 bits
= 8040 bits
Calculating Efficiency-
Efficiency (η) = Useful data sent / Total data sent
Here,
Useful data sent = 396000 bits
Total data sent = Useful data sent + Overhead = 396000 bits + 8040 bits = 404040 bits
Substituting the values, we get-
Efficiency (η)
= 396000 bits / 404040 bits
= 0.9801
Calculating Bandwidth Utilization-
Bandwidth Utilization
= Efficiency x Bandwidth
= 0.9801 x 50 Kbps
= 49.005 Kbps
Calculating Bandwidth Wasted-
Bandwidth wasted
= Bandwidth – Bandwidth Utilization
= 50 Kbps – 49.005 Kbps
= 0.995 Kbps
Calculating Fraction of Bandwidth Wasted-
Fraction of bandwidth wasted
= Wasted Bandwidth / Total Available Bandwidth
= 0.995 Kbps / 50 Kbps
= 0.0199
= 1.99 %
Thus, Option (C) is correct.
Error Detection in Computer Networks-
When sender transmits data to the receiver, the data might get scrambled by noise or data might
get corrupted during the transmission.
Error detection is a technique that is used to check if any error occurred in the data during the
transmission.
Error Detection Methods-
Some popular error detection methods are-
1. Single Parity Check
2. Cyclic Redundancy Check (CRC)
3. Checksum
In this article, we will discuss about Single Parity Check.
Single Parity Check-
In this technique,
One extra bit called as parity bit is sent along with the original data bits.
Parity bit helps to check if any error occurred in the data during the transmission.
Steps Involved-
Error detection using single parity check involves the following steps-
Step-01:
At sender side,
Total number of 1’s in the data unit to be transmitted is counted.
The total number of 1’s in the data unit is made even in case of even parity.
The total number of 1’s in the data unit is made odd in case of odd parity.
This is done by adding an extra bit called as parity bit.
Step-02:
The newly formed code word (Original data + parity bit) is transmitted to the receiver.
Step-03:
At receiver side,
Receiver receives the transmitted code word.
The total number of 1’s in the received code word is counted.
Then, following cases are possible-
If total number of 1’s is even and even parity is used, then receiver assumes that no error
occurred.
If total number of 1’s is even and odd parity is used, then receiver assumes that error
occurred.
If total number of 1’s is odd and odd parity is used, then receiver assumes that no error
occurred.
If total number of 1’s is odd and even parity is used, then receiver assumes that error
occurred.
Parity Check Example-
Consider the data unit to be transmitted is 1001001 and even parity is used.
Then,
At Sender Side-
Total number of 1’s in the data unit is counted.
Total number of 1’s in the data unit = 3.
Clearly, even parity is used and total number of 1’s is odd.
So, parity bit = 1 is added to the data unit to make total number of 1’s even.
Then, the code word 10010011 is transmitted to the receiver.
At Receiver Side-
After receiving the code word, total number of 1’s in the code word is counted.
Consider receiver receives the correct code word = 10010011.
Even parity is used and total number of 1’s is even.
So, receiver assumes that no error occurred in the data during the transmission.
Advantage-
This technique is guaranteed to detect an odd number of bit errors (one, three, five and so
on).
If odd number of bits flip during transmission, then receiver can detect by counting the
number of 1’s.
Also Read-Checksum
Limitation-
This technique can not detect an even number of bit errors (two, four, six and so on).
If even number of bits flip during transmission, then receiver can not catch the error.
EXAMPLE
Consider the data unit to be transmitted is 10010001 and even parity is used.
Then, code word transmitted to the receiver = 100100011
Consider during transmission, code word modifies as 101100111. (2 bits flip)
On receiving the modified code word, receiver finds the number of 1’s is even and even parity
is used.
So, receiver assumes that no error occurred in the data during transmission though the data is
corrupted.
Error Detection in Computer Networks-
Error detection is a technique that is used to check if any error occurred in the data during the
transmission.
Some popular error detection methods are-
The power of each term gives the position of the bit and the coefficient gives the value of the bit.
Example-
Consider the CRC generator is x7 + x6 + x4 + x3 + x + 1.
The corresponding binary pattern is obtained as-
Thus, for the given CRC generator, the corresponding binary pattern is 11011011.
Properties Of CRC Generator-
The algebraic polynomial chosen as a CRC generator should have at least the following
properties-
Rule-01:
It should not be divisible by x.
This condition guarantees that all the burst errors of length equal to the length of
polynomial are detected.
Rule-02:
It should be divisible by x+1.
This condition guarantees that all the burst errors affecting an odd number of bits are
detected.
Important Notes-
If the CRC generator is chosen according to the above rules, then-
CRC can detect all single-bit errors
CRC can detect all double-bit errors provided the divisor contains at least three logic 1’s.
CRC can detect any odd number of errors provided the divisor is a factor of x+1.
CRC can detect all burst error of length less than the degree of the polynomial.
CRC can detect most of the larger burst errors with a high probability.
Steps Involved-
Error detection using CRC technique involves the following steps-
Step-01: Calculation Of CRC At Sender Side-
At sender side,
A string of n 0’s is appended to the data unit to be transmitted.
Here, n is one less than the number of bits in CRC generator.
Binary division is performed of the resultant string with the CRC generator.
After division, the remainder so obtained is called as CRC.
It may be noted that CRC also consists of n bits.
Step-02: Appending CRC To Data Unit-
At sender side,
The CRC is obtained after the binary division.
The string of n 0’s appended to the data unit earlier is replaced by the CRC remainder.
Step-03: Transmission To Receiver-
The newly formed code word (Original data + CRC) is transmitted to the receiver.
Step-04: Checking at Receiver Side-
At receiver side,
The transmitted code word is received.
The received code word is divided with the same CRC generator.
On division, the remainder so obtained is checked.
The following two cases are possible-
Case-01: Remainder = 0
If the remainder is zero,
Receiver assumes that no error occurred in the data during the transmission.
Receiver accepts the data.
Case-02: Remainder ≠ 0
If the remainder is non-zero,
Receiver assumes that some error occurred in the data during the transmission.
Receiver rejects the data and asks the sender for retransmission.
Also Read-Parity Check
PRACTICE PROBLEMS BASED ON CYCLIC REDUNDANCY CHECK (CRC)-
Problem-01:
A bit stream 1101011011 is transmitted using the standard CRC method. The generator
polynomial is x4+x+1. What is the actual bit string transmitted?
Solution-
The generator polynomial G(x) = x4 + x + 1 is encoded as 10011.
Clearly, the generator polynomial consists of 5 bits.
So, a string of 4 zeroes is appended to the bit stream to be transmitted.
The resulting bit stream is 11010110110000.
Now, the binary division is performed as-
Now, the binary division is performed as-
From here, CRC = 1110.
Now,
The code word to be transmitted is obtained by replacing the last 4 zeroes of
11010110110000 with the CRC.
Thus, the code word transmitted to the receiver = 11010110111110.
Problem-02:
A bit stream 10011101 is transmitted using the standard CRC method. The generator polynomial
is x3+1.
1. What is the actual bit string transmitted?
2. Suppose the third bit from the left is inverted during transmission. How will receiver
detect this error?
Solution-
Part-01:
The generator polynomial G(x) = x3 + 1 is encoded as 1001.
Clearly, the generator polynomial consists of 4 bits.
So, a string of 3 zeroes is appended to the bit stream to be transmitted.
The resulting bit stream is 10011101000.
Now, the binary division is performed as-
From here, CRC = 100.
Now,
The code word to be transmitted is obtained by replacing the last 3 zeroes of
10011101000 with the CRC.
Thus, the code word transmitted to the receiver = 10011101100.
Part-02:
According to the question,
Third bit from the left gets inverted during transmission.
So, the bit stream received by the receiver = 10111101100.
Now,
Receiver receives the bit stream = 10111101100.
Receiver performs the binary division with the same generator polynomial as-
From here,
The remainder obtained on division is a non-zero value.
This indicates to the receiver that an error occurred in the data during the transmission.
Therefore, receiver rejects the data and asks the sender for retransmission.
Error Detection in Computer Networks-
Error detection is a technique that is used to check if any error occurred in the data during the
transmission.
Some popular error detection methods are-
Now, all the segments are added and the result is obtained as-
10011001 + 11100010 + 00100100 + 10000100 = 1000100011
Since the result consists of 10 bits, so extra 2 bits are wrapped around.
00100011 + 10 = 00100101 (8 bits)
Now, 1’s complement is taken which is 11011010.
Thus, checksum value = 11011010
Step-02:
The data along with the checksum value is transmitted to the receiver.
Step-03:
At receiver side,
The received data unit is divided into segments of 8 bits.
All the segments along with the checksum value are added.
Sum of all segments + Checksum value = 00100101 + 11011010 = 11111111
Complemented value = 00000000
Since the result is 0, receiver assumes no error occurred in the data and therefore accepts
it.
Also Read-Parity Check
Important Notes-
Note-01:
Consider while adding the m bit segments, the result obtained consists of more than m
bits.
Then, wrap around the extra bits and add to the result so that checksum value consists of
m bits.
Note-02:
While calculating the checksum, if checksum value is needed, then assume it to be zero.
After calculating the checksum value, substitute the checksum value in the checksum
field.
This will be required during checksum calculation of IP Header, TCP Header and UDP
Header.
Note-03:
The checksum is used in the internet by several protocols although not at the data link
layer.
Also Read-Cyclic Redundancy Check (CRC)
PRACTICE PROBLEM BASED ON CHECKSUM ERROR DETECTION METHOD-
Problem-
Checksum value of 1001001110010011 and 1001100001001101 of 16 bit segment is-
1. 1010101000011111
2. 1011111000100101
3. 1101010000011110
4. 1101010000111111
Solution-
We apply the above discussed algorithm to calculate the checksum.
1001001110010011 + 1001100001001101 = 10010101111100000
Since, the result consists of 17 bits, so 1 bit is wrapped around and added to the result.
0010101111100000 + 1 = 0010101111100001
Now, result consists of 16 bits.
Now, 1’s complement is taken which is 1101010000011110
Thus, checksum value = 1101010000011110
Types of Communication Links-
In computer networking,
Communication links enable the stations to communicate with each other.
Stations may communicate using the following types of links-
2. Broadcast Link-
Broadcast link is a common link to which multiple stations are connected.
The capacity of the link is shared among the connected stations for transmission.
Example-
Access Control-
Access Control is a mechanism that controls the access of stations to the transmission link.
Broadcast links require the access control.
This is because the link is shared among several stations.
Need of Access Control-
To prevent the occurrence of collision or if the collision occurs, to deal with it.
Consider a situation where-
Multiple stations place their data packets on the link and starts transmitting
simultaneously.
Such a situation gives rise to a collision among the data packets.
Collision of data packets causes the data to get corrupt.
Example-
Consider the following scenario-
Here,
Two stations A and D starts transmitting their data packets simultaneously.
This situation gives rise to a collision between the data packets transmitted by them.
Thus, to prevent the collision or to deal with it, access control is needed.
Access Control Methods-
Access control methods are the methods used for providing access control.
They prevent the collision or deal with it and ensures smooth flow of traffic on the
network.
They are implemented at the data link layer of the OSI reference model.
Various access control methods used are-
where-
Tt = Transmission delay
Tp = Propagation delay
NOTE-
To keep the size of time slots constant,
We have assumed that all the stations want to send the packets of same size.
This keeps Tt constant for all the stations.
We have considered the worst case when both the stations are present at the two extreme
ends.
This ensures Tp will be maximum and all the stations will get sufficient time to propagate
their data.
Efficiency-
Useful time = Transmission delay of data packet = Tt
Useless time = Propagation delay of data packet = Tp
Thus,
Important Formulas-
Size of each time slot in Time Division Multiplexing = Tt + Tp
Efficiency (η) = 1 / (1+a) where a = Tp / Tt
Effective Bandwidth / Bandwidth Utilization / Throughput = Efficiency(η) x Bandwidth
Maximum Available Effective Bandwidth = Total number of stations x Bandwidth
requirement of 1 station
Disadvantage-
If any station does not have the data to send during its time slot, then its time slot goes
waste.
This reduces the efficiency.
This time slot could have been allotted to some other station willing to send data.
PRACTICE PROBLEM BASED ON TIME DIVISION MULTIPLEXING (TDM)-
Problem-
If transmission delay and propagation delay of a packet in Time Division Multiplexing is 1 msec
each at 4 Mbps bandwidth, then-
1. Find the efficiency.
2. Find the effective bandwidth.
3. How many maximum stations can be connected to the network if each station requires 2
Kbps bandwidth?
Solution-
Given-
Transmission delay (Tt) = 1msec
Propagation delay (Tp) = 1msec
Bandwidth = 4 Mbps
Part-01:
For a TDM Network,
Calculating Value Of ‘a’-
a = Tp / Tt
a = 1 msec / 1 msec
a=1
Calculating Efficiency-
Efficiency (η)
= 1 / (1+a)
= 1 / (1 + 1)
=1/2
= 0.5
= 50%
Part-02:
We know-
Thus,
Effective Bandwidth
= 0.5 x 4 Mbps
= 2 Mbps
Part-03:
We know-
et the total number of stations that can be connected be N.
Then, we have-
2 Mbps = N x 2 Kbps
N = 1000
Thus, maximum 1000 stations can be connected.
Polling-
In this access control method,
A polling is conducted in which all the stations willing to send data participates.
The polling algorithm chooses one of the stations to send the data.
The chosen station sends the data to the destination.
After the chosen station has sent the data, the cycle repeats.
Example-
Here-
Tpoll = Time taken for polling
Tsend = Time taken for sending the data = Transmission delay + Propagation delay = Tt +
Tp
Efficiency-
Useful time = Transmission delay of data packet = Tt
Useless time = Time wasted during polling + Propagation delay of data packet = Tpoll + Tp
Thus,
Thus,
Advantages-
Unlike in Time Division Multiplexing, no slot is ever wasted.
It leads to maximum efficiency and bandwidth utilization.
Disadvantages-
Time is wasted during polling.
Link sharing is not fair since each station has the equal probability of winning in each
round.
Few stations might starve for sending the data.
Important Formulas-
Efficiency (η) = Tt / (Tpoll + Tt + Tp)
Effective Bandwidth / Bandwidth Utilization / Throughput = Efficiency(η) x Bandwidth
Maximum Available Effective Bandwidth = Total number of stations x Bandwidth
requirement of 1 station
Access Control in Networking-
Before you go through this article, make sure that you have gone through the previous article
on Access Control.
We have discussed-
Access Control is a mechanism that controls the access of stations to the transmission
link.
Broadcast links require the access control mechanism.
There are various access control methods-
Meaning-
According to this condition,
Each station must transmit the data packet of size whose transmission delay is at least
twice its propagation delay.
If the size of data packet is smaller, then collision detection would not be possible.
Length Of Data Packet-
We know-
Transmission delay = Length of data packet (L) / Bandwidth (B)
Propagation delay = Distance between the two stations (D) / Propagation speed (V)
Substituting values in the above condition, we get-
L / B >= 2 x D / V
Thus,
L >= 2 x B x D / V
Understanding the Condition To Detect Collision With Example
Consider at time 10:00 am, station A senses the carrier.
It finds the carrier free and starts transmitting its data packet to station D.
Let the propagation delay be 1 hour.
(We are considering station D for the worst case)
Let us consider the scenario at time 10:59:59:59 when the packet is about to reach the station
D.
At this time, station D senses the carrier.
It finds the carrier free and starts transmitting its data packet.
Now, as soon as station D starts transmitting its data packet, a collision occurs with the data
packet of station A at time 11:00 am.
After collision occurs, the collided signal starts travelling in the backward direction.
The collided signal takes 1 hour to reach the station A after the collision has occurred.
For station A to detect the collided signal, it must be still transmitting the data.
So, transmission delay of station A must be >= 1 hour + 1 hour >= 2 hours to detect the
collision.
That is why, for detecting the collision, condition is Tt >= 2Tp.
Two cases are possible-
Case-01:
If no collided signal comes back during the transmission,
It indicates that no collision has occurred.
The data packet is transmitted successfully.
Case-02:
If the collided signal comes back during the transmission,
It indicates that the collision has occurred.
The data packet is not transmitted successfully.
Step-03 is followed.
Step-03: Releasing Jam Signal-
Jam signal is a 48 bit signal.
It is released by the transmitting stations as soon as they detect a collision.
It alerts the other stations not to transmit their data immediately after the collision.
Otherwise, there is a possibility of collision again with the same data packet.
Ethernet sends the jam signal at a frequency other than the frequency of data signals.
This ensures that jam signal does not collide with the data signals undergone collision.
Step-04: Waiting For Back Off Time-
After the collision, the transmitting station waits for some random amount of time called
as back off time.
After back off time, it tries transmitting the data packet again.
If again the collision occurs, then station again waits for some random back off time and
then tries again.
The station keeps trying until the back off time reaches its limit.
After the limit is reached, station aborts the transmission.
Back off time is calculated using Back Off Algorithm.
CSMA / CD Flowchart-
The following CSMA / CD flowchart represents the CSMA / CD procedure-
Efficiency-
Before a successful transmission,
There may occur many number of collisions.
2 x Tp time is wasted during each collision.
Thus,
Useful time = Transmission delay of data packet = Tt
Useless time = Time wasted during collisions + Propagation delay of data packet = c x 2
x Tp + Tp
Here, c = Number of contention slots / collision slots.
Thus,
Here,
c is a variable.
This is because number of collisions that might occur before a successful transmission
are variable.
Probabilistic Analysis shows-
Substituting c = e in the above relation, we get-
Probabilistic Analysis-
Let us perform the probabilistic analysis to find the average number of collisions before a
successful transmission.
Consider-
Number of stations connected to a CSMA / CD network = n
Probability of each station to transmit the data = p
Transmission will be successful only when-
One station transmits the data
Other (n-1) stations do not transmit the data.
Thus, Probability of successful transmission is given by-
Now, let us find the maximum value of Psuccessful transmission.
For maximum value, we put-
On solving,
Thus,
(Psuccessful transmission)max
= nC1 x 1/n x (1 – 1/n)n-1
= n x 1/n x (1 – 1/n)n-1
= (1 – 1/n)n-1
If there are sufficiently large number of stations i.e. n → ∞, then we have-
Number of times a station must try before successfully transmitting the data packet
= 1 / Pmax (Using Poisson’s distribution)
= 1 / (1/e)
=e
From here, we conclude-
Average number of collisions that might occur before a successful transmission = e
Important Notes-
Note-01:
CSMA / CD is used in wired LANs.
CSMA / CD is standardized in IEEE 802.3
Note-02:
CSMA / CD only minimizes the recovery time.
It does not take any steps to prevent the collision until it has taken place.
Important Formulas-
Condition to detect collision: Transmission delay >= 2 x Propagation delay
Minimum length of data packets in CSMA / CD = 2 x Bandwidth x Distance / Speed
Efficiency of CSMA / CD = 1 / (1 + 6.44 x a) where a = Tp / Tt
Probability of successful transmission = nC1 x p x (1-p)n-1
Average number of collisions before a successful transmission = e
CSMA / CD Protocol-
Before you go through this article, make sure that you have gone through the previous
article on CSMA / CD Protocol.
We have discussed-
After the occurrence of collision, station waits for some random back off time and
then retransmits.
This waiting time for which the station waits before retransmitting the data is called
as back off time.
Back Off Algorithm is used for calculating the back off time.
Transmitting station chooses a random number in the range [0, 2n-1] if the packet is
undergoing collision for the nth time.
If station chooses a number k, then-
Example-
Consider the following scenario where stations A and D start transmitting their data
simultaneously-
For simplicity,
At Station A-
After detecting the collision,
At Station D-
After detecting the collision,
KA KD Remarks
In this case, both the stations wait for 1 unit of time and
1 1 then starts retransmitting their data simultaneously.
This case leads to a collision again.
From here,
Station A starts transmitting its 2nd data packet and station D starts retransmitting its
st
1 data packet simultaneously.
This leads to a collision.
At Station A-
At Station D-
KA KD Remarks
In this case, both the stations wait for 1 unit of time and
1 1 then starts retransmitting their data simultaneously.
This case leads to a collision again.
From here,
Station A starts transmitting its 3rd data packet and station D starts retransmitting its
1st data packet simultaneously.
This leads to a collision.
At Station A-
At Station D-
KA KD Remarks
In this case, both the stations wait for 1 unit of time and
1 1 then starts retransmitting their data simultaneously.
This case leads to a collision again.
From here,
Important Notes-
Note-01:
With each successive collision-
Note-02:
Back Off Algorithm is also known as Binary Exponential Back Off Algorithm because-
Note-03:
Time Conversions-
In token passing,
1. Token-
2. Ring Latency-
Time taken by a bit to complete one revolution of the ring is called as ring latency.
Let us derive the expression for ring latency.
If-
Notes-
3. Cycle Time-
Time taken by the token to complete one revolution of the ring is called as cycle time.
If-
Now, we start discussing about Token Passing Access Control Method.
Token Passing-
In this access control method,
All the stations are logically connected to each other in the form of a ring.
The access of stations to the transmission link is governed by a token.
A station is allowed to transmit a data packet if and only if it possess the token
otherwise not.
Each station passes the token to its neighboring station either clockwise or anti-
clockwise.
Assumptions-
Token passing method assumes-
Efficiency-
In one cycle,
Useful time = Sum of transmission delay of N stations since each station sends 1
data packet = N x Tt
Total Time = Cycle time = Tp + N x THT
Thus,
Token Holding Time depends on the strategy implemented.
1. Delayed Token Reinsertion (DTR)
2. Early Token Reinsertion (ETR)
Station keeps holding the token until the last bit of the data packet transmitted by it
takes the complete revolution of the ring and comes back to it.
Working-
After a station acquires the token,
It transmits its data packet.
It holds the token until the data packet reaches back to it.
After data packet reaches to it, it discards its data packet as its journey is completed.
It releases the token.
The following diagram illustrates these steps for station-1. Same procedure is repeated at
every station.
We know,
Efficiency-
Substituting THT = Tt + Tp in the efficiency expression, we get-
Working-
Step-01: At Station-1:
Station-1
Receives packet-1
Transmits packet-1
Acquires the token
Transmits packet-2
Releases the token
Step-03: At Station-3:
Station-3
Receives packet-1
Transmits packet-1
Receives packet-2
Transmits packet-2
Acquires the token
Transmits packet-3
Releases the token
Step-04: At Station-4:
Station-4
Receives packet-1
Transmits packet-1
Receives packet-2
Transmits packet-2
Receives packet-3
Transmits packet-3
Acquires the token
Transmits packet-4
Releases the token
Step-05: At Station-1:
Receives packet-1
Discards packet-1 (as its journey is completed)
Receives packet-2
Transmits packet-2
Receives packet-3
Transmits packet-3
Receives packet-4
Transmits packet-4
Acquires the token
Transmits packet-1 (new)
Releases the token
PRACTICE PROBLEMS BASED ON TOKEN RING AND
TOKEN PASSING-
Before you go through this article, make sure that you have gone through the previous
article on Token Passing.
Problem-01:
Token ring station operates in which of the following modes?
1. Transit mode
2. Listen mode
3. Bypass mode and Receive mode
4. All of the above
Solution-
Problem-02:
Efficiency of the token ring is high if-
1. Reinsert the token after receiving the last bit of the frame
2. Reinsert the token after receiving the last bit of the header
3. Reinsert the token after last bit of the data packet is transferred
4. Reinsert the token after last bit of the header is transferred
Solution-
There are two strategies used in token ring- Early Token Reinsertion (ETR) and
Delayed Token Reinsertion (DTR).
Efficiency of token ring is high in Early Token Reinsertion (ETR).
Thus, Option (C) is correct.
Problem-03:
The sending station in IEEE 802.5 sets the address recognized (A) bit and frame copied (C)
bit in MAC header as
1. 1,0
2. 0,0
1. 0,1
2. 1,1
Solution-
Problem-04:
Which of the following fields in 802.5 MAC header is not included in CRC or FCS?
1. FC
2. Data field
3. FS
4. SA
Solution-
Problem-05:
What type of acknowledgement system is used in 802.5?
1. Cumulative ACK
2. Independent ACK
3. Piggybacking ACK
4. None
Solution-
Problem-06:
In token ring, ______ field is present only in the data / command frame but not in the token
frame.
1. SD
2. AC
3. ED
4. FS
Solution-
Frame status (FS) field is present only in the data / command frame.
A token frame consists of only 3 fields- SD, AC and ED.
Thus, Option (D) is correct.
Problem-07:
Consider a token ring with latency 500 μsec and packet size of 1500 bytes. What is the
effective throughput rate for both single active host and for many active hosts that can be
achieved if the ring has 3 Mbps bandwidth? Assume the strategy used is delayed token
reinsertion.
1. 2.4 Mbps and 3 Mbps
2. 2.4 Mbps and 2 Mbps
3. 2 Mbps and 3 Mbps
4. 2.4 Mbps and 2.67 Mbps
Solution-
Given-
Solution-
In worst case, all the stations goes down and only the monitor station is alive.
Monitor station sends the token and the token comes back to it.
To avoid the collision between the first and the last bit of the token, propagation
delay of the token must be at least equal to its transmission delay.
Thus, Option (B) is correct.
Problem-09:
The stacking station is a station in 802.5 and it can be described as-
1. when it drains the frame and creates a token, it then stores both the old and new
priority of the token
2. A station which stack the token till it gets the last bit of the token
3. It is nothing but monitor station
4. None of the above
Solution-
Problem-10:
In early token release, the station releases a token as soon as it completes the frame
transmission whether or not the frame header has returned to the station, then what will be
the priority of the token released?
1. The priority in the frame that completes frame transmission
2. Without changing the priority, token will be released
3. Default priority is used
4. The priority in the reservation field of the most recently received frame
Solution-
Option (D) is correct.
Problem-11:
Find the efficiency of the ring where data rate of the link is 4 Mbps, number of stations are
20, separated by 100 meters and bit delay in each station is 2.5 bits. Assume early token
reinsertion with packet size of 1000 bits and transmission speed is 2 x 108 m/sec.
Solution-
Given-
Solution-
Based on the given information, the token ring LAN network looks like-
The number of packets a station can transmit after holding a token depends on
Token Holding Time and the strategy used.
Since no information is given in the question about the Time Holding Time, so we
assume that there is no restriction on holding the token.
Thus, a station can send infinite number of packets after getting a token.
Problem-13:
A very heavily loaded 1 km long, 10 Mbps token ring has a propagation speed of 200
m/μsec. 50 stations are uniformly spaced around the ring. Data frames are 256 bits
including 32 bits of overhead. Acknowledgements are piggybacked onto the data frames
and are thus included as spare bits within the data frames and are effectively free. The
token is 8 bits long. Is the effective data rate of this ring higher or lower than the effective
data rate of a 10 Mbps CSMA / CD network? Assume ‘Early Token Release’ policy.
Solution-
Remember
Token Ring always beats the Ethernet in terms of effective bandwidth.
Analysis-
Efficiency of CSMA / CD-
Efficiency of token ring in early token retransmission is given by-
Efficiency(η) = 1 / (1 + 6.44 x a)
This expression is valid when number of stations are very large i.e. N → ∞
Efficiency of Token Ring-
Case-01:
Efficiency of token ring in early token retransmission is given by-
Efficiency(η) = 1 / (1 + a/N)
When N → ∞, Efficiency(η) = 100%
Case-02:
Efficiency of token ring in delayed token retransmission is given by-
Efficiency(η) = 1 / [1 + a(1 + 1/N)]
When N → ∞, Efficiency(η) = 1 / (1+a)
The above analysis clearly shows-
Efficiency of Token Ring in ETR > Efficiency of Token Ring in DTR > Efficiency of Token
Ring in CSMA / CD.
Problem-14:
A fibre optic token ring used as a MAN is 200 km long and runs at 100 Mbps. After sending
a frame, a station drains the frame from the ring before regenerating the token. The signal
propagation speed in the fibre is 200,000 km/sec and maximum frame size is 1 KB. What is
the maximum efficiency at N=1?
Solution-
Given-
Distance = 200 km
Bandwidth = 100 Mbps
Propagation speed = 200,000 km/sec = 2 x 108 m/sec
Frame size = 1 KB
Number of stations = 1
Strategy used is Delayed Token Reinsertion
Calculating Transmission delay-
Transmission delay
= Frame size / Bandwidth
= 1 KB / 100 Mbps
= (1 x 210 x 8 bits) / (100 x 106 bits per sec)
= 81.92 μsec
Calculating Propagation delay-
Propagation delay
= Distance / Speed
= 200 km / (2 x 108 m/sec)
= (200 x 103 m) / (2 x 108 m/sec)
= 10-3 sec
= 1 msec
Calculating value of ‘a’-
a
= Tp / Tt
= 1 msec / 81.92 μsec
= 0.0122 x 103
= 12.2
Calculating Efficiency-
Efficiency(η)
= 1 / [1 + a x (1+ 1/N)]
= 1 / [1 + 12.2 x (1+1)]
= 1 / 25.4
= 0.0394
= 3.94%
The reason behind this much less efficiency is that the distance is too large here.
Ethernet and Token Ring are meant for LANs.
If used for MANs or WANs, the efficiency will fall drastically.
Problem-15:
At a propagation speed of 200 m/μsec, what is the effective length added to a ring by a bit
delay at each repeater or station for-
1. 1 Mbps line
2. 40 Mbps line
Solution-
Part-01:
Effective length added to a ring by a bit delay
= 1 bit / 1 Mbps
= 1 μsec
= 1 μsec x 200 m/μsec
= 200 m
Part-02:
Effective length added to a ring by a bit delay
= 1 bit / 40 Mbps
= 0.025 μsec
= 0.025 μsec x 200 m/μsec
=5m
Problem-16:
Consider a 10 Mbps token ring LAN with a ring latency of 400 μs. A host that needs to
transmit seizes the toke. Then it sends a frame of 1000 bytes, removes the frame after it
has circulated all around the ring and finally releases the token. This process is repeated for
every frame. Assuming that only a single host wishes to transmit, the effective data rate is
_____ .
1. 1 Mbps
2. 2 Mbps
3. 5 Mbps
4. 6 Mbps
Solution-
Given-
Bandwidth = 10 Mbps
Ring latency = 400 μsec
Frame size = 1000 bytes
Number of stations = 1
Strategy used is Delayed Toke Reinsertion
Calculating Transmission delay-
Transmission delay
= Frame size / Bandwidth
= 1000 bytes / 10 Mbps
= (1000 x 8 bits) / (10 x 106 bits per sec)
= 800 μsec
Calculating value of ‘a’-
a
= Ring latency / Tt
= 400 μsec / 800 μsec
= 0.5
Calculating Efficiency-
Efficiency(η)
= 1 / [1 + a x (1+ 1/N)]
= 1 / [1 + 0.5 x (1+1)]
=1/2
= 0.50
= 50%
Calculating Effective data rate-
Effective data rate
= Throughput
= Efficiency(η) x Bandwidth
= 0.5 x 10 Mbps
= 5 Mbps
Thus, Option (C) is correct.
Local Area Network-
LAN Technologies-
Standard technologies used to build a wired LAN are-
1. Ethernet
2. Token Ring
In this article, we will discuss about Ethernet and its Frame Format.
Ethernet-
Ethernet is one of the standard LAN technologies used for building wired LANs.
It is defined under IEEE 802.3.
Characteristics-
Point-01:
Ethernet uses CSMA / CD as access control method to deal with the collisions.
Point-03:
Ethernet uses Manchester Encoding Technique for converting data bits into signals.
Point-04:
NOTES
The above two fields are added by the physical layer and represents the physical layer
header.
Sometimes, Start Frame Delimiter (SFD) is considered to be a part of Preamble.
That is why, at many places, Preamble field length is described as 8 bytes.
3. Destination Address-
It is a 6 byte field that contains the MAC address of the destination for which the data
is destined.
4. Source Address-
It is a 6 byte field that contains the MAC address of the source which is sending the
data.
5. Length-
It is a 2 byte field which specifies the length (number of bytes) of the data field.
This field is required because Ethernet uses variable sized frames.
NOTES
The maximum value that can be accommodated in this field = 216 – 1 = 65535.
But it does not mean maximum data that can be sent in one frame is 65535 bytes.
The maximum amount of data that can be sent in a Ethernet frame is 1500 bytes.
This is to avoid the monopoly of any single station.
The following three fields collectively represents the Ethernet Header–
6. Data-
Substituting the standard values of Ethernet, it is found that minimum length of the Ethernet
frame has to be 64 bytes starting from the destination address field to the CRC field and 72 bytes
including the Preamble and SFD fields.
Therefore, minimum length of the data field has to be = 64 bytes – (6+6+2+4) bytes = 46
bytes
The maximum amount of data that can be sent in a Ethernet frame is 1500 bytes.
This is to avoid the monopoly of any single station.
If Ethernet allows the frames of big sizes, then other stations may not get the fair chance to
send their data.
Important Concept-
For data transmission-
Ethernet in Networking-
Before you go through this article, make sure that you have gone through the previous
article on Ethernet.
We have discussed-
Ethernet is one of the standard LAN technologies used to build wired LANs.
Ethernet uses bus topology in which all the stations are connected to a half duplex
link.
Ethernet uses CSMA / CD as an access control method.
PRACTICE PROBLEMS BASED ON ETHERNET
Problem 1
Which of the following characteristic is most basic to LAN?
1. Bit rate
2. Delay x Bandwidth Product
3. Geographical distance
4. Cost
Solution-
Problem-02:
On an Ethernet LAN when a collision is detected, the sending station-
1. continues to send the transmission
2. temporarily quits the transmission
3. notifies the destination of an error
4. permanently quits the transmission
Solution-
Problem-03:
Ethernet implements _________ service for its operation.
1. connection oriented
2. connection less
3. Both A and B
4. Either A or B
Solution-
REMEMBER
Connection oriented service involves allocation of the dedicated resources.
Connection less service does not involve allocation of dedicated resources.
TCP and Virtual Circuits are connection oriented services.
IP, Ethernet and Token Ring are connection less services.
Datagrams are connection less, that is why IP is connection less.
When an Ethernet frame is sent,
Destination is never expected to reserve the buffer or any other resource for the
incoming frame.
The data is simply dumped at the destination side.
So, it is connectionless.
Thus, Option (B) is correct.
Problem-04:
The collision domain of Fast Ethernet is limited to ______ meters.
1. 2.5
2. 25
3. 250
4. 2500
Solution-
Collision domain defines the number of stations that can get involved in the collision
when connected to a LAN.
In the given question, collision domain refers to maximum distance a LAN can run to
detect the collisions.
Ethernet uses CSMA / CD as access control method.
In CSMA / CD, condition to detect collisions is-
Distance <= (Length x speed) / (2 x bandwidth)
On substituting the values, we get the value of distance
REMEMBER
For normal Ethernet, collision domain = 2500 meters.
For Fast Ethernet, collision domain = 250 meters.
For Gigabit Ethernet, collision domain = 25 meters
Thus, Option (C) is correct.
Problem-05:
The efficiency of Ethernet-
1. increases when propagation delay and transmission delay are low
2. increases when propagation delay and transmission delay are high
3. increases when propagation delay is low and transmission delay is high
4. increases when propagation delay is high and transmission delay is low
Solution-
Problem-06:
What is the baud rate of the standard 10 Mbps 802.3 LAN?
1. 20 mega baud
2. 10 mega baud
3. 25 mega baud
4. 40 mega baud
Solution-
LAN uses Manchester Encoding Technique where-
Baud rate = 2 x Bit rate
For 10 Mbps,
Baud rate
= 2 x 10 mega baud
= 20 mega baud
Thus, Option (A) is correct.
Problem-07:
Consider a 10 Mbps Ethernet LAN that has stations attached to a 2.5 km long coaxial cable.
Given that the transmission speed is 2.3 x 108 m/sec, the packet size is 128 bytes out of
which 30 bytes are overhead, find the effective transmission rate and maximum rate at
which the network can send data.
Solution-
Given-
Bandwidth = 10 Mbps
Distance = 2.5 km
Transmission speed = 2.3 x 108 m/sec
Total packet size = 128 bytes
Overhead = 30 bytes
Calculating Transmission Delay-
Transmission delay (Tt)
= Packet size / Bandwidth
= 128 bytes / 10 Mbps
= (128 x 8 bits) / (10 x 106 bits per sec)
= 1024 / 107 sec
= 102.4 μsec
Calculating Propagation Delay-
Propagation delay (Tp)
= Distance / Speed
= 2.5 km / (2.3 x 108 m/sec)
= (2.5 x 103 m) / (2.3 x 108 m/sec)
= 1.08 x 10-5 sec
= 10.8 μsec
Calculating Value of ‘a’-
a
= Tp / Tt
= 10.8 μsec / 102.4 μsec
= 0.105
Calculating Efficiency-
Efficiency(η)
= 1 / (1 + 6.44 x a)
= 1 / (1 + 6.44 x 0.105)
= 1 / 1.67
= 0.59
= 59%
Calculating Maximum Rate-
Maximum rate or Throughput
= Efficiency x Bandwidth
= 0.59 x 10 Mbps
= 5.9 Mbps
Calculating Effective Transmission Rate-
Effective transmission rate
= Throughput x (128-30 / 128)
= 5.9 Mbps x (98 / 128)
= 0.77 x 5.9 Mbps
= 4.52 Mbps
Problem-08:
The following frame transition diagram shows an exchange of Ethernet frames between two
computers, A and B connected via a 10BT Hub. Each frame sent by computer A contains
1500 B of Ethernet payload data, while each frame sent by computer B contains 40 B of
Ethernet payload data. Calculate the average utilization of the media during this exchange.
1. 10%
2. 1.7%
3. 20%
4. 15.2%
Solution-
Calculating Data Sent By Computer A in One Frame-
Given-
Problem-09:
Ethernet adaptor receives all frames and accepts-
1. Frames addressed to its own address
2. Frames addressed to the multicast or broadcast address
3. Frames if it has been placed in promiscuous mode
4. All of the above
Solution-
In a bus topology Ethernet,
The process of moving the data packets towards their destination by forwarding them from one
port to the other port is called as switching.
Switching Techniques-
Various switching techniques are-
1. Circuit Switching
2. Message Switching
3. Packet Switching
In this article, we will discuss about Circuit Switching.
Circuit Switching-
This switching technique operates in the following three phases-
1. Establishing a circuit
2. Transferring data
3. Disconnecting the circuit
Establishing a circuit
In this phase,
The entire data travels over the dedicated path from one end to the other end.
Total Time-
where-
Advantages-
Circuit switching has the following advantages-
A well defined and dedicated path exists for the data to travel.
There is no header overhead.
There is no waiting time at any switch and the data is transmitted without any delay.
Data always reaches the other end in order.
No re ordering is required.
Disadvantages-
Circuit switching has the following disadvantages-
Important Notes-
Problem-
Consider all links in the network use TDM with 24 slots and have a data rate of 1.536 Mbps.
Assume that host A takes 500 msec to establish an end to end circuit with host B before
begin to transmit the file. If the file is 512 kilobytes, then how much time will it take to send
the file from host A to host B?
Solution-
Given-
Message Switching-
In message switching,
Advantages-
Point-01:
It is helpful in setting the message priorities due to store and forward technique.
Disadvantages-
Point-01:
Packet Switching-
In packet switching,
The entire message to be sent is divided into multiple smaller size packets.
This process of dividing a single message into smaller size packets is called
as packetization.
These smaller packets are sent after the other.
It gives the advantage of pipelining and reduces the total time taken to transmit the
message.
Example-
Consider-
Out of the following, in how many packets the message must be divided so that total time
taken is minimum-
1. 1 packet
2. 5 packets
3. 10 packets
4. 20 packets
NOTE
While calculating the total time, we often ignore the propagation delay.
The reason is in packet switching, transmission delay dominates over propagation delay.
This is because each packet is transmitted over the link at each hop.
Let us analyze each case one by one.
Observations-
Conclusion-
We conclude-
Total time decreases when packet size is reduced but only up to a certain limit.
If the packet size is reduced beyond a certain limit, then total time starts increasing.
From the given choices,
1. Virtual Circuit Switching
2. Datagram Switching
2. Transferring The Data-
After the connection is established,
The entire data travels over the dedicated path from one end to the other end.
3. Disconnecting The Circuit-
After the data transfer is completed,
Datagram Switching-
In datagram switching,
Data appears in order at the destination since Data may appear out of order at the destination
all the packets take the same dedicated path. since the packets take path independently.
It is highly reliable since no packets are It is not reliable since packets may be
discarded. discarded.
It is costly. It is cost effective.
Problem-
In a packet switching network, packets are routed from source to destination along a single
path having two intermediate nodes. If the message size is 24 bytes and each packet
contains a header of 3 bytes, then the optimum packet size is-
1. 4 bytes
2. 6 bytes
3. 7 bytes
4. 9 bytes
Solution-
Let bandwidth of the network = X Bps and 1 / X = a
Option-A: Packet Size = 4 Bytes
In this case,
A dedicated path exists for A dedicated path exists for No dedicated path exists for
data transfer data transfer data transfer
All the packets take the same All the packets take the same All the packets may not take
path path the same path
Implemented at physical layer Implemented at data link layer Implemented at network layer
Inefficient in terms of resource Provides better efficiency than Provides better efficiency than
utilization circuit switched systems message switched systems
Example- Telephone systems Examples- X.25, Frame relay Example- Internet
Routing Algorithms-
Routing algorithms are meant for determining the routing of packets in a node.
Routing algorithms are classified as-
1. Static Routing Algorithms
2. Dynamic Routing Algorithms
In this article, we will discuss about distance vector routing.
It works in the following steps-
Step-01:
Each router prepares its routing table. By their local knowledge. each router knows about-
Step-02:
Each router exchanges its distance vector with its neighboring routers.
Each router prepares a new routing table using the distance vectors it has obtained
from its neighbors.
This step is repeated for (n-2) times if there are n routers in the network.
After this, routing tables converge / become stable.
Step-01:
Each router prepares its routing table using its local knowledge.
Routing table prepared by each router is shown below-
At Router A-
A 0 A
B 2 B
C ∞ –
D 1 D
At Router B-
A 2 A
B 0 B
C 3 C
D 7 D
At Router C-
B 3 B
C 0 C
D 11 D
At Router D-
A 1 A
B 7 B
C 11 C
D 0 D
Step-02:
Each router exchanges its distance vector obtained in Step-01 with its neighbors.
After exchanging the distance vectors, each router prepares a new routing table.
This is shown below-
At Router A-
Router A receives distance vectors from its neighbors B and D.
Router A prepares a new routing table as-
Router A can reach the destination router B via its neighbor B or neighbor D.
It chooses the path which gives the minimum cost.
Cost of reaching router B from router A via neighbor B = Cost (A→B) + Cost (B→B)= 2 +
0 = 2
Cost of reaching router B from router A via neighbor D = Cost (A→D) + Cost (D→B) = 1 +
7 = 8
Since the cost is minimum via neighbor B, so router A chooses the path via B.
It creates an entry (2, B) for destination B in its new routing table.
Similarly, we calculate the shortest path distance to each destination router at every
router.
Thus, the new routing table at router A is-
Destination Distance Next Hop
A 0 A
B 2 B
C 5 B
D 1 D
At Router B-
Cost of reaching destination A from router B = min { 2+0 , 3+∞ , 7+1 } = 2 via A.
Cost of reaching destination C from router B = min { 2+∞ , 3+0 , 7+11 } = 3 via C.
Cost of reaching destination D from router B = min { 2+1 , 3+11 , 7+0 } = 3 via A.
Thus, the new routing table at router B is-
A 2 A
B 0 B
C 3 C
D 3 A
At Router C-
A 5 B
B 3 B
C 0 C
D 10 B
At Router D-
Cost of reaching destination A from router D = min { 1+0 , 7+2 , 11+∞ } = 1 via A.
Cost of reaching destination B from router D = min { 1+2 , 7+0 , 11+3 } = 3 via A.
Cost of reaching destination C from router D = min { 1+∞ , 7+3 , 11+0 } = 10 via B.
Thus, the new routing table at router D is-
A 1 A
B 3 A
C 10 B
D 0 D
Step-03:
Each router exchanges its distance vector obtained in Step-02 with its neighboring
routers.
After exchanging the distance vectors, each router prepares a new routing table.
This is shown below-
At Router A-
A 0 A
B 2 B
C 5 B
D 1 D
At Router B-
Cost of reaching destination A from router B = min { 2+0 , 3+5 , 3+1 } = 2 via A.
Cost of reaching destination C from router B = min { 2+5 , 3+0 , 3+10 } = 3 via C.
Cost of reaching destination D from router B = min { 2+1 , 3+10 , 3+0 } = 3 via A.
Thus, the new routing table at router B is-
A 2 A
B 0 B
C 3 C
D 3 A
At Router C-
A 5 B
B 3 B
C 0 C
D 6 B
At Router D-
Router D receives distance vectors from its neighbors A, B and C.
Router D prepares a new routing table as-
Cost of reaching destination A from router D = min { 1+0 , 3+2 , 10+5 } = 1 via A.
Cost of reaching destination B from router D = min { 1+2 , 3+0 , 10+3 } = 3 via A.
Cost of reaching destination C from router D = min { 1+5 , 3+3 , 10+0 } = 6 via A.
Thus, the new routing table at router D is-
A 1 A
B 3 A
C 6 A
D 0 D
These will be the final routing tables at each router.
The value of next hop in the final routing table of router A suggests that only edges
AB and AD are used.
The value of next hop in the final routing table of router B suggests that only edges
BA and BC are used.
The value of next hop in the final routing table of router C suggests that only edge
CB is used.
The value of next hop in the final routing table of router D suggests that only edge
DA is used.
Thus, edges BD and CD are never used.
Important Notes-
Note-01:
In Distance Vector Routing,
Note-02:
While preparing a new routing table-
A router takes into consideration only the distance vectors it has obtained from its
neighboring routers.
It does not take into consideration its old routing table.
Note-03:
The algorithm is called so because-
Note-04:
Note-05:
Routing tables are prepared total (n-1) times if there are n routers in the given
network.
This is because shortest path between any 2 nodes contains at most n-1 edges if
there are n nodes in the graph.
Note-06:
IP Address in Networking-
In networking,
Types Of IP Address-
IP Addresses may be of the following two types-
1. Static IP Address
2. Dynamic IP Address
1. Static IP Address-
NOTE
Some ISPs do not provide static IP addresses.
Static IP Addresses are more costly than dynamic IP Addresses.
2. Dynamic IP Address-
Dynamic IP Address is a temporarily assigned IP Address to a network element.
It can be assigned to a different device if it is not in use.
DHCP or PPPoE assigns dynamic IP addresses.
IP Address Format-
1. Network ID represents the IP Address of the network and is used to identify the
network.
2. Host ID represents the IP Address of the host and is used to identify the host within
the network.
IP Address Example-
Example of an IP Address is-
00000001.10100000.00001010.11110000
(Binary Representation)
OR
1.160.10.240
(Decimal Representation)
IP Addressing-
There are two systems in which IP Addresses are classified-
1. Classful Addressing System
2. Classless Addressing System
In this article, we will discuss about Classful Addressing System.
Learn about Classless Addressing System.
Classful Addressing-
In Classful Addressing System, IP Addresses are organized into following 5 classes-
1. Class A
2. Class B
3. Class C
4. Class D
5. Class E
1. Class A-
If the 32 bit binary address starts with a bit 0, then IP Address belongs to class A.
In class A IP Address,
Total Number Of IP Addresses-
Total number of IP Addresses available in class A
= Numbers possible due to remaining available 31 bits
= 231
Total Number Of Networks-
Total number of networks available in class A
= Numbers possible due to remaining available 7 bits in the Net ID – 2
= 27 – 2
= 126
(The reason of subtracting 2 is explained later.)
Total Number Of Hosts-
Total number of hosts that can be configured in class A
= Numbers possible due to available 24 bits in the Host ID – 2
= 224 – 2
(The reason of subtracting 2 is explained later.)
Range Of 1st Octet-
We have-
Use-
Class A is used by organizations requiring very large size networks like NASA,
Pentagon etc.
2. Class B-
If the 32 bit binary address starts with bits 10, then IP Address belongs to class B.
In class B IP Address,
Total Number Of IP Addresses-
Total number of IP Addresses available in class B
= Numbers possible due to remaining available 30 bits
= 230
Total Number Of Networks-
Total number of networks available in class B
= Numbers possible due to remaining available 14 bits in the Net ID
= 214
Total Number Of Hosts-
Total number of hosts that can be configured in class B
= Numbers possible due to available 16 bits in the Host ID – 2
= 216 – 2
Range Of 1st Octet-
We have-
Use-
Class B is used by organizations requiring medium size networks like IRCTC, banks
etc.
3. Class C-
If the 32 bit binary address starts with bits 110, then IP Address belongs to class C.
In class C IP Address,
Total Number Of IP Addresses-
Total number of IP Addresses available in class C
= Numbers possible due to remaining available 29 bits
= 229
Total Number Of Networks-
Total number of networks available in class C
= Numbers possible due to remaining available 21 bits in the Net ID
= 221
Total Number Of Hosts-
Total number of hosts that can be configured in class C
= Numbers possible due to available 8 bits in the Host ID – 2
= 28 – 2
Range Of 1st Octet-
We have-
Minimum value of 1st octet = 11000000 = 192
Maximum value of 1st octet = 110111111 = 223
So, Range of 1st octet = [192, 223]
Use-
If the 32 bit binary address starts with bits 1110, then IP Address belongs to class D.
Total Number Of IP Addresses-
Total number of IP Addresses available in class D
= Numbers possible due to remaining available 28 bits
= 228
Range Of 1st Octet-
We have-
Use-
5. Class E-
If the 32 bit binary address starts with bits 1111, then IP Address belongs to class E.
Total Number Of IP Addresses-
Total number of IP Addresses available in class E
= Numbers possible due to remaining available 28 bits
= 228
Range Of 1st Octet-
We have-
Classes of IP Address-
All the classes of IP Address are summarized in the following table-
Class D 228 224 – 239 Not defined Not defined Not defined
Class E 228 240 – 254 Not defined Not defined Not defined
Also Read-Practice Problems On IP Addressing
Important Notes-
Note-01:
All the hosts in a single network always have the same network ID but different Host
ID.
However, two hosts in two different networks can have the same host ID.
Note-02:
A single network interface can be associated with more than one IP Address.
Note-03:
Note-04:
IP Address of the network called Net ID is obtained by setting all the bits for Host ID
to zero.
Note-05:
Note-06:
This is to account for the two reserved network IP Addresses 0.xxx.xxx.xxx and
127.xxx.xxx.xxx.
IP Address 0.0.0.0 is reserved for broadcasting requirements.
IP Address 127.0.0.1 is reserved for loopback address used for software testing.
Note-07:
In all the classes, total number of hosts that can be configured are 2 less.
This is to account for the two reserved IP addresses in which all the bits for host ID
are either zero or one.
When all Host ID bits are 0, it represents the Network ID for the network.
When all Host ID bits are 1, it represents the Broadcast Address.
Note-08:
Only those devices which have the network layer will have IP Address.
So, switches, hubs and repeaters does not have any IP Address.
IP Address in Networking-
In networking,
IP Address is short for Internet Protocol Address.
It is a unique address assigned to each computing device in an IP network.
ISP assigns IP Address to all the devices present on its network.
Computing devices use IP Address to identify and communicate with other devices
in the IP network.
Types Of IP Address-
IP Addresses may be of the following two types-
1. Static IP Address
2. Dynamic IP Address
1. Static IP Address-
NOTE
Some ISPs do not provide static IP addresses.
Static IP Addresses are more costly than dynamic IP Addresses.
2. Dynamic IP Address-
IP Address Format-
IP Address Example-
Example of an IP Address is-
00000001.10100000.00001010.11110000
(Binary Representation)
OR
1.160.10.240
(Decimal Representation)
IP Addressing-
There are two systems in which IP Addresses are classified-
1. Classful Addressing System
2. Classless Addressing System
In this article, we will discuss about Classful Addressing System.
Learn about Classless Addressing System.
Classful Addressing-
In Classful Addressing System, IP Addresses are organized into following 5 classes-
1. Class A
2. Class B
3. Class C
4. Class D
5. Class E
1. Class A-
If the 32 bit binary address starts with a bit 0, then IP Address belongs to class A.
In class A IP Address,
Use-
Class A is used by organizations requiring very large size networks like NASA,
Pentagon etc.
2. Class B-
If the 32 bit binary address starts with bits 10, then IP Address belongs to class B.
In class B IP Address,
Total Number Of IP Addresses-
Total number of IP Addresses available in class B
= Numbers possible due to remaining available 30 bits
= 230
Use-
Class B is used by organizations requiring medium size networks like IRCTC, banks
etc.
3. Class C-
If the 32 bit binary address starts with bits 110, then IP Address belongs to class C.
In class C IP Address,
Use-
4. Class D-
If the 32 bit binary address starts with bits 1110, then IP Address belongs to class D.
Use-
5. Class E-
If the 32 bit binary address starts with bits 1111, then IP Address belongs to class E.
Use-
Classes of IP Address-
All the classes of IP Address are summarized in the following table-
Class D 228 224 – 239 Not defined Not defined Not defined
Class E 228 240 – 254 Not defined Not defined Not defined
Also Read-Practice Problems On IP Addressing
Important Notes-
Note-01:
All the hosts in a single network always have the same network ID but different Host
ID.
However, two hosts in two different networks can have the same host ID.
Note-02:
A single network interface can be associated with more than one IP Address.
Note-03:
Note-04:
IP Address of the network called Net ID is obtained by setting all the bits for Host ID
to zero.
Note-05:
Note-06:
This is to account for the two reserved network IP Addresses 0.xxx.xxx.xxx and
127.xxx.xxx.xxx.
IP Address 0.0.0.0 is reserved for broadcasting requirements.
IP Address 127.0.0.1 is reserved for loopback address used for software testing.
Note-07:
In all the classes, total number of hosts that can be configured are 2 less.
This is to account for the two reserved IP addresses in which all the bits for host ID
are either zero or one.
When all Host ID bits are 0, it represents the Network ID for the network.
When all Host ID bits are 1, it represents the Broadcast Address.
Note-08:
Only those devices which have the network layer will have IP Address.
So, switches, hubs and repeaters does not have any IP Address.
Casting in Networking-
Types Of Casting-
1. Unicast
2. Broadcast
3. Multicast
1. Unicast-
Transmitting data from one source host to one destination host is called as unicast.
It is a one to one transmission.
Example-
Host A having IP Address 11.1.2.3 sending data to host B having IP Address 20.12.4.2.
Here,
2. Broadcast-
Transmitting data from one source host to all other hosts residing in the same or
other network is called as broadcast.
It is a one to all transmission.
Based on recipient’s network, it is classified as-
1. Limited Broadcast
2. Direct Broadcast
A. Limited Broadcast-
Transmitting data from one source host to all other hosts residing in the same
network is called as limited broadcast.
NOTE
Limited Broadcast Address for any network
= All 32 bits set to 1
= 11111111.11111111.11111111.11111111
= 255.255.255.255
Example-
Host A having IP Address 11.1.2.3 sending data to all other hosts residing in the same
network.
Here,
B. Direct Broadcast-
Transmitting data from one source host to all other hosts residing in some other
network is called as direct broadcast.
NOTE
Direct Broadcast Address for any network is the IP Address where-
Network ID is the IP Address of the network where all the destination hosts are present.
Host ID bits are all set to 1.
Example-
Host A having IP Address 11.1.2.3 sending data to all other hosts residing in the network
having IP Address 20.0.0.0
Here,
3. Multicast-
Transmitting data from one source host to a particular group of hosts having interest
in receiving the data is called as multicast.
It is a one to many transmission.
Examples-
It stands for Media Access Control Address. It stands for Internet Protocol Address.
MAC Address identifies the physical address IP Address identifies the connection of a
of a computer on the internet. computer on the internet.
Manufacturer of NIC card assigns the MAC Network Administrator or ISP assigns the IP
Address. Address.
Reverse Address Resolution Protocol (RARP) Address Resolution Protocol (ARP) is used for
is used for resolving physical (MAC) Address resolving IP Address into physical (MAC)
into IP address. address.
NOTE-
Multicast makes use of IGMP (Internet Group Management Protocol) to identify its
group.
Each group is assigned with an IP Address from class D of IPv4.
Important Points-
Point-01:
For any given IP Address,
If the range of first octet is [1, 126], then IP Address belongs to class A.
If the range of first octet is [128, 191], then IP Address belongs to class B.
If the range of first octet is [192, 223], then IP Address belongs to class C.
If the range of first octet is [224, 239], then IP Address belongs to class D.
If the range of first octet is [240, 254], then IP Address belongs to class E.
Point-02:
For any given IP Address,
IP Address of its network is obtained by setting all its Host ID part bits to 0.
Point-03:
For any given IP Address,
Direct Broadcast Address is obtained by setting all its Host ID part bits to 1.
Point-04:
For any given IP Address, limited Broadcast Address is obtained by setting all its bits
to 1.
For any network, its limited broadcast address is always 255.255.255.255
Point-05:
Class D IP Addresses are not divided into Net ID and Host ID parts.
Class E IP Addresses are not divided into Net ID and Host ID parts.
Problem-01:
For the following IP Addresses-
1. 1.2.3.4
2. 10.15.20.60
3. 130.1.2.3
4. 150.0.150.150
5. 200.1.10.100
6. 220.15.1.10
7. 250.0.1.2
8. 300.1.2.3
Identify the Class, Network IP Address, Direct broadcast address and Limited broadcast
address of each IP Address.
Solution-
Part-A:
Given IP Address is-
1.2.3.4
Part-B:
Given IP Address is-
10.15.20.60
Part-C:
Given IP Address is-
130.1.2.3
Part-D:
Given IP Address is-
150.0.150.150
Part-E:
Given IP Address is-
200.1.10.100
Part-F:
Given IP Address is-
220.15.1.10
Part-G:
Given IP Address is-
250.0.1.2
Part-H:
Given IP Address is-
300.1.2.3
Problem-02:
A device has two or more IP Addresses, the device is called-
1. Workstation
2. Router
3. Gateway
4. All of these
Solution-
Workstation-
A user may configure more than one IP Addresses in his workstation / computer.
With more than one IP Address, it remains present in more than one networks.
So, if one network goes down, it is always reachable from other networks.
The following figure shows a host present in more than one networks-
Router-
Problem-03:
A host with IP Address 200.100.1.1 wants to send a packet to all the hosts in the same
network.
What will be-
1. Source IP Address
2. Destination IP Address
Solution-
1. Source IP Address = IP Address of the sender = 200.100.1.1
2. Destination IP Address = Limited Broadcast Address = 255.255.255.255
Problem-04:
A host with IP Address 10.100.100.100 wants to use loop back testing.
What will be-
1. Source IP Address
2. Destination IP Address
Solution-
Problem-05:
How many bits are allocated for Network ID and Host ID in 23.192.157.234 address?
Solution-
Given IP Address belongs to class A.
Thus,
Number of bits reserved for Network ID = 8
Number of bits reserved for Host ID = 24
Problem-06:
Which devices can use logical addressing system?
1. Hub
2. Switch
3. Bridge
4. Router
Solution-
Devices which have network layer as the last layer can only use logical addressing
system.
Devices which have data link layer as the last layer can only use physical addressing
system.
IP Addresses are the logical addresses and MAC Addresses are the physical
addresses.
Option-A:
Hub can neither use physical addressing system nor logical addressing system.
This is because it has physical layer as the last layer.
Option-B:
Switch can use physical addressing system but not logical addressing system.
This is because it has data link layer as the last layer.
Option-C:
Bridge can use physical addressing system but not logical addressing system.
This is because it has data link layer as the last layer.
Option-D:
Router can use physical addressing system as well as logical addressing system.
This is because it has network layer as the last layer.
Thus, option (D) is correct.
Problem-07:
What is the network ID of the IP Address 230.100.123.70?
Solution-
Problem-08:
Match the following-
Column-I:
1. 200.10.192.100
2. 7.10.230.1
3. 128.1.1.254
4. 255.255.255.255
5. 100.255.255.255
Column-II:
1. Class A
2. Limited Broadcast Address
3. Direct Broadcast Address
4. Class C
5. Class B
Solution-
(I, D), (II, A), (III, E), (IV, B), (V, C)
Problem-09:
Suppose that instead of using 16 bits for network part of a class B Address, 20 bits have
been used. How many class B networks would have been possible?
Solution-
Problem-10:
What is the default mask for 192.0.46.10?
Solution-
IP Addressing-
Classless Addressing-
CIDR Block-
When a user asks for specific number of IP Addresses,
Rule-01:
Rule-02:
Rule-03:
First IP Address of the block must be divisible by the size of the block.
REMEMBER
If any binary pattern consisting of (m + n) bits is divided by 2n, then-
Examples-
Consider a binary pattern-
01100100.00000001.00000010.01000000
(represented as 100.1.2.64)
CIDR Notation-
CIDR IP Addresses look like-
a.b.c.d / n
Example-
An example of CIDR IP Address is-
182.0.1.2 / 28
It suggests-
Problem-01:
Given the CIDR representation 20.10.30.35 / 27. Find the range of IP Addresses in the
CIDR block.
Solution-
Given CIDR representation is 20.10.30.35 / 27.
It suggests-
Problem-02:
Given the CIDR representation 100.1.2.35 / 20. Find the range of IP Addresses in the CIDR
block.
Solution-
Given CIDR representation is 100.1.2.35 / 20.
It suggests-
Problem-03:
Consider a block of IP Addresses ranging from 100.1.2.32 to 100.1.2.47.
1. Is it a CIDR block?
2. If yes, give the CIDR representation.
Solution-
For any given block to be a CIDR block, 3 rules must be satisfied-
Rule-01:
Rule-02:
Rule-03:
CIDR Representation-
We have-
NOTE-
For writing the CIDR representation,
Problem-04:
Consider a block of IP Addresses ranging from 150.10.20.64 to 150.10.20.127.
1. Is it a CIDR block?
2. If yes, give the CIDR representation.
Solution-
For any given block to be a CIDR block, 3 rules must be satisfied-
Rule-01:
Rule-02:
Rule-03:
CIDR Representation-
We have-
Problem-05:
Perform CIDR aggregation on the following IP Addresses-
128.56.24.0/24
128.56.25.0/24
128.56.26.0/24
128.56.27.0/24
Solution-
All the 4 given entities represent CIDR block in itself.
We have to now perform the aggregation of these 4 blocks.
Rule-01:
Rule-02:
Rule-03:
CIDR Representation-
We have-
Problem-06:
Perform CIDR aggregation on the following IP Addresses-
200.96.86.0/24
200.96.87.0/24
200.96.88.0/24
200.96.89.0/24
Solution-
All the 4 given entities represent CIDR block in itself.
We have to now perform the aggregation of these 4 blocks.
Rule-01:
According to Rule-01, all the IP Addresses must be contiguous.
Clearly, all the IP Addresses are contiguous.
So, Rule-01 is satisfied.
Rule-02:
Rule-03:
Subnetting in Networking-
In networking,
The process of dividing a single network into multiple sub networks is called
as subnetting.
The sub networks so created are called as subnets.
Example-
Following diagram shows the subnetting of a big single network into 4 smaller subnets-
Advantages-
The two main advantages of subnetting a network are-
Subnet ID-
Each subnet has its unique network address known as its Subnet ID.
The subnet ID is created by borrowing some bits from the Host ID part of the IP
Address.
The number of bits borrowed depends on the number of subnets created.
Types of Subnetting-
Subnetting of a network may be carried out in the following two ways-
1. Fixed Length Subnetting
2. Variable Length Subnetting
Subnetting Examples-
Now, we shall discuss some examples of subnetting a network-
Example-01:
Consider-
Also Read-Classes of IP Address
For creating two subnets and to represent their subnet IDs, we require 1 bit.
So,
If borrowed bit = 0, then it represents the first subnet.
If borrowed bit = 1, then it represents the second subnet.
IP Address of the two subnets are-
200.1.2.00000000 = 200.1.2.0
200.1.2.10000000 = 200.1.2.128
Example-02:
Consider-
For creating four subnets and to represent their subnet IDs, we require 2 bits.
So,
200.1.2.00000000 = 200.1.2.0
200.1.2.01000000 = 200.1.2.64
200.1.2.10000000 = 200.1.2.128
200.1.2.11000000 = 200.1.2.192
Example-03:
Consider-
We have a big single network having IP Address 200.1.2.0.
We want to do subnetting and divide this network into 3 subnets.
Here, the subnetting will be performed in two steps-
1. Dividing the given network into 2 subnets
2. Dividing one of the subnets further into 2 subnets
200.1.2.10000000 = 200.1.2.128
200.1.2.11000000 = 200.1.2.192
Finally, the given single network is divided into 3 subnets having IP Address-
200.1.2.0
200.1.2.128
200.1.2.192
Disadvantages of Subnetting-
Point-01:
Point-02:
After subnetting, the communication process becomes complex involving the following 4
steps-
1. Identifying the network
2. Identifying the sub network
3. Identifying the host
4. Identifying the process
Problem-01:
Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets, find number of
hosts per subnet.
Also for the first subnet, find-
1. Subnet Address
2. First Host ID
3. Last Host ID
4. Broadcast Address
Solution-
Problem-02:
What is not true about subnetting?
1. It is applied for a single network
2. It is used to improve security
3. Bits are borrowed from network portion
4. Bits are borrowed from Host portion
Solution-
Clearly, Option (C) is correct.
Problem-03:
In a class B, network on the internet has a subnet mask of 255.255.240.0. What is the
maximum number of hosts per subnet?
1. 4096
2. 4094
3. 4092
4. 4090
Solution-
Number of bits reserved for network ID in the given subnet mask = 20.
So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.
Thus, Number of hosts per subnet = 212 – 2 = 4094.
In class B, 16 bits are reserved for the network.
So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.
Number of subnets possible = 24 = 16.
Thus, Option (B) is correct.
Subnetting in Networking-
Before you go through this article, make sure that you have gone through the previous
article on Subnetting.
We have discussed-
Subnet Mask-
Subnet mask is a 32 bit number which is a sequence of 1’s followed by a sequence of 0’s
where-
1’s represent the global network ID part and the subnet ID part.
0’s represent the host ID part.
By setting all the bits reserved for network ID part and subnet ID part to 1.
By setting all the bits reserved for host ID part to 0.
Example-01:
Consider we have a network having IP Address 200.1.2.0.
Clearly, this IP Address belongs to class C.
In class C-
Example-02:
Consider a single network having IP Address 200.1.2.0 is divided into 4 subnets as shown-
Now, let us calculate the mask subnet for each subnet.
For each subnet-
NOTE
In fixed length subnetting,
All the subnets have same subnet mask since the size of each subnet is same.
Example-03:
Consider a single network having IP Address 200.1.2.0 is divided into 3 subnets as shown-
Now, let us calculate the subnet mask for each subnet.
For Subnet A-
For subnet A-
Subnet mask is used to determine to which subnet the given IP Address belongs to.
To know more, Read here.
Important Notes-
Note-01:
Default mask for different classes of IP Address are-
Note-02:
Note-03:
For a network having larger size, its subnet mask will be smaller (number of 1’s will
be less).
For a network having smaller size, its subnet mask will be larger (number of 1’s will
be more).
Problem-01:
If the subnet mask 255.255.255.128 belongs to class C, find-
1. Number of subnets
2. Number of hosts in each subnet
Solution-
Given subnet mask
= 255.255.255.128
= 11111111.11111111.11111111.10000000
Since 25 bits contain the value 1 and 7 bits contain the value 0, so-
Since number of Host ID bits = 7, so-
Problem-02:
If a class B network has a subnet mask of 255.255.248.0, what is the maximum number of
hosts per subnet?
1. 1022
2. 1023
3. 2046
4. 2047
Solution-
Given subnet mask
= 255.255.248.0
= 11111111.11111111.11111000.00000000
Since 21 bits contain the value 1 and 11 bits contain the value 0, so-
Problems-01 to 09:
Consider the following subnet masks-
1. 255.0.0.0
2. 255.128.0.0
3. 255.192.0.0
4. 255.240.0.0
5. 255.255.0.0
6. 255.255.254.0
7. 255.255.255.0
8. 255.255.255.224
9. 225.255.255.240
For each subnet mask, find-
1. Number of hosts per subnet
2. Number of subnets if subnet mask belongs to class A
3. Number of subnets if subnet mask belongs to class B
4. Number of subnets if subnet mask belongs to class C
5. Number of subnets if total 10 bits are used for the global network ID
Solutions-
All the problems are solved below one by one-
Solution-01:
Given subnet mask is 255.0.0.0
So,
Part-A:
Since number of Host ID bits = 24, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 8 – 8 = 0
Thus,
Thus, there will be only one single network.
Part-C:
First two octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class B.
Part-D:
First three octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class C.
Part-E:
First 10 bits of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not use 10 bits for the Network ID.
NOTE-
Solution-02:
Given subnet mask is 255.128.0.0
So,
Part-A:
Since number of Host ID bits = 23, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 9 – 8 = 1
Thus,
Number of subnets = 21 = 2
Part-C:
First two octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class B.
Part-D:
First three octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class C.
Part-E:
First 10 bits of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not use 10 bits for the Network ID.
Solution-03:
Given subnet mask is 255.192.0.0
So,
Number of Net ID bits + Number of Subnet ID bits = 10
Number of Host ID bits = 22
Part-A:
Since number of Host ID bits = 22, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 10 – 8 = 2
Thus,
Part-C:
First two octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class B.
Part-D:
First three octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class C.
Part-E:
Given 10 bits are used for the Net ID part.
Substituting in the above equation, we get-
Number of Subnet ID bits = 10 – 10 = 0
Thus,
Thus, there will be only one single network.
Solution-04:
Given subnet mask is 255.240.0.0
So,
Part-A:
Since number of Host ID bits = 20, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 12 – 8 = 4
Thus,
Part-C:
First two octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class B.
Part-D:
First three octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class C.
Part-E:
Given 10 bits are used for the Net ID part.
Substituting in the above equation, we get-
Number of Subnet ID bits = 12 – 10 = 2
Thus,
Solution-05:
Given subnet mask is 255.255.0.0
So,
Part-A:
Since number of Host ID bits = 16, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 16 – 8 = 8
Thus,
Number of subnets = 28
Part-C:
If the given subnet mask belongs to class B, then number of Net ID bits = 16.
Substituting in the above equation, we get-
Number of Subnet ID bits = 16 – 16 = 0
Thus,
Part-D:
First three octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class C.
Part-E:
Given 10 bits are used for the Net ID part.
Substituting in the above equation, we get-
Number of Subnet ID bits = 16 – 10 = 6
Thus,
NOTE-
Solution-06:
Given subnet mask is 255.255.254.0
So,
Part-A:
Since number of Host ID bits = 9, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 23 – 8 = 15
Thus,
Number of subnets = 215
Part-C:
If the given subnet mask belongs to class B, then number of Net ID bits = 16.
Substituting in the above equation, we get-
Number of Subnet ID bits = 23 – 16 = 7
Thus,
Number of subnets = 27
Part-D:
First three octets of the subnet mask are not completely filled with 1’s.
So, given subnet mask can not belong to class C.
Part-E:
Given 10 bits are used for the Net ID part.
Substituting in the above equation, we get-
Number of Subnet ID bits = 23 – 10 = 13
Thus,
Solution-07:
Given subnet mask is 255.255.255.0
So,
Part-A:
Since number of Host ID bits = 8, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 24 – 8 = 16
Thus,
Part-C:
If the given subnet mask belongs to class B, then number of Net ID bits = 16.
Substituting in the above equation, we get-
Number of Subnet ID bits = 24 – 16 = 8
Thus,
Number of subnets = 28
Part-D:
If the given subnet mask belongs to class C, then number of Net ID bits = 24.
Substituting in the above equation, we get-
Number of Subnet ID bits = 24 – 24 = 0
Thus,
Part-E:
Given 10 bits are used for the Net ID part.
Substituting in the above equation, we get-
Number of Subnet ID bits = 24 – 10 = 14
Thus,
NOTE-
Solution-08:
Given subnet mask is 255.255.255.224
So,
Part-A:
Since number of Host ID bits = 5, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 27 – 8 = 19
Thus,
Part-C:
If the given subnet mask belongs to class B, then number of Net ID bits = 16.
Substituting in the above equation, we get-
Number of Subnet ID bits = 27 – 16 = 11
Thus,
Part-D:
If the given subnet mask belongs to class C, then number of Net ID bits = 24.
Substituting in the above equation, we get-
Number of Subnet ID bits = 27 – 24 = 3
Thus,
Part-E:
Given 10 bits are used for the Net ID part.
Substituting in the above equation, we get-
Number of Subnet ID bits = 27 – 10 = 17
Thus,
Solution-09:
Given subnet mask is 255.255.255.240
So,
Part-A:
Since number of Host ID bits = 4, so-
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
Substituting in the above equation, we get-
Number of Subnet ID bits = 28 – 8 = 20
Thus,
Part-C:
If the given subnet mask belongs to class B, then number of Net ID bits = 16.
Substituting in the above equation, we get-
Number of Subnet ID bits = 28 – 16 = 12
Thus,
Part-D:
If the given subnet mask belongs to class C, then number of Net ID bits = 24.
Substituting in the above equation, we get-
Number of Subnet ID bits = 28 – 24 = 4
Thus,
Number of subnets = 24
Part-E:
Given 10 bits are used for the Net ID part.
Substituting in the above equation, we get-
Number of Subnet ID bits = 28 – 10 = 18
Thus,
Problem-10:
Consider default subnet mask for a network is 255.255.255.0. How many number of
subnets and hosts per subnet are possible if ‘m’ bits are borrowed from HID.
1. 2m , 2(HID-m) – 2
2. 2m , 2(HID-m)
3. 2m – 1, 2(HID-m) – 2
4. 2m , (HID-m) – 2
Solution-
Problem-11:
If default subnet mask for a network is 255.255.255.0 and if ‘m’ bits are borrowed from the
NID, then what could be its supernet mask?
1. 255.255.(28-m – 1) x 2m.0
2. 255.255.(28-m) x 2m.0
3. 255.255.(28-m-1) x 2m-1.0
4. 255.255.(28-m) x 2m-1.0
Solution-
Given-
Option-A:
Given-
Option-B:
Given-
Subnetting in Networking-
Before you go through this article, make sure that you have gone through the previous
article on Subnetting.
We have discussed-
Arrangement Of Subnets-
Example-
Working-
When a data packet arrives,
Routing Table-
Example-
Consider a network is subnetted into 4 subnets as shown in the above picture.
The IP Address of the 4 subnets are-
1. 200.1.2.0 (Subnet A)
2. 200.1.2.64 (Subnet B)
3. 200.1.2.128 (Subnet C)
4. 200.1.2.192 (Subnet D)
Then, Routing table maintained by the internal router looks like-
200.1.2.0 255.255.255.192 a
200.1.2.64 255.255.255.192 b
200.1.2.128 255.255.255.192 c
200.1.2.192 255.255.255.192 d
Default 0.0.0.0 e
Routing Table Example
When a data packet arrives to the internal router, it follows the following steps-
Step-01:
Router performs the bitwise ANDing of-
Step-02:
Router compares each result with their corresponding IP Address of the destination subnet
in the routing table.
Then, following three cases may occur-
Case-01:
If there occurs only one match,
Case-02:
If there occurs more than one match,
Router forwards the data packet on the interface corresponding to the longest subnet
mask.
Case-03:
If there occurs no match,
Router forwards the data packet on the interface corresponding to the default entry.
Important Notes-
Note-01:
In fixed length subnetting,
Note-02:
In variable length subnetting,
Note-03:
Note-04:
Problem-01:
A router uses the following routing table-
A packet bearing a destination address 144.16.68.117 arrives at the router. On which
interface will it be forwarded?
1. eth0
2. eth1
3. eth2
4. eth3
Solution-
Router performs the bitwise ANDing of-
1st Row-
144.16.68.117 AND 255.255.0.0
= 144.16.0.0
Since result is same as the given destination address, so a match occurs.
2nd Row-
144.16.68.117 AND 255.255.224.0
= 144.16.64.0
Since result is same as the given destination address, so a match occurs.
3rd Row-
144.16.68.117 AND 255.255.255.0
= 144.16.68.0
Since result is same as the given destination address, so a match occurs.
4th Row-
144.16.68.117 AND 255.255.255.224
= 144.16.68.96
Since result is not same as the given destination address, so a match does not occur.
Now,
Clearly, there occurs more than one match.
So, router forwards the packet on the interface corresponding to the longest subnet
mask.
Out of all, 255.255.255.0 is the longest subnet mask since it has maximum number
of 1s.
So,
Router forwards the packet on the interface corresponding to the subnet mask
255.255.255.0.
The corresponding interface is eth2.
Thus, Option (C) is correct.
Problem-02:
The routing table of a router is shown below-
default eth2
On which interfaces will the router forward packets addressed to destination 128.75.43.16
and 192.12.17.10 respectively?
1. eth1 and eth2
2. eth0 and eth2
3. eth0 and eth3
4. eth1 and eth3
Solution-
Router performs the bitwise ANDing of-
1st Row-
128.75.43.16 AND 255.255.255.0
= 128.75.43.0
Since result is same as the given destination address, so a match occurs.
2nd Row-
128.75.43.16 AND 255.255.255.128
= 128.75.43.0
Since result is same as the given destination address, so a match occurs.
3rd Row-
128.75.43.16 AND 255.255.255.255
= 128.75.43.16
Since result is not same as the given destination address, so a match does not occur.
Now,
Router forwards the packet on the interface corresponding to the subnet mask
255.255.255.128.
The corresponding interface is eth1.
1st Row-
192.12.17.10 AND 255.255.255.0
= 192.12.17.0
Since result is not same as the given destination address, so a match does not occur.
2nd Row-
192.12.17.10 AND 255.255.255.128
= 192.12.17.0
Since result is not same as the given destination address, so a match does not occur.
3rd Row-
192.12.17.10 AND 255.255.255.255
= 192.12.17.10
Since result is not same as the given destination address, so a match does not occur.
Now,
Problem-03:
Host specific route has a subnet mask of _____ in the routing table.
1. 255.255.255.255
2. 0.0.0.0
3. 255.0.0.0
4. 0.0.0.255
Solution-
Option (A) is correct.
Problem-04:
Default route has a subnet mask of _____ in the routing table.
1. 255.255.255.255
2. 0.0.0.0
3. 255.0.0.0
4. 0.0.0.255
Solution-
Option (B) is correct.
Problem-05:
Default route can be described as-
1. Destination values of 0.0.0.0 in the routing table
2. It can be used if network has only one next hop router
3. It is useful in keeping routing table small
4. All of the above
Solution-
Option (D) is correct.
Subnet Mask-
Before you go through this article, make sure that you have gone through the previous
article on Subnet Mask.
We have discussed-
Concept To Know-
When any host connects to the internet, ISP provides following 4 things to the host-
1. IP Address
2. Default Gateway
3. Subnet Mask
4. DNS
1. IP Address-
ISP assigns an IP Address to the host so that it can be uniquely identified on the
Internet.
2. Default Gateway-
Default router connected to the network in which the host is present is the default
gateway for the host.
3. Subnet Mask-
Subnet mask is used to determine to which network the given IP Address belongs to.
Host use its subnet mask to determine whether the other host it wants to
communicate with is present within the same network or not.
If the destination host is present within the same network, then source host sends
the packet directly to the destination host.
If the destination host is present in some other network, then source host routes the
packet to the default gateway (router).
Router then sends the packet to the destination host.
Example-
Consider-
Here,
Step-01:
Source host computes its own network address using its own IP Address and subnet
mask.
After computation, source host obtains its network address with respect to itself.
Step-02:
Source host computes the network address of destination host using destination IP
Address and its own subnet mask.
After computation, source host obtains the network address of destination host with
respect to itself.
Step-03:
Source host compares the two results obtained in the above steps.
Then, following two cases are possible-
Case-01:
If the results are same,
Source host assumes that the destination host is present within the same network.
Source host sends the packet directly to the destination host.
Case-02:
If the results are different,
Source host assumes that the destination host is present in some other network.
Source host sends the packet via router to the destination host.
Important Points-
Note-01:
Note-02:
The conclusion drawn by a host about the presence of other host within the same or
different network might be wrong.
Note-03:
Problem-01:
Two computers C1 and C2 are configured as follows-
Solution-
At Computer C1-
C1 computes its network address using its own IP Address and subnet mask as-
203.197.2.53 AND 255.255.128.0
= 203.197.0.0
C1 computes the network address of C2 using IP Address of C2 and its own subnet mask
as-
203.197.75.201 AND 255.255.128.0
= 203.197.0.0
Since both the results are same, so C1 assumes that C2 is on the same network.
At Computer C2-
C2 computes its network address using its own IP Address and subnet mask as-
203.197.75.201 AND 255.255.192.0
= 203.197.64.0
C2 computes the network address of C1 using IP Address of C1 and its own subnet mask
as-
203.197.2.53 AND 255.255.192.0
= 203.197.0.0
Since both the results are different, so C2 assumes that C1 is on a different network.
Thus, Option (C) is correct.
Problem-02:
The subnet mask for a particular network is 255.255.31.0. Which of the following pairs of IP
Addresses could belong to this network?
1. 172.57.88.62 and 172.56.87.233
2. 10.35.28.2 and 10.35.29.4
3. 191.203.31.87 and 191.234.31.88
4. 128.8.129.43 and 128.8.161.55
Solution-
Let the given two IP Addresses belong to Host A and Host B.
At Host A-
Host A computes its network address using its own IP Address and subnet mask-
172.57.88.62 AND 255.255.31.0
= 172.57.24.0
Host A computes the network address of Host B using IP Address of Host B and its own
subnet mask-
172.56.87.233 AND 255.255.31.0
= 172.56.23.0
Since both the results are different, so host A assumes that host B is on a different network.
Thus, both can’t belong to the same network.
Hence, this option gets eliminated.
At Host A-
Host A computes its network address using its own IP Address and subnet mask-
10.35.28.2 AND 255.255.31.0
= 10.35.28.0
Host A computes the network address of Host B using IP Address of Host B and its own
subnet mask-
10.35.29.4 AND 255.255.31.0
= 10.35.29.0
Since both the results are different, so host A assumes that host B is on a different network.
Thus, both can’t belong to the same network.
Hence, this option gets eliminated.
At Host A-
Host A computes its network address using its own IP Address and subnet mask-
191.203.31.87 AND 255.255.31.0
= 191.203.31.0
Host A computes the network address of Host B using IP Address of Host B and its own
subnet mask-
191.234.31.88 AND 255.255.31.0
= 191.234.31.0
Since both the results are same, so host A assumes that host B is on the same network.
At Host B-
Host B computes its network address using its own IP Address and subnet mask-
191.234.31.88 AND 255.255.31.0
= 191.234.31.0
Host B computes the network address of Host A using IP Address of Host A and its own
subnet mask-
191.203.31.87 AND 255.255.31.0
= 191.203.31.0
Since both the results are different, so host B assumes that host A is on a different network.
Thus, both can’t belong to the same network.
Hence, this option gets eliminated.
At Host A-
Host A computes its network address using its own IP Address and subnet mask-
128.8.129.43 AND 255.255.31.0
= 128.8.1.0
Host A computes the network address of Host B using IP Address of Host B and its own
subnet mask-
128.8.161.55 AND 255.255.31.0
= 128.8.1.0
Since both the results are same, so host A assumes that host B is on the same network.
At Host B-
Host B computes its network address using its own IP Address and subnet mask-
128.8.161.55 AND 255.255.31.0
= 128.8.1.0
Host B computes the network address of Host A using IP Address of Host A and its own
subnet mask-
128.8.129.43 AND 255.255.31.0
= 128.8.1.0
Since both the results are same, so host B assumes that host A is on the same network.
Thus, both the hosts assume that they belong to the same network.
Hence, Option (D) is correct.
IPv4 short for Internet Protocol Version 4 is the fourth version of the Internet
Protocol (IP).
IP is responsible to deliver data packets from the source host to the destination host.
This delivery is solely based on the IP Addresses in the packet headers.
IPv4 is the first major version of IP.
IPv4 is a connectionless protocol for use on packet-switched networks.
IPv4 Header-
The following diagram represents the IPv4 header-
Let us discuss each field of IPv4 header one by one.
1. Version-
NOTES
It is important to note-
2. Header Length-
Header length is a 4 bit field that contains the length of the IP header.
It helps in knowing from where the actual data begins.
Examples-
NOTES
It is important to note-
Header length and Header length field value are two different things.
The range of header length field value is always [5, 15].
The range of header length is always [20, 60].
While solving questions-
If the given value lies in the range [5, 15] then it must be the header length field value.
This is because the range of header length is always [20, 60].
3. Type Of Service-
Type of service is a 8 bit field that is used for Quality of Service (QoS).
The datagram is marked for giving a certain treatment using this field.
4. Total Length-
Total length is a 16 bit field that contains the total length of the datagram (in bytes).
Total length = Header length + Payload length
Minimum total length of datagram = 20 bytes (20 bytes header + 0 bytes data)
Maximum total length of datagram = Maximum value of 16 bit word = 65535 bytes
5. Identification-
6. DF Bit-
It indicates the intermediate devices not to fragment the IP datagram at any cost.
If network requires the datagram to be fragmented to travel further but settings does
not allow its fragmentation, then it is discarded.
An error message is sent to the sender saying that the datagram has been discarded
due to its settings.
7. MF Bit-
It indicates to the receiver that the current datagram is either the last fragment in the
set or that it is the only fragment.
When MF bit is set to 1,
It indicates to the receiver that the current datagram is a fragment of some larger
datagram.
More fragments are following.
MF bit is set to 1 on all the fragments except the last one.
8. Fragment Offset-
9. Time To Live-
NOTES
It is important to note-
Both intermediate devices having network layer and destination decrements the TTL
value by 1.
If the value of TTL is found to be zero at any intermediate device, then the datagram is
discarded.
So, at any intermediate device, the value of TTL must be greater than zero to proceed
further.
If the value of TTL becomes zero at the destination, then the datagram is accepted.
So, at the destination, the value of TTL may be greater than or equal to zero.
10. Protocol-
The header checksum is compared with the value contained in this field.
If header checksum is found to be mismatched, then the datagram is discarded.
Router updates the checksum field whenever it modifies the datagram header.
The fields that may be modified are-
1. TTL
2. Options
3. Datagram Length
4. Header Length
5. Fragment Offset
NOTE
It is important to note-
Also Read-Checksum
14. Options-
1. Record Route-
A record route option is used to record the IP Address of the routers through which
the datagram passes on its way.
When record route option is set in the options field, IP Address of the router gets
recorded in the Options field.
NOTE
The maximum number of IPv4 router addresses that can be recorded in the Record Route
option field of an IPv4 header is 9.
Explanation-
2. Source Routing-
A source routing option is used to specify the route that the datagram must take to
reach the destination.
This option is generally used to check whether a certain path is working fine or not.
Source routing may be loose or strict.
3. Padding-
Addition of dummy data to fill up unused space in the transmission unit and make it
conform to the standard size is called as padding.
Options field is used for padding.
Example-
When header length is not a multiple of 4, extra zeroes are padded in the Options
field.
By doing so, header length becomes a multiple of 4.
If header length = 30 bytes, 2 bytes of dummy data is added to the header.
This makes header length = 32 bytes.
Then, the value 32 / 4 = 8 is put in the header length field.
In worst case, 3 bytes of dummy data might have to be padded to make the header
length a multiple of 4.
IP Fragmentation-
IP Fragmentation is a process of dividing the datagram into fragments during its
transmission.
It is done by intermediary devices such as routers at the destination host at network
layer.
Need-
Datagram Fragmentation-
When router receives a datagram to transmit further, it examines the following-
Case-01:
Size of the datagram is found to be greater than MTU and DF bit set to 1.
In this case, router discards the datagram.
Case-03:
Size of the datagram is found to be greater than MTU and DF bit set to 0.
In this case, router divides the datagram into fragments of size less than or equal to
MTU.
Router attaches an IP header with each fragment making the following changes in it.
Then, router transmits all the fragments of the datagram.
IP Fragmentation Examples-
Now, lets us discuss some examples of IP fragmentation to understand how the
fragmentation is actually carried out.
Example-01:
Consider-
Consider router receives a datagram from host A having-
Step-01:
Router examines the datagram and finds-
Step-02:
Router decides the amount of data that it should transmit in each fragment.
Router knows-
RULE
The amount of data sent in one fragment is chosen such that-
NOTE
It is not compulsory for the last fragment to contain the amount of data that is a multiple
of 8.
This is because it does not have to decide the fragment offset value for any other
fragment.
Following the above rule,
Step-03:
Router creates three fragments of the original datagram where-
First fragment contains the data = 176 bytes
Second fragment contains the data = 176 byes
Third fragment contains the data = 148 bytes
The information contained in the IP header of each fragment is-
Step-04:
At destination side,
Example-02:
Consider-
Step-01:
Router-2 examines the datagram and finds-
Step-02:
Router-2 decides the amount of data that it should transmit in each fragment.
Router-2 knows-
Step-03:
Router-2 creates two fragments of the received datagram where-
NOTE-
NOTE-
Step-04:
At destination side,
Reassembly Algorithm-
Receiver applies the following steps for reassembly of all the fragments-
1. It identifies whether datagram is fragmented or not using MF bit and Fragment offset
field.
2. It identifies all the fragments belonging to the same datagram using identification
field.
3. It identifies the first fragment. Fragment with offset field value = 0 is the first
fragment.
4. It identifies the subsequent fragments using total length, header length and fragment
offset.
5. It repeats step-04 until MF bit = 0.
Fragmentation Overhead-
Total Overhead
= (Total number of fragmented datagrams – 1) x size of IP header
Important Notes-
Note-01:
Source side does not require fragmentation due to wise segmentation by transport
layer.
The transport layer looks at the datagram data limit and frame data limit.
Then, it performs segmentation in such a way that the resulting data can easily fit in
a frame.
Thus, there is no need of fragmentation at the source side.
Note-02:
Datagrams from the same source to the same destination may take different routes
in the network.
Note-03:
Fragment offset field value is set to 0 for the first fragmented datagram.
MF bit is set to 1 for all the fragmented datagrams except the last one.
Note-04:
1 0 1st Fragment
0 0 No Fragmentation
Note-05:
Identification number for all the fragments is same as that of the original datagram.
This is to identify all the fragments of the same datagram while re-assembling them.
Note-06:
Note-07:
Note-08:
Reassembly is not done at the routers because-
Note-09:
If a fragment (say parent) is re fragmented into multiple datagrams then-
1. The fragment offset value for the first re-fragment is always same as its parent.
2. The MF bit bit value for the last re-fragment is always same as its parent.
Solution-
Option-A:
Option-B:
Option-C:
Option-D:
Problem-02:
Fragmentation of a datagram is needed in-
1. Datagram circuit only
2. Virtual circuit only
3. Both (A) and (B)
4. None
Solution-
Problem-03:
What are all the fields required from IP header to allow the destination to perform
reassembly of fragments?
1. Identification, MF, Offset, Header length and Total length
2. MF, Offset and Destination IP
3. MF, Datagram length, Source IP
4. MF, Options and Offset
Solution-
Clearly, Option (A) is correct.
Problem-04:
The checksum in IP must be recomputed at every router because of change in ____ fields.
1. TTL, Options, Identification Number, Offset
2. TTL, Options, Datagram Length, Offset
3. TTL, Options, Data, Offset
4. TTL, Header Length, Offset, ToS
Solution-
Clearly, Option (B) is correct.
Problem-05:
If the value available in “fragment offset” field of IP header is 100, then the number of bytes
ahead of this fragment is ___ ?
1. 100 B
2. 400 B
3. 800 B
4. 200 B
Solution-
Problem-06:
When the source does not trust the routers to route properly or source wishes to make sure
that the packet does not stray from specified path, what options can be used?
1. Loose source routing
2. Trace route
3. Strict source routing
4. Internet Time Stamp
Solution-
Clearly, Option (C) is correct.
Problem-07:
The checksum computation in IP header includes-
1. IP header only
2. IP header and data
3. IP header and Pseudo header
4. None
Solution-
Problem-08:
Suppose a router receives an IP packet containing 600 data bytes and has to forward the
packet to a network with maximum transmission unit of 200 bytes. Assume that IP header is
20 bytes long. What are fragment offset values for divided packets?
1. 22, 44, 66, 88
2. 0, 22, 44
3. 0, 22, 44, 66
4. 22, 44, 66
Solution-
Given-
MTU size of the destination network = 200 bytes
IP header length = 20
Now,
Maximum amount of data that can be sent in one fragment = 200 – 20 = 180 bytes.
Amount of data sent in a fragment must be a multiple of 8.
So, maximum data sent that can be in one fragment = 176 bytes.
Thus, 4 fragments are created-
.
1. Transmission Control Protocol (TCP)
2. User Datagram Protocol (UDP)
In this article, we will discuss about Transmission Control Protocol (TCP).
Learn about User Datagram Protocol.
Characteristics Of TCP-
Point-01:
This is because-
Point-02:
This is because-
TCP establishes an end to end connection between the source and destination.
The connection is established before exchanging the data.
The connection is maintained until the application programs at each end finishes
exchanging the data.
Point-03:
TCP handles congestion and flow control by controlling the window size.
TCP reacts to congestion by reducing the sender window size.
Read More-TCP Congestion Control
Point-04:
TCP ensures that the data packets get deliver to the destination in the same order
they are sent by the sender.
Sequence Numbers are used to coordinate which data has been transmitted and
received.
Point-05:
TCP connection allows to send data in both the directions at the same time.
So, TCP connections are Full Duplex.
Point-06:
Point-07:
Point-08:
Application layer sends data to the transport layer without any limitation.
TCP divides the data into chunks where each chunk is a collection of bytes.
Then, it creates a TCP segment by adding IP header to the data chunk.
TCP segment = TCP header + Data chunk.
Point-09:
TCP provides error checking and recovery using three simple techniques-
1. Checksum
2. Acknowledgement
3. Retransmission
Transmission Control Protocol-
Before you go through this article, make sure that you have gone through the previous
article on TCP in Networking.
We have discussed-
In this article, we will discuss about TCP Header.
TCP Header-
The following diagram represents the TCP header format-
Let us discuss each field of TCP header one by one.
1. Source Port-
2. Destination Port-
Destination Port is a 16 bit field.
It identifies the port of the receiving application.
NOTE
It is important to note-
3. Sequence Number-
4. Acknowledgement Number-
5. Header Length-
Examples-
NOTES
It is important to note-
Header length and Header length field value are two different things.
The range of header length field value is always [5, 15].
The range of header length is always [20, 60].
While solving questions-
If the given value lies in the range [5, 15] then it must be the header length field value.
This is because the range of header length is always [20, 60].
6. Reserved Bits-
7. URG Bit-
When URG bit is set to 1,
It indicates the receiver that certain amount of data within the current segment is
urgent.
Urgent data is pointed out by evaluating the urgent pointer field.
The urgent data has be prioritized.
Receiver forwards urgent data to the receiving application on a separate channel.
8. ACK Bit-
When ACK bit is set to 1, it indicates that acknowledgement number contained in the
TCP header is valid.
For all TCP segments except request segment, ACK bit is set to 1.
Request segment is sent for connection establishment during Three Way
Handshake.
9. PSH Bit-
PSH bit is used to push the entire buffer immediately to the receiving application.
When PSH bit is set to 1,
All the segments in the buffer are immediately pushed to the receiving application.
No wait is done for filling the entire buffer.
This makes the entire buffer to free up immediately.
NOTE
It is important to note-
Unlike URG bit, PSH bit does not prioritize the data.
It just causes all the segments in the buffer to be pushed immediately to the receiving
application.
The same order is maintained in which the segments arrived.
It is not a good practice to set PSH bit = 1.
This is because it disrupts the working of receiver’s CPU and forces it to take an action
immediately.
When RST bit is set to 1,
When SYN bit is set to 1,
It indicates the receiver that the sequence number contained in the TCP header is
the initial sequence number.
Request segment sent for connection establishment during Three way handshake
contains SYN bit set to 1.
12. FIN Bit-
When FIN bit is set to 1,
It indicates the receiver that the sender wants to terminate the connection.
FIN segment sent for TCP Connection Terminationcontains FIN bit set to 1.
NOTE
It is important to note-
14. Checksum-
USEFUL FORMULAS
Formula-01:
Number of urgent bytes = Urgent pointer + 1
Formula-02:
End of urgent byte
= Sequence number of the first byte in the segment + Urgent pointer
16. Options-
A. Time Stamp-
When wrap around time is less than life time of a segment,
Multiple segments having the same sequence number may appear at the receiver
side.
This makes it difficult for the receiver to identify the correct segment.
If time stamp is used, it marks the age of TCP segments.
Based on the time stamp, receiver can identify the correct segment.
Options field may be used to represent a window size greater than 16 bits.
Using window size field of TCP header, window size of only 16 bits can be
represented.
If the receiver wants to receive more data, it can advertise its greater window size
using this field.
The extra bits are then appended in Options field.
C. Parameter Negotiation-
Options field is used for parameters negotiation.
Example- During connection establishment,
Both sender and receiver have to specify their maximum segment size.
To specify maximum segment size, there is no special field.
So, they specify their maximum segment size using this field and negotiates.
D. Padding-
Addition of dummy data to fill up unused space in the transmission unit and make it
conform to the standard size is called as padding.
Options field is used for padding.
Example-
When header length is not a multiple of 4, extra zeroes are padded in the Options
field.
By doing so, header length becomes a multiple of 4.
If header length = 30 bytes, 2 bytes of dummy data is added to the header.
This makes header length = 32 bytes.
Then, the value 32 / 4 = 8 is put in the header length field.
In worst case, 3 bytes of dummy data might have to be padded to make the header
length a multiple of 4.
Each TCP segment sent by the sender contains some bytes of data.
TCP assigns a unique number to each data byte for its identification.
This unique number is called as TCP Sequence Number.
Purpose-
Sequence number serves the following purposes-
NOTE-
After all the 232 sequence numbers are used up and more data is to be sent,
the sequence numbers can be wrapped around and used again from the starting.
In general,
Example-
Formula-
If bandwidth of the network = x bytes/sec, then-
Wrap around time can be reduced to the life time of a TCP segment.
This is because-
After the life time of a segment completes, it is considered that the segment no
longer exists.
So, sequence numbers used by the segment frees up and can be reused.
To reduce the wrap around time to the life time of segment,
There must exist as many sequence numbers as there are number of data bytes
sent in time equal to life time of segment.
Formula-
Problem-01:
Given the bandwidth of a network is 1 MB / sec. Calculate the wrap around time.
Solution-
We know,
Wrap around time = Time taken to use all the 232 sequence numbers.
TCP assigns 1 sequence number to each byte of data.
To calculate wrap around time, we just need to calculate how much time will be taken to
send 232 bytes of data.
Now,
It will take 1.19 hours to consume all the 232 sequence numbers if bandwidth = 1
MB / sec.
Wrap Around Time = 1.19 hours.
Alternatively,
Using the formula, we have-
Wrap Around Time
= 232 / 106 sec
= 1.19 hours
Problem-02:
If bandwidth of the network is 1 GBps, how many extra bits will have to be appended in the
Options field so that wrap around time becomes equal to the life time of segment?
Solution-
For wrap around time to become equal to the life time of TCP segment,
Number of sequence numbers required = Number of bytes sent in life time of TCP segment
We know-
Problem-03:
In a network that has a maximum TPDU size of 128 bytes, a maximum TPDU lifetime of 30
sec and 8 bit sequence number, what is the maximum data rate per connection?
(TPDU is Transport layer protocol data unit which is the segment.)
Solution-
Given-
Problem-04:
Suppose that the advertised window 1 MB long. If a sequence number is selected at
random from the entire sequence number space, what is the probability that the sequence
number falls inside the advertised window?
Solution-
We know,
TCP establishes an end to end connection between the sender and receiver.
This connection is established before exchanging the data.
TCP connection is reliable and ensures in order delivery.
Also Read-TCP Header
In this article, we will discuss how a TCP connection is established.
3 Way Handshake-
Consider-
Step-01: SYN-
For establishing a connection,
This segment contains the initial sequence number used by the client.
It has been sent for synchronizing the sequence numbers.
Also Read-TCP Sequence Number
This segment contains the initial sequence number used by the server.
It has been sent for synchronizing the sequence numbers.
Step-03: ACK-
After receiving the reply segment,
Important Points-
Point-01:
In step-01 and step-02-
Point-02:
Point-03:
This is because-
Point-04:
For all the segments except the request segment, ACK bit is always set to 1.
This is because-
For the request segment, acknowledgement number field will always be invalid.
For all other segments, acknowledgement number field will always be valid.
Point-05:
The negotiation can be on setting the values of following parameters-
1. Window size
2. Maximum segment size
3. Timer values
Point-06:
In any TCP segment,
If SYN bit = 1 and ACK bit = 0, then it must be the request segment.
If SYN bit = 1 and ACK bit = 1, then it must be the reply segment.
If SYN bit = 0 and ACK bit = 1, then it can be the pure ACK or segment meant for
data transfer.
If SYN bit = 0 and ACK bit = 0, then this combination is not possible.
Point-07:
Point-08:
Consider sender sends the segments of size greater than MSS of receiver.
Then, they are first fragmented first at the receiver side.
It causes an extra overhead.
Point-09:
Problem-01:
SYN = 0 and ACK = 1 indicates-
1. Open connection packet
2. Open connection ACK
3. Data packet
4. ACK packet
Solution-
Options (C) and (D) are correct.
Problem-02:
An acknowledgement by TCP sender guarantees-
1. Data has been delivered to the application
2. Data has been received by TCP module
3. Data has been received by application interface
4. None of the above
Solution-
Option (A) is correct.
TCP uses Three Way Handshake to establish a connection between the sender and
receiver.
Connection establishment using Three Way Handshake involves the steps as
shown-
In this article, we will discuss how a lost TCP segment is retransmitted.
TCP Retransmission-
After establishing the connection,
Sender discovers that the TCP segment is lost when-
1. Either Time Out Timer expires
2. Or it receives three duplicate acknowledgements
Case-01:
Sender receives an acknowledgement for the sent segment before the timer goes
off.
In this case, sender stops the timer.
Case-02:
Sender does not receives any acknowledgement for the sent segment and the timer
goes off.
In this case, sender assumes that the sent segment is lost.
Sender retransmits the same segment to the receiver and resets the timer.
Also Read-Time Out Timer
Example-
Example-
Consider-
Sender sends 5 TCP segments to the receiver.
The second TCP segment gets lost before reaching the receiver.
The sequence of steps taking place are-
NOTE
After receiving the retransmitted segment-2,
Important Points-
Point-01:
Consider time out timer expires before receiving the acknowledgement for a TCP
segment.
This case suggests the stronger possibility of congestion in the network.
Point-02:
Point-03:
Consider receiver does not receives 3 duplicate acknowledgements for the lost TCP
segment.
In such a case, retransmission occurs only after time out timer goes off.
Point-04:
Problem-
Consider a TCP connection in a state where there are no outstanding ACKs. The sender
sends two segments back to back. The sequence numbers of the first and second
segments are 230 and 290 respectively. The first segment was lost but the second segment
was received correctly by the receiver.
Let X be the amount of data carried in the first segment (in bytes) and Y be the ACK
number sent by the receiver.
The values of X and Y are-
1. 60 and 290
2. 230 and 291
3. 60 and 231
4. 60 and 230
Solution-
It is given that sender sends two segments where-
1st segment contains the sequence number 230 and gets lost.
2nd segment contains the sequence number 290 and is received correctly.
Total number of sequence numbers contained in the 1st segment = 289 – 230 + 1 =
60.
TCP assigns one sequence number to each byte of data.
Thus, Amount of data contained in the first segment = 60 bytes.
Receiver sends the acknowledgement asking for the first segment only.
This is because it expects the 1st segment first.
Receiver keeps sending this ACK number until it receives the first segment correctly.
Thus, Acknowledgement number = Sequence number of the 1st segment = 230.
Thus, Option (D) is correct.
TCP uses Three Way Handshake to establish a connection between the sender and
receiver.
Connection establishment using Three Way Handshake involves the steps as
shown-
Also Read-TCP Retransmission
In this article, we will discuss how a TCP connection is terminated.
A TCP connection is terminated using FIN segment where FIN bit is set to 1.
Consider-
There is a well established TCP connection between the client and server.
Client wants to terminate the connection.
The following steps are followed in terminating the connection-
Step-01:
For terminating the connection,
Client sends a FIN segment to the server with FIN bit set to 1.
Client enters the FIN_WAIT_1 state.
Client waits for an acknowledgement from the server.
Step-02:
After receiving the FIN segment,
Step-03:
After receiving the acknowledgement, client enters the FIN_WAIT_2 state.
Now,
The connection from client to server is terminated i.e. one way connection is closed.
Client can not send any data to the server since server has released its buffers.
Pure acknowledgements can still be sent from the client to server.
The connection from server to client is still open i.e. one way connection is still open.
Server can send both data and acknowledgements to the client.
Step-04:
Now, suppose server wants to close the connection with the client.
For terminating the connection,
Server sends a FIN segment to the client with FIN bit set to 1.
Server waits for an acknowledgement from the client.
NOTE
If server wanted,
It could have sent the FIN segment along with the previous acknowledgment that it sent to the
client.
Step-05:
After receiving the FIN segment,
TIME_WAIT State-
The TIME_WAIT state allows the client to resend the final acknowledgement if it gets
lost.
The time spent by the client in TIME_WAIT state depends on the implementation.
The typical values are 30 seconds, 1 minute and 2 minutes.
After the wait, the connection gets formally closed.
DNS in Networking-
Purpose-
Need-
The need for Domain Name Service arises due to the following reasons-
Point-01:
Point-02:
DNS Resolution-
The following diagram illustrates the process of DNS resolution-
The steps involved in DNS Resolution are-
Step-01:
A user program sends a name query to a library procedure called the resolver.
Step-02:
Resolver looks up the local domain name cache for a match.
Step-03:
DNS server looks up the name.
Step-04:
After receiving a response, the DNS client returns the resolution result to the
application.
Important Notes-
Note-01:
DNS uses UDP at the transport layer due to the following reasons-
Point-01:
Point-02:
Point-03:
Although UDP is not reliable but reliability can be added on application layer.
Reliability can be added by using timeouts and resend at the application layer.
Thus, in the end both speed and protection are achieved.
Note-02:
DNS uses UDP at the transport layer for replying to the DNS queries of clients.
Therefore, it is a connection less protocol.
Note-03:
DNS is non-persistent.
Note-04:
This is because-
DNS server accepts the requests, process them, resolves the query and forget about
them.
It does not make any assumption how long this will be.
Note-05:
Mapping an IP Address onto a domain name is referred to as Inverse domain.
It is important to note-
Note-06:
Purpose-
It is mainly used for the retrieval of data from websites throughout the internet.
It works on the top of TCP/IP suite of protocols.
Working-
HTTP uses a client-server model where-
Whenever a client requests some information (say clicks on a hyperlink) to the website
server.
The browser sends a request message to the HTTP server for the requested objects.
Then-
HTTP Connections-
HTTP connections can be of two types-
1. Non-persistent HTTP connection
2. Persistent HTTP connection
A new separate TCP connection is used for A single TCP connection is used for sending
each object. multiple objects one after the other.
Example- Example-
Suppose a request has been made for a
Suppose a request has been made for a
HTML page that contains 10 images (called
HTML page that contains 10 images (called
objects).
objects).
Then,
Then,
With non-persistent connection, all the 11
With persistent connection, all the 11 objects
objects (1 page + 10 images) will be sent one
(1 page + 10 images) will be sent one after
by one.
the other using a single TCP connection.
For getting each object, a new separate
connection will be opened and used.
Important Notes-
Note-01:
This is because-
Note-02:
It is important to know-
Any service which does not use TCP should have the inbuilt facility for providing
reliability.
Note-03:
HTTP clients uses port 80 to send and receive requested web pages from a HTTP
server.
Similarly, HTTP server responds to all the requests at port 80.
Note-04:
Note-05:
This is because-
After serving the single HTTP request, the connection is closed and it is not used
again.
So, HTTP 1.0 without connection keep alive is connectionless.
Note-06:
This is because-
HTTP passes the control data (commands) and main data over the same
connection.
Both control data and main data are processed in the same way without any
distinction.
No high priority is given to the control data (commands).
Note-07:
HTTP is a stateless protocol.
This is because-
It will give a chance to the browser window to engage the connection with the web
server for a long time.
This may unnecessarily create a situation of reaching to maximum connections of a web
server even though most of the connections are idle.
Working-
While sending the mail, SMTP is used two times-
1. Between the sender and the sender’s mail server
2. Between the sender’s mail server and the receiver’s mail server
NOTE-
To receive or download the email,
Another protocol is needed between the receiver’s mail server and the receiver.
The most commonly used protocols are POP3 and IMAP.
Characteristics of SMTP-
Important Points-
Note-01:
SMTP can only handle the messages containing 7 bit ASCII text.
SMTP can not transfer other types of data like images, video, audio etc.
SMTP can not transfer executable files and binary objects.
SMTP can not transfer the text data of other languages like French, Japanese,
Chinese etc.
(since they are represented in 8 bit codes)
Note-02:
As the name suggests,
Note-03:
Note-04:
This is because-
Note-05:
Sender and receiver can not run SMTP between their machines.
This is because-
Note-06:
Purpose-
Working-
To retrieve a message from the mail server-
Characteristics of POP-
Characteristics of IMAP-
POP Vs IMAP-
The following table lists the differences between POP and IMAP-
Mails can only be accessed from a single Mails can be accessed from multiple devices
device. which is the biggest advantage.
In POP, the mail server and client’s mail
In IMAP, the mail server and the client’s mail
account are not synced.
account are synced.
So, changes made in the client’s mail account
So, changes made in the client’s mail account
are not visible on the web mail inbox.
are instantly visible on the web mail inbox.
Example- Example-
If you are using POP and marks a mail as
If you are using IMAP and marks a mail as
read, it does not get marked as read in the
read, it gets marked as read in the web mail
web mail inbox because the mails are
inbox too because the changes are taking
downloaded to the computer and so the
place on the server.
changes won’t be visible on the server.
POP is a stateful protocol until the mail is IMAP is a stateful protocol because the IMAP
downloaded as well as stateless across server has to maintain a folder hierarchy for
sessions. each of its users.
Purpose-
Working-
FTP establishes two TCP connections between the client and the server.
One connection is used for transferring data.
Other connection is used for transferring control information.
Characteristics of FTP-
Important Notes-
Note-01:
This is because-
FTP requires the connection establishment between the client and server before
transferring the files.
So, both have to be online at the same time.
That is why, emails are not sent using FTP.
Note-02:
FTP is used for transferring one file at a time in either direction between the client
and the server.
Note-03:
This is because-
The client establishes control connection for the duration of an FTP session.
It typically spans multiple data transfers.
So, FTP is a stateful protocol.
Transport
UDP TCP TCP TCP TCP
Protocol Used
Connectionles
Connectionles Connectionles Connectio Connectio Connectio
s / Connection
s s n Oriented n Oriented n Oriented
Oriented
Control
connection
HTTP 1.0 is is
non-persistent. persistent.
Persistent /
Non-persistent Persistent Persistent Data
Non-persistent HTTP 1.1 is
connection
persistent.
is non-
persistent.
20 for data
connection
.
Port Number 21 for
53 80 25 110
Used control
connection
.