Numerical in Computer Networks
Numerical in Computer Networks
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-
a = Tp / Tt
a = 22.5 msec / 5.461 msec
a = 4.12
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%
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%-
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.
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.
Ans:
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.
a = Tp / Tt
a = 15 msec / 1.024 μsec
a = 15000 μsec / 1.024 μsec
a = 14648.46
Solution-
Given-
Bandwidth = 106 bits/sec
Distance = 10,000 km
Propagation speed = 2 x 108 m/sec
Packet size = 50,000 bytes
Solution-
Given-
Bandwidth = 1 Mbps
Propagation delay (Tp) = 0.75 ms
Processing time (Tprocess) = 0.25 ms
Data frame size = 1980 bytes
Acknowledgement frame size = 20 bytes
Overhead in data frame = 20 bytes
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
7|CN_NU MER ICALS _D D P
= (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%
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
Useful Time
= Transmission delay of data frame
= 100 msec
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
9|CN_NU MER ICALS _D D P
=1/4
= 25%
Sender throughput
= Efficiency (η) x Sender bandwidth
= 0.25 x 80 Kbps
= 20 Kbps
= (20 x 1000 / 8) bytes per sec
= 2500 bytes/sec
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,
2n = W + W
2n = 2W
W = 2n-1
Therefore, maximum window size possible of sender and receiver = 2n-1
Thus, Option (B) is correct.
10 | C N _ N U M E R I C A L S _ D D P
Problem-02:
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:
Step-02:
Step-03:
11 | C N _ N U M E R I C A L S _ D D P
Step-04:
Step-05:
Step-06:
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
12 | C N _ N U M E R I C A L S _ D D P
Calculating Transmission Delay-
a = Tp / Tt
a = 150 msec / 64 msec
a = 2.34
Calculating Optimal Sender Window Size-
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
13 | C N _ N U M E R I C A L S _ D D P
= 12
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.
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
14 | C N _ N U M E R I C A L S _ D D P
= (64 x 8 bits) / (1.536 x 106 bits per sec)
= 333.33 μsec
We use only (1+2a) = 109 sequence numbers and rest remains unused.
Compute approximate optimal window size when packet size is 53 bytes, RTT is
60 msec and bottleneck bandwidth is 155 Mbps.
Solution-
15 | C N _ N U M E R I C A L S _ D D P
Given-
Packet size = 53 bytes
RTT = 60 msec
Bandwidth = 155 Mbps
a = Tp / Tt
a = 30 msec / 2.735 μsec
a = 10968.921
Calculating Optimal Window Size-
16 | C N _ N U M E R I C A L S _ D D P
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
17 | C N _ N U M E R I C A L S _ D D P
= ⌈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
18 | C N _ N U M E R I C A L S _ D D P
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
a = Tp / Tt
a = 200 μsec / 50 μsec
a=4
Calculating Efficiency-
Efficiency (η)
= Sender window size / Optimal window size
=5/9
= 0.5555
19 | C N _ N U M E R I C A L S _ D D P
= 55.55%
Solution-
Given-
Packet size = 32 bytes
Round Trip Time = 80 msec
Bandwidth = 128 Kbps
20 | C N _ N U M E R I C A L S _ D D P
= 2 msec
a = Tp / Tt
a = 40 msec / 2 msec
a = 20
21 | C N _ N U M E R I C A L S _ D D P
Thus, for the given CRC generator, the corresponding binary pattern is 11011011.
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:
Important Notes-
Steps Involved-
22 | C N _ N U M E R I C A L S _ D D P
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.
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.
The newly formed code word (Original data + CRC) is transmitted to the receiver.
At receiver side,
The transmitted code word is received.
The received code word is divided with the same CRC generator.
On division, the remainder so obtained is checked.
Case-01: Remainder = 0
23 | C N _ N U M E R I C A L S _ D D P
Receiver assumes that no error occurred in the data during the transmission.
Receiver accepts the data.
Case-02: Remainder ≠ 0
Problem-01:
A bit stream 1101011011 is transmitted using the standard CRC method. The
generator polynomial is x4+x+1. What is the actual bit string transmitted?
Solution-
24 | C N _ N U M E R I C A L S _ D D P
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:
25 | C N _ N U M E R I C A L S _ D D P
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.
Part-02:
26 | C N _ N U M E R I C A L S _ D D P
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.
Example:
Solution-
27 | C N _ N U M E R I C A L S _ D D P
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
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
3. 0,1
4. 1,1
Solution-
Solution-
28 | C N _ N U M E R I C A L S _ D D P
IEEE 802.5 is token ring.
Frame Status (FS) field consists of the Available bit and Copied bit.
These two bits are modified by the receiving station.
So, CRC is not computed on Frame Status field otherwise receiving station will
have to bear the overhead of recomputing the CRC.
Problem-06:
Solution-
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.
29 | C N _ N U M E R I C A L S _ D D P
A token frame consists of only 3 fields- SD, AC and ED.
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-
Ring latency = 500 μsec
Packet Size = 1500 bytes
Bandwidth = 3 Mbps
Strategy used is Delayed Token Reinsertion (DTR)
We know,
Transmission delay (Tt)
30 | C N _ N U M E R I C A L S _ D D P
= Packet size / Bandwidth
= 1500 bytes / 3 Mbps
= (1500 x 8 bits) / (3 x 106 bits per sec)
= 4000 μsec
We know,
a = Tp / Tt
a = Latency / Tt
a = 500 μsec / 4000 μsec
a = 0.125
Now,
Throughput
= Efficiency (η) x Bandwidth
= 0.8 x 3 Mbps
= 2.4 Mbps
31 | C N _ N U M E R I C A L S _ D D P
For many active host, N = ∞.
Substituting N = ∞ in efficiency formula, we get-
Efficiency (η)
= 1 / (1 + a)
= 1 / (1 + 0.125)
= 1 / 1.125
= 0.89
Now,
Throughput
= Efficiency (η) x Bandwidth
= 0.89 x 3 Mbps
= 2.67 Mbps
Thus, Option (D) is correct.
Problem-08:
In 802.5, the condition to find out the minimum size of the ring is-
1. Latency of the ring = Transmission delay of the data frame
2. Latency of the ring = Transmission delay of the token frame
3. Latency of the ring = RTT
4. Latency > RTT
Solution-
32 | C N _ N U M E R I C A L S _ D D P
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-
Data rate = Bandwidth = 4 Mbps
Number of stations = 20
Distance between two stations = 100 meters
Bit delay = 25 bits
Packet size = 1000 bits
Strategy used is Early Token Reinsertion (ETR)
33 | C N _ N U M E R I C A L S _ D D P
= 1000 bits / 4 Mbps
= 1000 bits / (4 x 106 bits per sec)
= 250 μsec
Bit delay
= 25 bits
= 2.5 bits / 4 Mbps
= 25 bits / (4 x 106 bits per sec)
= 0.625 μsec
Ring latency
= Propagation delay + N x Bit delay
= 10 μsec + 20 x 0.625 μsec
= 10 μsec + 12.5 μsec
= 22.5 μsec
34 | C N _ N U M E R I C A L S _ D D P
Calculating value of ‘a’-
a
= Ring latency / Tt
= 22.5 μsec / 250 μsec
= 0.09
Calculating Efficiency-
Efficiency(η)
= 1 / (1 + a/N)
= 1 / (1 + 0.09 / 20)
= 1 / 1.0045
= 0.9955
= 99.55%
Problem-12:
A token ring LAN network interconnects M stations using Star Topology in the
following way. All the input and output lines of the token ring station interface are
connected to a cabinet where the actual ring is placed. Suppose that distance from
each station to a cabinet is 100 m and ring latency per station is 8 bits, packets are
1250 B and bandwidth is 25 Mbps.
1. Find the ring latency normalized to packet transmission time.
2. Find the minimum number of packets transmitted by stations, if stations are
allowed to transmit an unlimited number of packet / token. (v = 2 x 108 m/sec)
35 | C N _ N U M E R I C A L S _ D D P
Part-01:
Transmission delay
= Packet size / Bandwidth
= 1250 B / 25 Mbps
= (1250 x 8 bits) / (25 x 106 bits per sec)
= 400 μsec
Propagation delay
= Distance / Speed
= (200 x M meters) / (2 x 108 m/sec)
= (200 x M) / (2 x 108) sec
= 100 x M x 10-8 sec
= M μsec
Bit delay
= Ring latency per station
36 | C N _ N U M E R I C A L S _ D D P
= 8 bits
= 8 bits / 25 Mbps
= 0.32 μsec
Ring latency
= Propagation delay + N x Bit delay
= M μsec + M x 0.32 μsec
= 1.32 x M μsec
Part-02:
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-
37 | C N _ N U M E R I C A L S _ D D P
3. 1101010000011110
4. 1101010000111111
Solution-
CSMA / CD Protocol-
Problem-02:
Solution-
Given-
Bandwidth = 1 Gbps
Distance = 1 km
Speed = 200000 km/sec
38 | C N _ N U M E R I C A L S _ D D P
= 5 x 10-6 sec
Problem-03:
A 2 km long broadcast LAN has 107 bps bandwidth and uses CSMA / CD. The
signal travels along the wire at 2 x 108 m/sec. What is the minimum packet size
that can be used on this network?
1. 50 B
2. 100 B
3. 200 B
4. None of the above
Solution-
Given-
Distance = 2 km
Bandwidth = 107 bps
Speed = 2 x 108 m/sec
39 | C N _ N U M E R I C A L S _ D D P
= 10-5 sec
A and B are the only two stations on Ethernet. Each has a steady queue of frames
to send. Both A and B attempts to transmit a frame, collide and A wins first back
off race. At the end of this successful transmission by A, both A and B attempt to
transmit and collide. The probability that A wins the second back off race is ___ .
1. 0.5
2. 0.625
3. 0.75
4. 1.0
Solution-
Now,
We have been asked the probability of station A to transmit its 2nd data packet
successfully after 2nd collision.
After the 2nd collision occurs, we have-
At Station A-
2nd data packet of station A undergoes collision for the 1st time.
So, collision number for the 2nd data packet of station A = 1.
Now, station A randomly chooses a number from the range [0,21-1] = [0,1].
Then, station A waits for back off time and then attempts to retransmit its data
packet.
At Station B-
1st data packet of station B undergoes collision for the 2nd time.
So, collision number for the 1st data packet of station B = 2.
Now, station B randomly chooses a number from the range [0,22-1] = [0,3].
Then, station B waits for back off time and then attempts to retransmit its data
packet.
0 0 Collision
0 1 A wins
0 2 A wins
0 3 A wins
41 | C N _ N U M E R I C A L S _ D D P
1 0 B wins
1 1 Collision
1 2 A wins
1 3 A wins
From here,
Probability of A winning the 2nd back off race = 5 / 8 = 0.625.
Thus, Option (B) is correct.
Problem-05:
Suppose nodes A and B are on same 10 Mbps Ethernet segment and the
propagation delay between two nodes is 225 bit times. Suppose A and B send
frames at t=0, the frames collide then at what time, they finish transmitting a jam
signal. Assume a 48 bit jam signal.
Solution-
42 | C N _ N U M E R I C A L S _ D D P
At t = 11.25 μsec,
After collision occurs at t = 11.25 μsec, collided signals start travelling back.
Collided signals reach the respective nodes after time = Half of propagation delay
Collided signals reach the respective nodes after time = 22.5 μsec / 2 =
11.25 μsec.
Thus, at t = 22.5 μsec, collided signals reach the respective nodes.
At t = 22.5 μsec,
As soon as nodes discover the collision, they immediately release the jam signal.
Time taken to finish transmitting the jam signal = 48 bit time = 48 bits/ 10 Mbps
= 4.8 μsec.
Thus,
Time at which the jam signal is completely transmitted
= 22.5 μsec + 4.8 μsec
= 27.3 μsec or 273 bit times
Problem-07:
Assume this network uses CSMA / CD and signal travels with a speed of 3 x
105 km/sec. If sender sends at 1 Mbps, what could be the minimum size of the
packet?
1. 600 bits
2. 400 bits
43 | C N _ N U M E R I C A L S _ D D P
3. 6000 bits
4. 1500 bits
Solution-
44 | C N _ N U M E R I C A L S _ D D P
Before you go through this article, make sure that you have gone through the
previous article on CSMA / CD Protocol.
We have discussed-
CSMA / CD allows a station to transmit data if it senses the carrier free.
After undergoing collision, station waits for random back off time before
transmitting again.
Back Off Algorithm is used to calculate back off time.
In this article, we will discuss practice problems based on CSMA / CD and Back
Off Algorithm.
Problem-01:
After the kth consecutive collision, each colliding station waits for a random time
chosen from the interval-
1. (0 to 2k) x RTT
2. (0 to 2k-1) x RTT
3. (0 to 2k-1) x Maximum Propagation delay
4. (0 to 2k-1) x Maximum Propagation delay
Solution-
Problem-02:
45 | C N _ N U M E R I C A L S _ D D P
In a CSMA / CD network running at 1 Gbps over 1 km cable with no repeaters, the
signal speed in the cable is 200000 km/sec. What is minimum frame size?
Solution-
Given-
Bandwidth = 1 Gbps
Distance = 1 km
Speed = 200000 km/sec
Problem-03:
A 2 km long broadcast LAN has 107 bps bandwidth and uses CSMA / CD. The
signal travels along the wire at 2 x 108 m/sec. What is the minimum packet size
that can be used on this network?
1. 50 B
2. 100 B
46 | C N _ N U M E R I C A L S _ D D P
3. 200 B
4. None of the above
Solution-
Given-
Distance = 2 km
Bandwidth = 107 bps
Speed = 2 x 108 m/sec
Problem-04:
A and B are the only two stations on Ethernet. Each has a steady queue of frames
to send. Both A and B attempts to transmit a frame, collide and A wins first back
47 | C N _ N U M E R I C A L S _ D D P
off race. At the end of this successful transmission by A, both A and B attempt to
transmit and collide. The probability that A wins the second back off race is ___ .
1. 0.5
2. 0.625
3. 0.75
4. 1.0
Solution-
Now,
We have been asked the probability of station A to transmit its 2nd data packet
successfully after 2nd collision.
After the 2nd collision occurs, we have-
At Station A-
2nd data packet of station A undergoes collision for the 1st time.
So, collision number for the 2nd data packet of station A = 1.
48 | C N _ N U M E R I C A L S _ D D P
Now, station A randomly chooses a number from the range [0,21-1] = [0,1].
Then, station A waits for back off time and then attempts to retransmit its data
packet.
At Station B-
1st data packet of station B undergoes collision for the 2nd time.
So, collision number for the 1st data packet of station B = 2.
Now, station B randomly chooses a number from the range [0,22-1] = [0,3].
Then, station B waits for back off time and then attempts to retransmit its data
packet.
0 0 Collision
0 1 A wins
0 2 A wins
0 3 A wins
1 0 B wins
1 1 Collision
1 2 A wins
1 3 A wins
From here,
Probability of A winning the 2nd back off race = 5 / 8 = 0.625.
Thus, Option (B) is correct.
49 | C N _ N U M E R I C A L S _ D D P
Problem-05:
Suppose nodes A and B are on same 10 Mbps Ethernet segment and the
propagation delay between two nodes is 225 bit times. Suppose A and B send
frames at t=0, the frames collide then at what time, they finish transmitting a jam
signal. Assume a 48 bit jam signal.
Solution-
At t = 0,
At t = 11.25 μsec,
After collision occurs at t = 11.25 μsec, collided signals start travelling back.
Collided signals reach the respective nodes after time = Half of propagation delay
Collided signals reach the respective nodes after time = 22.5 μsec / 2 =
11.25 μsec.
Thus, at t = 22.5 μsec, collided signals reach the respective nodes.
50 | C N _ N U M E R I C A L S _ D D P
At t = 22.5 μsec,
As soon as nodes discover the collision, they immediately release the jam signal.
Time taken to finish transmitting the jam signal = 48 bit time = 48 bits/ 10 Mbps
= 4.8 μsec.
Thus,
Time at which the jam signal is completely transmitted
= 22.5 μsec + 4.8 μsec
= 27.3 μsec or 273 bit times
Problem-06:
Suppose nodes A and B are attached to opposite ends of the cable with propagation
delay of 12.5 ms. Both nodes attempt to transmit at t=0. Frames collide and after
first collision, A draws k=0 and B draws k=1 in the exponential back off protocol.
Ignore the jam signal. At what time (in seconds), is A’s packet completely
delivered at B if bandwidth of the link is 10 Mbps and packet size is 1000 bits.
Solution-
Given-
Propagation delay = 12.5 ms
Bandwidth = 10 Mbps
Packet size = 1000 bits
Collision is discovered in the time it takes the collided signals to reach the nodes
= Half of Propagation delay
= 12.5 ms / 2
= 6.25 ms
Thus, collision is discovered at time t = 6.25 ms + 6.25 ms = 12.5 ms.
After winning the back off race, node A gets the authority to retransmit
immediately.
But node A does not retransmit immediately.
It waits for the channel to clear from the last bit aborted by it on discovering the
collision.
Time taken by the last bit to get off the channel = Propagation delay = 12.5 ms.
So, node A waits for time = 12.5 ms and then starts the retransmission.
Thus, node A starts the retransmission at time t = 12.5 ms + 12.5 ms = 25 ms.
52 | C N _ N U M E R I C A L S _ D D P
= (1000 bits / 10 Mbps) + 12.5 ms
= 100 μs + 12.5 ms
= 0.1 ms + 12.5 ms
= 12.6 ms
Problem-07:
Assume this network uses CSMA / CD and signal travels with a speed of 3 x
105 km/sec. If sender sends at 1 Mbps, what could be the minimum size of the
packet?
1. 600 bits
2. 400 bits
3. 6000 bits
4. 1500 bits
Solution-
In CSMA / CD,
The condition to detect collision is-
Packet size >= 2 x (distance / speed) x Bandwidth
53 | C N _ N U M E R I C A L S _ D D P
To solve the question,
We assume that a packet of same length has to be used in the entire network.
To get the minimum length of the packet, what distance we should choose?
To get the minimum length of the packet, we should choose the minimum
distance.
But, then collision would be detected only in the links having distance less than or
equal to that minimum distance.
For the links, having distance greater than the minimum distance, collision would
not be detected.
So, we choose the maximum distance so that collision can be detected in all the
links of the network.
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
54 | C N _ N U M E R I C A L S _ D D P
4. 2.4 Mbps and 2.67 Mbps
Solution-
Given-
Ring latency = 500 μsec
Packet Size = 1500 bytes
Bandwidth = 3 Mbps
Strategy used is Delayed Token Reinsertion (DTR)
We know,
Transmission delay (Tt)
= Packet size / Bandwidth
= 1500 bytes / 3 Mbps
= (1500 x 8 bits) / (3 x 106 bits per sec)
= 4000 μsec
We know,
a = Tp / Tt
a = Latency / Tt
a = 500 μsec / 4000 μsec
a = 0.125
55 | C N _ N U M E R I C A L S _ D D P
Calculating Throughput for single active host-
Now,
Throughput
= Efficiency (η) x Bandwidth
= 0.8 x 3 Mbps
= 2.4 Mbps
Now,
Throughput
= Efficiency (η) x Bandwidth
56 | C N _ N U M E R I C A L S _ D D P
= 0.89 x 3 Mbps
= 2.67 Mbps
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-
Data rate = Bandwidth = 4 Mbps
Number of stations = 20
Distance between two stations = 100 meters
Bit delay = 25 bits
Packet size = 1000 bits
Strategy used is Early Token Reinsertion (ETR)
Bit delay
= 25 bits
= 2.5 bits / 4 Mbps
= 25 bits / (4 x 106 bits per sec)
= 0.625 μsec
Ring latency
= Propagation delay + N x Bit delay
= 10 μsec + 20 x 0.625 μsec
= 10 μsec + 12.5 μsec
= 22.5 μsec
58 | C N _ N U M E R I C A L S _ D D P
Calculating value of ‘a’-
a
= Ring latency / Tt
= 22.5 μsec / 250 μsec
= 0.09
Calculating Efficiency-
Efficiency(η)
= 1 / (1 + a/N)
= 1 / (1 + 0.09 / 20)
= 1 / 1.0045
= 0.9955
= 99.55%
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
59 | C N _ N U M E R I C A L S _ D D P
Frame size = 1000 bytes
Number of stations = 1
Strategy used is Delayed Toke Reinsertion
Transmission delay
= Frame size / Bandwidth
= 1000 bytes / 10 Mbps
= (1000 x 8 bits) / (10 x 106 bits per sec)
= 800 μsec
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%
60 | C N _ N U M E R I C A L S _ D D P
= Throughput
= Efficiency(η) x Bandwidth
= 0.5 x 10 Mbps
= 5 Mbps
PRACTICE PROBLEM BASED ON PURE ALOHA AND SLOTTED
ALOHA-
1. Pure Aloha-
It allows the stations to transmit data at any time whenever they want.
After transmitting the data packet, station waits for some time.
Case-02:
Transmitting station does not receive any acknowledgement within specified time
from the receiving station.
In this case, transmitting station assumes that the transmission is unsuccessful.
Then,
Transmitting station uses a Back Off Strategy and waits for some random
amount of time.
After back off time, it transmits the data packet again.
It keeps trying until the back off limit is reached after which it aborts the
transmission.
Efficiency-
61 | C N _ N U M E R I C A L S _ D D P
Efficiency of Pure Aloha (η) = G x e-2G
Maximum Efficiency-
The maximum efficiency of Pure Aloha is very less due to large number of
collisions.
2. Slotted Aloha-
Slotted Aloha divides the time of shared channel into discrete intervals called
as time slots.
Any station can transmit its data in any time slot.
The only condition is that station must start its transmission from the beginning of
the time slot.
62 | C N _ N U M E R I C A L S _ D D P
If the beginning of the slot is missed, then station has to wait until the beginning
of the next time slot.
A collision may occur if two or more stations try to transmit data at the beginning
of the same time slot.
Efficiency-
where G = Number of stations willing to transmit data at the beginning of the same
time slot
Maximum Efficiency-
Thus,
The maximum efficiency of Slotted Aloha is high due to less number of collisions.
Problem-
63 | C N _ N U M E R I C A L S _ D D P
Consider a network using the pure ALOHA medium access control protocol,
where each frame is of length 1,000 bits. The channel transmission rate is 1 Mbps
(=106 bits per second). The aggregate number of transmissions across all the nodes
(including new frame transmissions and retransmitted frames due to collisions) is
modelled as a Poisson process with a rate of 1,000 frames per second. Throughput
is defined as the average number of frames successfully transmitted per second.
The throughput of the network (rounded to the nearest integer) is
______________ .
Explanation:
General Formula of Efficiency of Pure Aloha
= G x e-2G
Where G is number of requests send in given time slot
So now Tt
= L/BW
= 1000/106
= 1 millisecond
For 1000 frames it will be 1000*1 millisecond = 1 second
So now in 1 second total 1000 frames send ,So G =1
Value of e = 2.71(Mathematical constant)
So efficiency
= 1* 2.71^(-2+1)
= 0.1353
Now for 1000 frames it would be 1000*0.1353 = 135.3
(Closest Integer=135)
Ethernet in Networking | Practice Problems
Problem-
A group of N stations share 100 Kbps slotted ALOHA channel. Each station output
a 500 bits frame on an average of 5000 ms even if previous one has not been sent.
What is the required value of N?
Solution-
64 | C N _ N U M E R I C A L S _ D D P
Throughput Of One Station-
65 | C N _ N U M E R I C A L S _ D D P
Problem-06:
Solution-
For 10 Mbps,
Baud rate
= 2 x 10 mega baud
= 20 mega baud
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
66 | C N _ N U M E R I C A L S _ D D P
Overhead = 30 bytes
a
= Tp / Tt
= 10.8 μsec / 102.4 μsec
= 0.105
Calculating Efficiency-
Efficiency(η)
67 | C N _ N U M E R I C A L S _ D D P
= 1 / (1 + 6.44 x a)
= 1 / (1 + 6.44 x 0.105)
= 1 / 1.67
= 0.59
= 59%
68 | C N _ N U M E R I C A L S _ D D P
1. 10%
2. 1.7%
3. 20%
4. 15.2%
Solution-
Given-
Each frame sent by computer A contains 1500 B of Ethernet payload data.
This is divided as: 20 bytes of IP Header + 20 bytes of TCP Header + 1460 bytes
of data.
Given-
Each frame sent by computer B contains 40 B of Ethernet payload data.
This is divided as: 20 bytes of IP Header + 20 bytes of TCP Header + 0 bytes of
data.
69 | C N _ N U M E R I C A L S _ D D P
Since minimum data in the payload field of Ethernet must 46 bytes. So, extra 6
bytes are padded.
Calculating Throughput-
Throughput
= Amount of data that flows per second
= 99968 bits / 0.6 seconds
= 166613.33 bits/sec
70 | C N _ N U M E R I C A L S _ D D P
Calculating Utilization-
Solution-
Given-
Total bandwidth = 1.536 Mbps
Bandwidth is shared among 24 slots
Connection set up time = 500 msec
File size = 512 KB
71 | C N _ N U M E R I C A L S _ D D P
Transmission delay (Tt)
= File size / Bandwidth
= 512 KB / 64 Kbps
= (512 x 210 x 8 bits) / (64 x 103 bits per sec)
= 65.536 sec
= 65536 msec
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
Size Of Packet-
72 | C N _ N U M E R I C A L S _ D D P
Packet size
= 1000 bytes of data + 100 bytes of header
= 1100 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 1100 bytes / 1 MBps
= 1100 x 10-6 sec
= 1100 μsec
= 1.1 msec
Total time taken to send the complete message from sender to receiver
= 3 x Transmission delay
= 3 x 1.1 msec
= 3.3 msec
In this case,
73 | C N _ N U M E R I C A L S _ D D P
= 1000 bytes / 5
= 200 bytes
Packet size
= 200 bytes of data + 100 bytes of header
= 300 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 300 bytes / 1 MBps
= 300 x 10-6 sec
= 300 μsec
= 0.3 msec
74 | C N _ N U M E R I C A L S _ D D P
= 1.2 msec
Total time taken to send the complete message from sender to receiver
= 0.9 msec + 1.2 msec
= 2.1 msec
In this case,
The entire message is divided into total 10 packets.
These packets are then sent one after the other.
Packet size
= 100 bytes of data + 100 bytes of header
= 200 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
75 | C N _ N U M E R I C A L S _ D D P
= 200 bytes / 1 MBps
= 200 x 10-6 sec
= 200 μsec
= 0.2 msec
Total time taken to send the complete message from sender to receiver
= 0.6 msec + 1.8 msec
= 2.4 msec
In this case,
The entire message is divided into total 5 packets.
These packets are then sent one after the other.
76 | C N _ N U M E R I C A L S _ D D P
Data Sent in One Packet-
Packet size
= 50 bytes of data + 100 bytes of header
= 150 bytes
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 150 bytes / 1 MBps
= 150 x 10-6 sec
= 150 μsec
= 0.15 msec
77 | C N _ N U M E R I C A L S _ D D P
Time Taken By Remaining Packets-
Total time taken to send the complete message from sender to receiver
= 0.45 msec + 2.85 msec
= 3.3 msec
PRACTICE PROBLEM BASED ON PACKET SWITCHING TECHNIQUE-
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-
78 | C N _ N U M E R I C A L S _ D D P
Option-A: Packet Size = 4 Bytes
In this case,
The entire message is divided into packets of size 4 bytes.
These packets are then sent one after the other.
Data size
= Packet size – Header size
= 4 bytes – 3 bytes
= 1 byte
Thus, only 1 byte of data can be sent in each packet.
Number Of Packets-
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 4 bytes / X Bps
= 4a sec
Total time taken to send the complete message from sender to receiver
= 12a sec + 92a sec
= 104a sec
In this case,
The entire message is divided into packets of size 6 bytes.
These packets are then sent one after the other.
Data size
= Packet size – Header size
= 6 bytes – 3 bytes
= 3 bytes
Thus, only 3 bytes of data can be sent in each packet.
80 | C N _ N U M E R I C A L S _ D D P
Number Of Packets-
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 6 bytes / X Bps
= 6a sec
81 | C N _ N U M E R I C A L S _ D D P
Total time taken to send the complete message from sender to receiver
= 18a sec + 42a sec
= 60a sec
In this case,
The entire message is divided into packets of size 7 bytes.
These packets are then sent one after the other.
Data size
= Packet size – Header size
= 7 bytes – 3 bytes
= 4 bytes
Thus, only 4 bytes of data can be sent in each packet.
Number Of Packets-
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 7 bytes / X Bps
= 7a sec
82 | C N _ N U M E R I C A L S _ D D P
Time Taken By First Packet-
Total time taken to send the complete message from sender to receiver
= 21a sec + 35a sec
= 56a sec
In this case,
The entire message is divided into packets of size 9 bytes.
These packets are then sent one after the other.
Data size
= Packet size – Header size
83 | C N _ N U M E R I C A L S _ D D P
= 9 bytes – 3 bytes
= 6 bytes
Thus, only 6 bytes of data can be sent in each packet.
Number Of Packets-
Transmission Delay-
Transmission delay
= Packet size / Bandwidth
= 9 bytes / X Bps
= 9a sec
84 | C N _ N U M E R I C A L S _ D D P
= 27a sec
Total time taken to send the complete message from sender to receiver
= 27a sec + 27a sec
= 54a sec
Observations-
From here,
Total time taken when packet size is 4 bytes = 104a sec
Total time taken when packet size is 6 bytes = 60a sec
Total time taken when packet size is 7 bytes = 56a sec
Total time taken when packet size is 9 bytes = 54a sec
Result-
Step-01:
Each router prepares its routing table. By their local knowledge. each router knows
about-
All the routers present in the network
85 | C N _ N U M E R I C A L S _ D D P
Distance to its neighboring routers
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.
Consider-
There is a network consisting of 4 routers.
The weights are mentioned on the edges.
Weights could be distances or costs or delays.
Step-01:
Each router prepares its routing table using its local knowledge.
Routing table prepared by each router is shown below-
At Router A-
86 | C N _ N U M E R I C A L S _ D D P
Next
Destination Distance
Hop
A 0 A
B 2 B
C ∞ –
D 1 D
At Router B-
Next
Destination Distance
Hop
A 2 A
B 0 B
C 3 C
D 7 D
At Router C-
Next
Destination Distance
Hop
A ∞ –
B 3 B
87 | C N _ N U M E R I C A L S _ D D P
C 0 C
D 11 D
At Router D-
Next
Destination Distance
Hop
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.
At Router A-
Next
Destination Distance
Hop
A 0 A
B 2 B
C 5 B
D 1 D
89 | C N _ N U M E R I C A L S _ D D P
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.
Next
Destination Distance
Hop
A 2 A
B 0 B
C 3 C
90 | C N _ N U M E R I C A L S _ D D P
D 3 A
At Router C-
Next
Destination Distance
Hop
A 5 B
B 3 B
C 0 C
91 | C N _ N U M E R I C A L S _ D D P
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.
Next
Destination Distance
Hop
A 1 A
92 | C N _ N U M E R I C A L S _ D D P
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.
At Router A-
93 | C N _ N U M E R I C A L S _ D D P
Thus, the new routing table at router A is-
Next
Destination Distance
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+5 , 3+1 } = 2 via A.
Cost of reaching destination C from router B = min { 2+5 , 3+0 , 3+10 } = 3 via
C.
94 | C N _ N U M E R I C A L S _ D D P
Cost of reaching destination D from router B = min { 2+1 , 3+10 , 3+0 } = 3 via
A.
Next
Destination Distance
Hop
A 2 A
B 0 B
C 3 C
D 3 A
At Router C-
95 | C N _ N U M E R I C A L S _ D D P
Cost of reaching destination B from router C = min { 3+0 , 10+3 } = 3 via B.
Cost of reaching destination D from router C = min { 3+3 , 10+0 } = 6 via B.
Next
Destination Distance
Hop
A 5 B
B 3 B
C 0 C
D 6 B
At Router D-
96 | C N _ N U M E R I C A L S _ D D P
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.
Next
Destination Distance
Hop
A 1 A
B 3 A
C 6 A
D 0 D
We have-
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.
97 | C N _ N U M E R I C A L S _ D D P
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.
Important Notes-
Note-01:
Note-02:
Note-03:
Note-04:
98 | C N _ N U M E R I C A L S _ D D P
This is to update the shortest path in case any link goes down or topology
changes.
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:
Problem-01:
Identify the Class, Network IP Address, Direct broadcast address and Limited
broadcast address of each IP Address.
Solution-
99 | C N _ N U M E R I C A L S _ D D P
Part-A:
Part-B:
Part-C:
Part-D:
100 | C N _ N U M E R I C A L S _ D D P
150.0.150.150
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-
Problem-04:
Solution-
101 | C N _ N U M E R I C A L S _ D D P
Problem-05:
How many bits are allocated for Network ID and Host ID in 23.192.157.234
address?
Solution-
Problem-01:
Given the CIDR representation 20.10.30.35 / 27. Find the range of IP Addresses in
the CIDR block.
Solution-
It suggests-
27 bits are used for the identification of network.
Remaining 5 bits are used for the identification of hosts in the network.
So,
First IP Address = 00010100.00001010.00011110.00100000 = 20.10.30.32
Last IP Address = 00010100.00001010.00011110.00111111 = 20.10.30.63
102 | C N _ N U M E R I C A L S _ D D P
Problem-02:
Given the CIDR representation 100.1.2.35 / 20. Find the range of IP Addresses in
the CIDR block.
Solution-
It suggests-
20 bits are used for the identification of network.
Remaining 12 bits are used for the identification of hosts in the network.
So,
First IP Address = 01100100.00000001.00000000.00000000 = 100.1.0.0
Last IP Address = 01100100.00000001.00001111.11111111 = 100.1.15.255
Problem-03:
Solution-
103 | C N _ N U M E R I C A L S _ D D P
Rule-01:
Rule-02:
Rule-03:
Since all the rules are satisfied, therefore given block is a CIDR block.
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 24.
To have 24 total number of IP Addresses, total 4 bits are required in the Host ID
part.
So, Number of bits present in the Network ID part = 32 – 4 = 28.
Thus,
104 | C N _ N U M E R I C A L S _ D D P
CIDR Representation = 100.1.2.32 / 28
NOTE-
Problem-04:
Solution-
Rule-01:
Rule-02:
105 | C N _ N U M E R I C A L S _ D D P
Rule-03:
Since all the rules are satisfied, therefore given block is a CIDR block.
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 26.
To have 26 total number of IP Addresses, 6 bits are required in the Host ID part.
So, Number of bits in the Network ID part = 32 – 6 = 26.
Thus,
Problem-05:
Solution-
Rule-02:
Rule-03:
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 210.
To have 210 total number of IP Addresses, 10 bits are required in the Host ID part.
So, Number of bits in the Network ID part = 32 – 10 = 22.
Thus,
107 | C N _ N U M E R I C A L S _ D D P
Problem-06:
Solution-
Rule-01:
Rule-02:
Rule-03:
108 | C N _ N U M E R I C A L S _ D D P
Since all the 3 rules are not satisfied, so they can not be aggregated.
Problems-01 to 09:
Solutions-
Solution-01:
109 | C N _ N U M E R I C A L S _ D D P
Number of Host ID bits = 24
Part-A:
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,
Number of subnets = 20 = 1
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.
110 | C N _ N U M E R I C A L S _ D D P
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:
Part-A:
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
111 | C N _ N U M E R I C A L S _ D D P
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:
Part-A:
Part-B:
112 | C N _ N U M E R I C A L S _ D D P
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,
Number of subnets = 22 = 4
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:
Number of subnets = 20 = 1
Solution-04:
113 | C N _ N U M E R I C A L S _ D D P
Given subnet mask is 255.240.0.0
So,
Number of Net ID bits + Number of Subnet ID bits = 12
Number of Host ID bits = 20
Part-A:
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,
Number of subnets = 24 = 16
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.
114 | C N _ N U M E R I C A L S _ D D P
Part-E:
Number of subnets = 22 = 4
Solution-05:
Part-A:
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,
115 | C N _ N U M E R I C A L S _ D D P
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,
Number of subnets = 20 = 1
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:
Number of subnets = 26 = 64
NOTE-
116 | C N _ N U M E R I C A L S _ D D P
Solution-06:
Part-A:
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,
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,
117 | C N _ N U M E R I C A L S _ D D P
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:
Solution-07:
Part-A:
118 | C N _ N U M E R I C A L S _ D D P
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,
Number of subnets = 20 = 1
119 | C N _ N U M E R I C A L S _ D D P
Part-E:
NOTE-
Solution-08:
Part-A:
Part-B:
If the given subnet mask belongs to class A, then number of Net ID bits = 8.
120 | C N _ N U M E R I C A L S _ D D P
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,
Number of subnets = 23 = 8
Part-E:
121 | C N _ N U M E R I C A L S _ D D P
Number of Subnet ID bits = 27 – 10 = 17
Thus,
Solution-09:
Part-A:
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:
122 | C N _ N U M E R I C A L S _ D D P
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:
Problem-10:
123 | C N _ N U M E R I C A L S _ D D P
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-
Subnet mask = 255.255.255.0
m bits are chosen from the NID part.
Option-A:
Given-
Supernet mask = 255.255.(28-m – 1) x 2m.0
Third octet = (28-m – 1) x 2m
On substituting m = 4, we get-
Third octet
= 15 x 24
= (1111)2 x 24
= 11110000 (Performing Left shift by 4 places)
Option-B:
Given-
Supernet mask = 255.255.(28-m) x 2m.0
Third octet = (28-m) x 2m
On substituting m = 4, we get-
Third octet
= 16 x 24
= (10000)2 x 24
= 100000000 (Performing Left shift by 4 places)
This can not be true because these are 9 bits and octet can be only 8 bits.
125 | C N _ N U M E R I C A L S _ D D P
PRACTICE PROBLEMS BASED ON CLASSLESS INTER DOMAIN
ROUTING-
Problem-01:
Given the CIDR representation 20.10.30.35 / 27. Find the range of IP Addresses in
the CIDR block.
Solution-
It suggests-
27 bits are used for the identification of network.
Remaining 5 bits are used for the identification of hosts in the network.
So,
First IP Address = 00010100.00001010.00011110.00100000 = 20.10.30.32
Last IP Address = 00010100.00001010.00011110.00111111 = 20.10.30.63
Problem-02:
Given the CIDR representation 100.1.2.35 / 20. Find the range of IP Addresses in
the CIDR block.
Solution-
126 | C N _ N U M E R I C A L S _ D D P
Given CIDR representation is 100.1.2.35 / 20.
It suggests-
20 bits are used for the identification of network.
Remaining 12 bits are used for the identification of hosts in the network.
So,
First IP Address = 01100100.00000001.00000000.00000000 = 100.1.0.0
Last IP Address = 01100100.00000001.00001111.11111111 = 100.1.15.255
Problem-03:
Solution-
Rule-01:
Rule-02:
127 | C N _ N U M E R I C A L S _ D D P
According to Rule-02, size of the block must be presentable as 2n.
Number of IP Addresses in the given block = 47 – 32 + 1 = 16.
Size of the block = 16 which can be represented as 24.
So, Rule-02 is satisfied.
Rule-03:
Since all the rules are satisfied, therefore given block is a CIDR block.
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 24.
To have 24 total number of IP Addresses, total 4 bits are required in the Host ID
part.
So, Number of bits present in the Network ID part = 32 – 4 = 28.
Thus,
NOTE-
Solution-
Rule-01:
Rule-02:
Rule-03:
Since all the rules are satisfied, therefore given block is a CIDR block.
129 | C N _ N U M E R I C A L S _ D D P
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 26.
To have 26 total number of IP Addresses, 6 bits are required in the Host ID part.
So, Number of bits in the Network ID part = 32 – 6 = 26.
Thus,
Problem-05:
Solution-
Rule-01:
Rule-02:
130 | C N _ N U M E R I C A L S _ D D P
According to Rule-02, size of the block must be presentable as 2n.
Total number of IP Addresses = 28 + 28 + 28 + 28 = 22 x 28 = 210.
So, Rule-02 is satisfied.
Rule-03:
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 210.
To have 210 total number of IP Addresses, 10 bits are required in the Host ID part.
So, Number of bits in the Network ID part = 32 – 10 = 22.
Thus,
Problem-06:
131 | C N _ N U M E R I C A L S _ D D P
Solution-
Rule-01:
Rule-02:
Rule-03:
Since all the 3 rules are not satisfied, so they can not be aggregated.
132 | C N _ N U M E R I C A L S _ D D P
1. Fixed Length Subnetting
2. Variable Length Subnetting
Fixed length subnetting also called as classful subnetting divides the network into
subnets where-
All the subnets are of same size.
All the subnets have equal number of hosts.
All the subnets have same subnet mask.
Variable length subnetting also called as classless subnetting divides the network
into subnets where-
All the subnets are not of same size.
All the subnets do not have equal number of hosts.
All the subnets do not have same subnet mask.
Subnetting Examples-
Example-01:
133 | C N _ N U M E R I C A L S _ D D P
Consider-
We have a big single network having IP Address 200.1.2.0.
We want to do subnetting and divide this network into 2 subnets.
For creating two subnets and to represent their subnet IDs, we require 1 bit.
So,
We borrow one bit from the Host ID part.
After borrowing one bit, Host ID part remains with only 7 bits.
134 | C N _ N U M E R I C A L S _ D D P
200.1.2.00000000 = 200.1.2.0
200.1.2.10000000 = 200.1.2.128
Example-02:
135 | C N _ N U M E R I C A L S _ D D P
Consider-
We have a big single network having IP Address 200.1.2.0.
We want to do subnetting and divide this network into 4 subnets.
For creating four subnets and to represent their subnet IDs, we require 2 bits.
So,
We borrow two bits from the Host ID part.
After borrowing two bits, Host ID part remains with only 6 bits.
136 | C N _ N U M E R I C A L S _ D D P
IP Address of the four subnets are-
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
137 | C N _ N U M E R I C A L S _ D D P
Range of IP Addresses = [200.1.2.01000000, 200.1.2.01111111] = [200.1.2.64,
200.1.2.127]
Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
Limited Broadcast Address = 255.255.255.255
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.
138 | C N _ N U M E R I C A L S _ D D P
Step-01: Dividing Given Network into 2 Subnets-
For creating two subnets and to represent their subnet IDs, we require 1 bit.
So,
We borrow one more bit from the Host ID part.
After borrowing one bit, Host ID part remains with only 6 bits.
139 | C N _ N U M E R I C A L S _ D D P
If 2nd borrowed bit = 0, then it represents one subnet.
If 2nd borrowed bit = 1, then it represents the other subnet.
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
140 | C N _ N U M E R I C A L S _ D D P
IP Address of the subnet = 200.1.2.0
Total number of IP Addresses = 27 = 128
Total number of hosts that can be configured = 128 – 2 = 126
Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0,
200.1.2.127]
Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
Limited Broadcast Address = 255.255.255.255
Disadvantages of Subnetting-
Point-01:
141 | C N _ N U M E R I C A L S _ D D P
During subnetting,
We have to face a loss of IP Addresses.
This is because two IP Addresses are wasted for each subnet.
One IP address is wasted for its network address.
Other IP Address is wasted for its direct broadcasting address.
Point-02:
Problem-01:
Solution-
Problem-02:
Solution-
Problem-03:
143 | C N _ N U M E R I C A L S _ D D P
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.
In class C-
24 bits are reserved for the Network ID part.
8 bits are reserved for the Host ID part.
Example-02:
NOTE
In fixed length subnetting,
All the subnets have same subnet mask since the
size of each subnet is same.
Example-03:
145 | C N _ N U M E R I C A L S _ D D P
For Subnet A-
For subnet A-
24 bits identify the global network.
1 bit identify the subnet.
7 bits identify the host.
146 | C N _ N U M E R I C A L S _ D D P
NOTE
In variable length subnetting,
All the subnets do not have same subnet mask since
the size of each subnet is not same.
Subnet mask is used to determine to which subnet the given IP Address belongs
to.
Important Notes-
Note-01:
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).
147 | C N _ N U M E R I C A L S _ D D P
Problem-01:
Solution-
Since 25 bits contain the value 1 and 7 bits contain the value 0, so-
Number of Net ID bits + Number of Subnet ID bits = 25
Number of Host ID bits = 7
Now,
It is given that subnet mask belongs to class C.
So, Number of Net ID bits = 24.
Thus,
Number of subnets = 21 = 2
148 | C N _ N U M E R I C A L S _ D D P
Number of hosts per subnet = 27 – 2 = 126
Problem-02:
Solution-
Since 21 bits contain the value 1 and 11 bits contain the value 0, so-
Number of Net ID bits + Number of Subnet ID bits = 21
Number of Host ID bits = 11
149 | C N _ N U M E R I C A L S _ D D P
Example-03:
For Subnet A-
For subnet A-
24 bits identify the global network.
1 bit identify the subnet.
7 bits identify the host.
150 | C N _ N U M E R I C A L S _ D D P
For subnet B and subnet C, subnet mask is obtained-
By setting the first 26 bits to 1.
By setting the remaining 6 bits to 0.
Subnet mask is used to determine to which subnet the given IP Address belongs
to.
Important Notes-
Note-01:
Note-02:
Note-03:
For a network having larger size, its subnet mask will be smaller (number of 1’s
will be less).
151 | C N _ N U M E R I C A L S _ D D P
For a network having smaller size, its subnet mask will be larger (number of 1’s
will be more).
Problem-01:
Solution-
Since 25 bits contain the value 1 and 7 bits contain the value 0, so-
Number of Net ID bits + Number of Subnet ID bits = 25
Number of Host ID bits = 7
Now,
It is given that subnet mask belongs to class C.
So, Number of Net ID bits = 24.
152 | C N _ N U M E R I C A L S _ D D P
Substituting in the above equation, we get-
Number of Subnet ID bits
= 25 – 24
=1
Thus,
Number of subnets = 21 = 2
Problem-02:
Solution-
Since 21 bits contain the value 1 and 11 bits contain the value 0, so-
Number of Net ID bits + Number of Subnet ID bits = 21
Number of Host ID bits = 11
153 | C N _ N U M E R I C A L S _ D D P
Since number of Host ID bits = 11, so-
Problem-01:
Given the CIDR representation 20.10.30.35 / 27. Find the range of IP Addresses in
the CIDR block.
Solution-
It suggests-
27 bits are used for the identification of network.
Remaining 5 bits are used for the identification of hosts in the network.
So,
First IP Address = 00010100.00001010.00011110.00100000 = 20.10.30.32
Last IP Address = 00010100.00001010.00011110.00111111 = 20.10.30.63
Problem-02:
154 | C N _ N U M E R I C A L S _ D D P
Given the CIDR representation 100.1.2.35 / 20. Find the range of IP Addresses in
the CIDR block.
Solution-
It suggests-
20 bits are used for the identification of network.
Remaining 12 bits are used for the identification of hosts in the network.
So,
First IP Address = 01100100.00000001.00000000.00000000 = 100.1.0.0
Last IP Address = 01100100.00000001.00001111.11111111 = 100.1.15.255
Problem-03:
Solution-
Rule-01:
155 | C N _ N U M E R I C A L S _ D D P
According to Rule-01, all the IP Addresses must be contiguous.
Clearly, all the given IP Addresses are contiguous.
So, Rule-01 is satisfied.
Rule-02:
Rule-03:
Since all the rules are satisfied, therefore given block is a CIDR block.
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 24.
To have 24 total number of IP Addresses, total 4 bits are required in the Host ID
part.
So, Number of bits present in the Network ID part = 32 – 4 = 28.
Thus,
156 | C N _ N U M E R I C A L S _ D D P
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-
Rule-01:
Rule-02:
Rule-03:
Since all the rules are satisfied, therefore given block is a CIDR block.
CIDR Representation-
157 | C N _ N U M E R I C A L S _ D D P
We have-
Size of the block = Total number of IP Addresses = 26.
To have 26 total number of IP Addresses, 6 bits are required in the Host ID part.
So, Number of bits in the Network ID part = 32 – 6 = 26.
Thus,
Problem-05:
Solution-
Rule-01:
Rule-02:
158 | C N _ N U M E R I C A L S _ D D P
So, Rule-02 is satisfied.
Rule-03:
CIDR Representation-
We have-
Size of the block = Total number of IP Addresses = 210.
To have 210 total number of IP Addresses, 10 bits are required in the Host ID part.
So, Number of bits in the Network ID part = 32 – 10 = 22.
Thus,
Problem-06:
Solution-
159 | C N _ N U M E R I C A L S _ D D P
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:
IPv4 Header-
160 | C N _ N U M E R I C A L S _ D D P
PRACTICE PROBLEMS BASED ON IP HEADER AND IP
FRAGMENTATION-
Problem-01:
The intermediate routers between source and destination need the following
information in IP header-
1. Version
2. Protocol
3. Identification Number
4. Source IP Address
Solution-
Option-A:
161 | C N _ N U M E R I C A L S _ D D P
Option-B:
Option-C:
Option-D:
Problem-02:
Solution-
162 | C N _ N U M E R I C A L S _ D D P
So, fragmentation may be required in datagram circuits as well as virtual circuits.
Thus, Option (C) is correct.
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-
Problem-04:
Solution-
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 ___ ?
163 | C N _ N U M E R I C A L S _ D D P
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-
Problem-07:
164 | C N _ N U M E R I C A L S _ D D P
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.
165 | C N _ N U M E R I C A L S _ D D P
So,
Fragment offset value for 1st fragment = 0
Fragment offset value for 2nd fragment = 176 / 8 = 22
Fragment offset value for 3rd fragment = (176+176) / 8 = 44
Fragment offset value for 4th fragment = (176 + 176 + 176) / 8 = 66
IP Fragmentation Examples-
Example-01:
Consider-
There is a host A present in network X having MTU = 520 bytes.
There is a host B present in network Y having MTU = 200 bytes.
Host A wants to send a message to host B.
166 | C N _ N U M E R I C A L S _ D D P
Step-01:
Router concludes-
Size of the datagram is greater than MTU.
So, it will have to divide the datagram into fragments.
DF bit is set to 0.
So, it is allowed to create fragments of the datagram.
Step-02:
Router decides the amount of data that it should transmit in each fragment.
Router knows-
MTU of the destination network = 200 bytes.
So, maximum total length of any fragment can be only 200 bytes.
Out of 200 bytes, 20 bytes will be taken by the header.
So, maximum amount of data that can be sent in any fragment = 180 bytes.
Router uses the following rule to choose the amount of data that will be transmitted
in one fragment-
RULE
167 | C N _ N U M E R I C A L S _ D D P
It is a multiple of 8 so that pure decimal value can
be obtained for the fragment offset field.
NOTE
Step-03:
168 | C N _ N U M E R I C A L S _ D D P
The information contained in the IP header of each fragment is-
169 | C N _ N U M E R I C A L S _ D D P
MF bit = 1
Fragment offset field value = 176 / 8 = 22
Header checksum is recalculated.
Identification number is same as that of original datagram.
Step-04:
At destination side,
Receiver receives 3 fragments of the datagram.
Reassembly algorithm is applied to combine all the fragments to obtain the
original datagram.
Example-02:
Consider-
There is a host A present in network X having MTU = 520 bytes.
There is a host B present in network Y having MTU = 200 bytes.
There exists a network Z having MTU = 110 bytes.
Host A wants to send a message to host B.
170 | C N _ N U M E R I C A L S _ D D P
Consider Router-1 receives a datagram from host A having-
Header length = 20 bytes
Payload length = 500 bytes
Total length = 520 bytes
DF bit set to 0
Then,
First fragment contains the data = 176 bytes
Second fragment contains the data = 176 byes
Third fragment contains the data = 148 bytes
Now, consider-
171 | C N _ N U M E R I C A L S _ D D P
First and third fragment reaches the destination directly.
However, second fragment takes its way through network Z and reach the
destination through Router-3.
Now, let us discuss the journey of fragment-2 and how it finally reaches the
destination.
Step-01:
Router-2 concludes-
Size of the datagram is greater than MTU.
So, it will have to divide the datagram into fragments.
DF bit is set to 0.
So, it is allowed to create fragments of the datagram.
Step-02:
Router-2 decides the amount of data that it should transmit in each fragment.
172 | C N _ N U M E R I C A L S _ D D P
Router-2 knows-
MTU of the destination network = 110 bytes.
So, maximum total length of any fragment can be only 110 bytes.
Out of 110 bytes, 20 bytes will be taken by the header.
So, maximum amount of data that can be sent in any fragment = 90 bytes.
Step-03:
173 | C N _ N U M E R I C A L S _ D D P
The information contained in the IP header of each fragment is-
NOTE-
NOTE-
Router-2 transmits both the fragments which reaches the destination through
Router-3.
Router-3 performs no fragmentation.
Step-04:
At destination side,
Receiver receives 4 fragments of the datagram.
Reassembly algorithm is applied to combine all the fragments to obtain the
original datagram.
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.
175 | C N _ N U M E R I C A L S _ D D P
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
176 | C N _ N U M E R I C A L S _ D D P
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
Intermediate
1 !=0
Fragment
177 | C N _ N U M E R I C A L S _ D D P
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:
Note-09:
178 | C N _ N U M E R I C A L S _ D D P
2. The MF bit bit value for the last re-fragment is always same as its parent.
Problem-01:
The intermediate routers between source and destination need the following
information in IP header-
1. Version
2. Protocol
3. Identification Number
4. Source IP Address
Solution-
Option-A:
Option-B:
Option-C:
179 | C N _ N U M E R I C A L S _ D D P
Option-D:
Problem-02:
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
180 | C N _ N U M E R I C A L S _ D D P
Solution-
Problem-04:
Solution-
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-
181 | C N _ N U M E R I C A L S _ D D P
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-
Problem-07:
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?
182 | C N _ N U M E R I C A L S _ D D P
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.
So,
Fragment offset value for 1st fragment = 0
Fragment offset value for 2nd fragment = 176 / 8 = 22
Fragment offset value for 3rd fragment = (176+176) / 8 = 44
Fragment offset value for 4th fragment = (176 + 176 + 176) / 8 = 66
Problem-04:
If WAN link is 2 Mbps and RTT between source and destination is 300 msec, what
would be the optimal TCP window size needed to fully utilize the line?
183 | C N _ N U M E R I C A L S _ D D P
1. 60,000 bits
2. 75,000 bytes
3. 75,000 bits
4. 60,000 bytes
Solution-
Given-
Bandwidth = 2 Mbps
RTT = 300 msec
Problem-05:
Suppose host A is sending a large file to host B over a TCP connection. The two
end hosts are 10 msec apart (20 msec RTT) connected by a 1 Gbps link. Assume
that they are using a packet size of 1000 bytes to transmit the file. For simplicity,
ignore ack packets. At least how big would the window size (in packets) have to be
for the channel utilization to be greater than 80%?
1. 1000
2. 1500
3. 2000
4. 2500
184 | C N _ N U M E R I C A L S _ D D P
Solution-
Given-
RTT = 20 msec
Bandwidth = 1 Gbps
Packet size = 1000 bytes
Efficiency >= 80%
In terms of packets,
Window size
= 1.6 x 107 bits / Packet size
= 1.6 x 107 bits / (1000 x 8 bits)
= 0.2 x 104 packets
185 | C N _ N U M E R I C A L S _ D D P
= 2000 packets
Problem-06:
A TCP machine is sending windows of 65535 B over a 1 Gbps channel that has a
10 msec one way delay.
1. What is the maximum throughput achievable?
2. What is the line efficiency?
Solution-
Given-
Window size = 65535 bytes
Bandwidth = 1 Gbps
One way delay = 10 msec
Method-01:
Thus,
Line Efficiency(η)
= Amount of data being sent in 1 RTT / Maximum amount of data that can be sent
in 1 RTT
186 | C N _ N U M E R I C A L S _ D D P
= 65535 bytes / 25 x 105 bytes
= 0.026214
= 2.62%
Now,
Maximum Achievable Throughput
= Efficiency x Bandwidth
= 0.0262 x 1 Gbps
= 26.214 Mbps
Method-02:
Now,
Line Efficiency
= Throughput / Bandwidth
= 26.214 Mbps / 1 Gbps
= 26.214 x 10-3
= 0.026214
= 2.62%
Problem-04:
If WAN link is 2 Mbps and RTT between source and destination is 300 msec, what
would be the optimal TCP window size needed to fully utilize the line?
1. 60,000 bits
2. 75,000 bytes
187 | C N _ N U M E R I C A L S _ D D P
3. 75,000 bits
4. 60,000 bytes
Solution-
Given-
Bandwidth = 2 Mbps
RTT = 300 msec
Problem-05:
Suppose host A is sending a large file to host B over a TCP connection. The two
end hosts are 10 msec apart (20 msec RTT) connected by a 1 Gbps link. Assume
that they are using a packet size of 1000 bytes to transmit the file. For simplicity,
ignore ack packets. At least how big would the window size (in packets) have to be
for the channel utilization to be greater than 80%?
1. 1000
2. 1500
3. 2000
4. 2500
Solution-
188 | C N _ N U M E R I C A L S _ D D P
Given-
RTT = 20 msec
Bandwidth = 1 Gbps
Packet size = 1000 bytes
Efficiency >= 80%
In terms of packets,
Window size
= 1.6 x 107 bits / Packet size
= 1.6 x 107 bits / (1000 x 8 bits)
= 0.2 x 104 packets
= 2000 packets
189 | C N _ N U M E R I C A L S _ D D P
Thus, Option (C) is correct.
Problem-06:
A TCP machine is sending windows of 65535 B over a 1 Gbps channel that has a
10 msec one way delay.
1. What is the maximum throughput achievable?
2. What is the line efficiency?
Solution-
Given-
Window size = 65535 bytes
Bandwidth = 1 Gbps
One way delay = 10 msec
Method-01:
Thus,
Line Efficiency(η)
= Amount of data being sent in 1 RTT / Maximum amount of data that can be sent
in 1 RTT
= 65535 bytes / 25 x 105 bytes
= 0.026214
190 | C N _ N U M E R I C A L S _ D D P
= 2.62%
Now,
Maximum Achievable Throughput
= Efficiency x Bandwidth
= 0.0262 x 1 Gbps
= 26.214 Mbps
Method-02:
Now,
Line Efficiency
= Throughput / Bandwidth
= 26.214 Mbps / 1 Gbps
= 26.214 x 10-3
= 0.026214
= 2.62%
Problem-04:
If WAN link is 2 Mbps and RTT between source and destination is 300 msec, what
would be the optimal TCP window size needed to fully utilize the line?
1. 60,000 bits
2. 75,000 bytes
3. 75,000 bits
4. 60,000 bytes
191 | C N _ N U M E R I C A L S _ D D P
Solution-
Given-
Bandwidth = 2 Mbps
RTT = 300 msec
Problem-05:
Suppose host A is sending a large file to host B over a TCP connection. The two
end hosts are 10 msec apart (20 msec RTT) connected by a 1 Gbps link. Assume
that they are using a packet size of 1000 bytes to transmit the file. For simplicity,
ignore ack packets. At least how big would the window size (in packets) have to be
for the channel utilization to be greater than 80%?
1. 1000
2. 1500
3. 2000
4. 2500
Solution-
Given-
192 | C N _ N U M E R I C A L S _ D D P
RTT = 20 msec
Bandwidth = 1 Gbps
Packet size = 1000 bytes
Efficiency >= 80%
In terms of packets,
Window size
= 1.6 x 107 bits / Packet size
= 1.6 x 107 bits / (1000 x 8 bits)
= 0.2 x 104 packets
= 2000 packets
193 | C N _ N U M E R I C A L S _ D D P
Problem-06:
A TCP machine is sending windows of 65535 B over a 1 Gbps channel that has a
10 msec one way delay.
1. What is the maximum throughput achievable?
2. What is the line efficiency?
Solution-
Given-
Window size = 65535 bytes
Bandwidth = 1 Gbps
One way delay = 10 msec
Method-01:
Thus,
Line Efficiency(η)
= Amount of data being sent in 1 RTT / Maximum amount of data that can be sent
in 1 RTT
= 65535 bytes / 25 x 105 bytes
= 0.026214
= 2.62%
194 | C N _ N U M E R I C A L S _ D D P
Now,
Maximum Achievable Throughput
= Efficiency x Bandwidth
= 0.0262 x 1 Gbps
= 26.214 Mbps
Method-02:
Now,
Line Efficiency
= Throughput / Bandwidth
= 26.214 Mbps / 1 Gbps
= 26.214 x 10-3
= 0.026214
= 2.62%
Problem-01:
Problem-02:
Consider the effect of using slow start on a line with a 10 msec RTT and no
congestion. The receiver window is 24 KB and the maximum segment size is 2
KB. How long does it take before the first full window can be sent?
Solution-
Given-
Receiver window size = 24 KB
Maximum Segment Size = 2 KB
RTT = 10 msec
196 | C N _ N U M E R I C A L S _ D D P
Slow Start Phase-
Since the threshold is reached, so it marks the end of slow start phase.
Now, congestion avoidance phase begins.
From here,
Window size at the end of 9th transmission or at the start of 10 th transmission is 12
MSS.
Thus, 9 RTT’s will be taken before the first full window can be sent.
So,
Time taken before the first full window is sent
= 9 RTT’s
= 9 x 10 msec
= 90 msec
Problem-03:
197 | C N _ N U M E R I C A L S _ D D P
Consider an instance of TCP’s Additive Increase Multiplicative Decrease (AIMD)
algorithm where the window size at the start of slow start phase is 2 MSS and the
threshold at the start of first transmission is 8 MSS. Assume that a time out occurs
during the fifth transmission. Find the congestion window size at the end of tenth
transmission.
1. 8 MSS
2. 14 MSS
3. 7 MSS
4. 12 MSS
Solution-
Given-
Window size at the start of slow start phase = 2 MSS
Threshold at the start of first transmission = 8 MSS
Time out occurs during 5th transmission
Since the threshold is reached, so it marks the end of slow start phase.
Now, congestion avoidance phase begins.
198 | C N _ N U M E R I C A L S _ D D P
TCP reacts by-
Setting the slow start threshold to half of the current congestion window size.
Decreasing the congestion window size to 2 MSS (Given value is used).
Resuming the slow start phase.
So now,
Slow start threshold = 10 MSS / 2 = 5 MSS
Congestion window size = 2 MSS
Since the threshold is reached, so it marks the end of slow start phase.
Now, congestion avoidance phase begins.
From here,
Window size at the end of 10th transmission
= Window size at the start of 11th transmission
= 8 MSS
Problem-04:
199 | C N _ N U M E R I C A L S _ D D P
Suppose that the TCP congestion window is set to 18 KB and a time out occurs.
How big will the window be if the next four transmission bursts are all successful?
Assume that the MSS is 1 KB.
Solution-
So now,
Slow start threshold = 18 MSS / 2 = 9 MSS
Congestion window size = 1 MSS
200 | C N _ N U M E R I C A L S _ D D P
Thus, after 4 successful transmissions, window size will be 9 MSS or 9 KB.
Problem-05:
Part-01:
Part-02:
Solution-
Part-01:
201 | C N _ N U M E R I C A L S _ D D P
= 4096 B
Thus, Option (B) is correct.
Part-02:
Given-
Last byte acknowledged by the receiver = 8192
Last byte sent by the sender = 10240
From here,
It means bytes from 8193 to 10240 are still present in the sender’s window.
These bytes are waiting for their acknowledgement.
Total bytes present in sender’s window = 10240 – 8193 + 1 = 2048 bytes.
From here,
Amount of free space in sender’s window currently
= 4096 bytes – 2048 bytes
= 2048 bytes
202 | C N _ N U M E R I C A L S _ D D P
sam_2200
Read
Discuss
User Datagram Protocol is a Transport Layer protocol. UDP is a part of the
Internet Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an unreliable
and connectionless protocol. So, there is no need to establish a connection prior to
data transfer. Though Transmission Control Protocol (TCP) is the dominant
transport layer protocol used with most Internet services; provides assured
203 | C N _ N U M E R I C A L S _ D D P
delivery, reliability, and much more but all these services cost us additional
overhead and latency. Here, UDP comes into the picture. For real-time services
like computer gaming, voice or video communication, live conferences; we need
UDP. Since high performance is needed, UDP permits packets to be dropped
instead of processing delayed packets. There is no error checking in UDP, so it
also saves bandwidth.
User Datagram Protocol (UDP) is more efficient in terms of both latency and
bandwidth.
UDP header :
UDP header is an 8-bytes fixed and simple header. The first 8 Bytes contains all
necessary header information and the remaining part consist of data. UDP port
number fields are each 16 bits long, therefore the range for port numbers defined
from 0 to 65535; port number 0 is reserved. Port numbers help to distinguish
different user requests or processes.
Example-1 :
Given a DUMP of a UDP header in hexadecimal format 06 32 00 0D 00 1C E2
17. Find the following:-
1. Source port number?
2. Destination port number?
204 | C N _ N U M E R I C A L S _ D D P
3. Length of user datagram?
4. Length of the data?
Solution :
1. Source Port –
Source Port is 2 Byte long field used to identify the port number of the source.
The source port number is the first four hexadecimal digits i.e. 06 32 if we
convert hexadecimal to decimal we get 1586.
2. Destination Port –
It is a 2 Byte long field, used to identify the port of the destined packet. The
destination port number is the second four hexadecimal digits 00 0D if we
convert hexadecimal to decimal we get 13
3. Length –
Length is the length of UDP including the header and the data. It is a 16-bits
field. The third four hexadecimal digits 00 1C if we convert hexadecimal to
decimal we get 16 define the length of the whole UDP packet as 28
4. Length of the header –
It is 8 bytes as it is fixed. The length of the data is the length of the whole packet
— the length of the header i.e. 28 – 8 = 20 bytes.
Example-2 :
Given a DUMP of a UDP header in hexadecimal format 04 21 00 0B 00 2A E2
17. Find the following:-
1. Source port number?
2. Destination port number?
3. Length of user datagram?
4. Length of the data?
Solution:
1. The source port number is the first four hexadecimal digits i.e. 04 21 if we
convert hexadecimal to decimal we get 1057
2. The destination port number is the second four hexadecimal digits 00 0B if we
convert hexadecimal to decimal we get 11
3. The third four hexadecimal digits 00 2A if we convert hexadecimal to decimal 42
define the length of the whole UDP packet as 28
4. The length of the data is the length of the whole packet — the length of the
header i.e. 28 – 8 = 20 bytes.
Example-3 :
Given a DUMP of a UDP header in hexadecimal format 03 61 10 1A 10 4C Y2 42.
Find the following:-
1. Source port number?
2. Destination port number?
205 | C N _ N U M E R I C A L S _ D D P
3. Length of user datagram?
4. Length of the data?
Solution:
1. The source port number is the first four hexadecimal digits i.e. 03 61 if we
convert hexadecimal to decimal we get 0865
2. The destination port number is the second four hexadecimal digits 10 1A if we
convert hexadecimal to decimal we get 4122
3. The third four hexadecimal digits 10 4C if we convert hexadecimal to decimal
4172 define the length of the whole UDP packet as 28
4. The length of the data is the length of the whole packet — the length of the
header i.e. 28 – 8 = 20 bytes.
Problems: TCP and UDP 1. The TCP sliding windows are byte-oriented. What does this mean? 2. A TCP
connection is using a window size of 10 000 bytes, and the previous acknowledgment number was 22
001. It receives a segment with acknowledgment number 24 001.
Draw a diagram to show the situation of the window before and after.
3. A client uses UDP to send data to a server. The data are 16 bytes. Calculate the efficiency of this
transmission at the UDP level (ratio of useful bytes to total bytes).
5. A client uses TCP to send data to a server. The data are 16 bytes. Calculate the efficiency of this
transmission at the TCP level (ratio of useful bytes to total bytes, assume no options).
6. Redo Exercise 5., calculating the efficiency of transmission at the IP level using
7. Comment on the results in Exercises 3.–6.. Give examples of applications where it is good to use UDP
and TCP respectively.
206 | C N _ N U M E R I C A L S _ D D P
(c) Total length of the UDP
(e) Considering that an IP frame can have a maximum total length of 65 535 bytes, what is the maximum
length of the data in a UDP frame?
Solutions:
1.It means that the sequence and acknowledgement numbers refer to bytes instead of segments. For
example, the value of the ack-field in a segment defines the number of the next byte a party expects to
receive. 1 Figure 1: Sliding window of Exercise 2..
3. Data are 16 bytes, length of UDP header is 8 bytes, so the ratio is 16 16+8 = 2 3 .
4. Data are 16 bytes, length of IP header (no options) + UDP header is 28 bytes, so the ratio is 16 28+16 =
0.364.
5. Data are 16 bytes, length of TCP header (no options) is 20 bytes, so the ratio is 16 20+16 = 4 9 . 6. Data
are 16 bytes, length of IP header (no options) + TCP header (no options) is 40 bytes, so the ratio is 16
16+40 = 0.286.
7. UDP is a very simple protocol with minimal overhead. If a process wants to send a small message and
does not care much about reliability, it can use UDP. Sending a small message using UDP takes much less
interaction between sender and receiver than using TCP. UDP is used in multimedia and multicast
applications, such as multiplayer games. If reliability is wanted on the other hand, TCP should be chosen.
FTP and Telnet use TCP as transport layer protocol.
8. The UDP header has four parts, each of two bytes. That means we get the following interpretation of
the header.
207 | C N _ N U M E R I C A L S _ D D P
(a) Source port number = 063216 = 1586
(e) The IP header is minimum 20 bytes, which gives the maximum payload 65515 bytes. To fit a UDP
frame in this with header of 8 bytes we get data 65515−8 = 65507 bytes.
208 | C N _ N U M E R I C A L S _ D D P