M3 Questions and Answers
M3 Questions and Answers
a) A subnet
Q2: Discuss the shortest path routing. Also explain the Dijkstra's algorithm in detail
A:
-It is one of the simple static routing algorithms that are widely used for routing in the network.
-The basic idea is to build a graph with each node representing a router and each line representing a
communication link.
- A path selected can be called shortest in many contexts. If cost is selected as the criteria then the shortest
path is the route which is least expensive. The cost is determined depending upon the criteria to be optimized,
they include:
● Minimum number of hops: If each link is given a unit cost, the shortest path is the one with minimum
number of hops. Such a route is easily obtained by a breadth first search method. This is easy to
implement but ignores load, link capacity etc.
● Transmission and Propagation Delays: If the cost is fixed as a function of transmission and
propagation delays, it will reflect the link capacities and the geographical distances. However these
costs are essentially static and do not consider the varying load conditions.
● Queuing Delays: If the cost of a link is determined through its queuing delays, it takes care of the
varying load conditions, but not of the propagation delays.
Dijkstra’s algorithm
It is a single-source shortest path algorithm, i.e. only one source is given, and we have to find the shortest path
from the source to all the nodes.
STEPS:
1. Consider any vertex as the source vertex. Here, let's take 0 as the
source. eg:
3. Find the distance from source to the directly connected vertices and update them.
Use the formula:
If d(x) + c(x,y) < d(y) Then, d(y)= d(x) + c(x,y)
{here, d(x) is the distance between source and x. c(x,y) is the cost or distance between the vertices x
and y}
Here in the example, 1 and 4 are directly connected to the source 0.
so , d(1)=d(0) + c(0,1) < ∞
I.e. d(1)= 0+4=4 < ∞
Similarly, d(4)= d(0) + c(0,4) <∞
i.e d(4)=0+8=8 <∞
4. Compare the distance of vertices except the source vertex and select the vertex with minimum
distance. Here, we select vertex 1.
5. Then consider the vertices directly connected to the selected vertex. Here, we have 2 paths from
vertex 1 : to vertex 2 and 4. Calculate the distance using the formula and update the graph.
d(2)= d(1) +c(1,2) = 4 + 8=12 < ∞
d(4)=d(1) +c(1,4)=4+11=15 > 8 (no updation)
6. Now compare the distances of vertices which were not selected previously and select the vertex with
minimum distance. Here, we select the vertex 4. Now repeat step 5.
d(8)=d(4)+c(4,8) = 8+7=15 < ∞
d(5)=d(4) +c(4,5)= 8+1=9 <∞
8. Select vertex 6
d(2)=d(6)+c(6,2)=11+4=15 > 12 (no updation)
d(3)= d(6)+c(6,3)=11+14=25 <∞
d(7)= d(6) +c(6,7)=11+10=21<∞
SCET S5 CSA BATCH 2020-25 Page 3
9. Select vertex 2
d(3)=d(2)+c(2,3)=12+7=19 <25
d(8)= d(2) + c(2,8)=12+2=14
<15
Q4: Describe the distance vector routing algorithm in detail (include count- to- infinity
topic)
A:
● The Distance vector algorithm is a dynamic algorithm.
● It is also called Bellman-Ford routing algorithm and the Ford-Fulkerson algorithm
● It is mainly used in ARPANET, and RIP.
Distance Vector Routing algorithm – working
● A router transmits its distance vector to each of its neighbors in a routing packet.
● Each router receives and saves the most recently received distance vector from each of its neighbors.
● A router recalculates its distance vector when:
○ It receives a distance vector from a neighbor containing different information than before.
○ It discovers that a link to a neighbor has gone down.
● The DV calculation is based on minimizing the cost to each destination
● From time-to-time, each node sends its own distance vector estimate to neighbors.
● When a node x receives new DV estimate from any neighbor v, it saves v’s distance vector and
it updates its own DV using B-F equation:
Dx(y) = min { C(x,v) + Dv(y), Dx(y) } for each node y ∈ N
Example
• Consider 3-routers X, Y and Z as shown in figure. Each router has their routing table. Every routing table
will contain distance to the destination nodes.
• Consider router X , X will share its routing table to neighbors and neighbors will share its routing table to
X and distance from node X to destination will be calculated using bellmen- ford equation.
Dx(y) = min { C(x,v) + Dv(y)} for each node y ∈ N
• As we can see that distance will be less going from X to Z when Y is an intermediate node(hop) so it will
be updated in routing table X. Similarly for Z also. Finally the routing table for all nodes will be:
● Now imagine that the link between A and B is cut. At this time, B corrects its table.
● After a specific amount of time, routers exchange their tables, and so B receives C's routing table.
● Since C doesn't know what has happened to the link between A and B, it says that it has a link to
A with the weight of 2 (1 for C to B, and 1 for B to A -- it doesn't know B has no link to A).
● B receives this table and thinks there is a separate link between C and A, so it corrects its table
and changes infinity to 3 (1 for B to C, and 2 for C to A, as C said).
● Once again, routers exchange their tables.
● When C receives B's routing table, it sees that B has changed the weight of its link to A from 1 to 3,
so C updates its table and changes the weight of the link to A to 4 (1 for C to B, and 3 for B to A, as B
said).
● This process loops until all nodes find out that the weight of link to A is infinity.
● One way to solve this problem is for routers to send information only to the neighbors that are
not exclusive links to the destination.
● For example, in this case, C shouldn't send any information to B about A, because B is the only way
to A.
● In addition, each area has a home agent, which keeps track of hosts whose home is in the area,
but who are currently visiting another area.
● When a new host enters an area, either by connecting to it (e.g., plugging into the LAN) or
just wandering into the cell, his computer must register itself with the foreign agent there.
● The registration procedure typically works like this:
○ Periodically, each foreign agent broadcasts a packet announcing its existence and address. A
newly-arrived mobile host may wait for one of these messages, but if none arrives quickly
enough, the mobile host can broadcast a packet saying: Are there any foreign agents around?
○ The mobile host registers with the foreign agent, giving its home address, current data
link layer address, and some security information.
○ The foreign agent contacts the mobile host's home agent and says: One of your hosts is over
here. The message from the foreign agent to the home agent contains the foreign agent's
network address. It also includes the security information to convince the home agent that
the mobile host is really there.
○ The home agent examines the security information, which contains a timestamp, to
prove that it was generated within the past few seconds. If it is happy, it tells the foreign
agent to proceed.
○ When the foreign agent gets the acknowledgement from the home agent, it makes an
entry in its tables and informs the mobile host that it is now registered.
Q7: What is meant by congestion in networks? What are the different congestion control
techniques /what is open loop and closed loop congestion control?
A:
● When too many packets are present in (a part of) the subnet, performance degrades. This situation is
called congestion.
● Congestion control refers to techniques and mechanisms that can either prevent congestion, before it
happens, or remove congestion after it has happened.
In open-loop congestion control, policies are applied to prevent congestion before it happens. In these
mechanisms, congestion control is handled by either the source or the destination.
Retransmission Policy
● Retransmission is sometimes unavoidable. If the sender feels that a sent packet is lost or corrupted,
the packet needs to be retransmitted.
● Retransmission in general may increase congestion in the network. However, a good retransmission
policy can prevent congestion.
● The retransmission policy and the retransmission timers must be designed to optimize efficiency and
at the same time prevent congestion.
● For example, the retransmission policy used by TCP is designed to prevent congestion.
Window Policy
● The type of window at the sender may also affect congestion.
● The Selective Repeat window is better than the Go-Back-N window for congestion control.
● In the Go-Back-N window, when the timer for a packet times out, several packets may be resent,
although some may have arrived safe and sound at the receiver. This duplication may make the
congestion worse.
● The Selective Repeat window, on the other hand, tries to send the specific packets that have been lost
or corrupted.
Acknowledgment Policy
● The acknowledgment policy imposed by the receiver may also affect congestion.
● If the receiver does not acknowledge every packet it receives, it may slow down the sender and help
prevent congestion.
● Several approaches are used in this case. A receiver may send an acknowledgment only if it has a
packet to be sent or a special timer expires.
● A receiver may decide to acknowledge only N packets at a time. We need to know that the
acknowledgments are also part of the load in a network.
● Sending fewer acknowledgments means imposing less load on the network.
Discarding Policy
● A good discarding policy by the routers may prevent congestion and at the same time may not harm
the integrity of the transmission.
Admission Policy
● An admission policy, which is a quality-of-service mechanism, can also prevent congestion in virtual-
circuit networks.
● Switches in a flow first check the resource requirement of a flow before admitting it to the network.
● A router can deny establishing a virtual circuit connection if there is congestion in the network or if
there is a possibility of future congestion.
Closed-Loop Congestion Control:
Closed-loop congestion control mechanisms try to alleviate congestion after it happens. Several mechanisms
have been used by different protocols.
Backpressure
● In backpressure, the warning is from one node to its upstream node, although the warning may
eventually reach the source station.
Choke Packet
● A choke packet is a packet sent by a node to the source to inform it of congestion.
● In the choke packet method, the warning is from the router, which has encountered congestion, to
the source station directly. The intermediate nodes through which the packet has traveled are not
warned.
Implicit Signaling
● In implicit signaling, there is no communication between the congested node or nodes and the
source. The source guesses that there is congestion somewhere in the network from other
symptoms.
● For example, when a source sends several packets and there is no acknowledgement for a while, one
assumption is that the network is congested.
● The delay in receiving an acknowledgment is interpreted as congestion in the network; the source
should slow down.
Explicit Signaling
● The node that experiences congestion can explicitly send a signal to the source or destination.
● Explicit signaling can occur in either the forward or the backward direction.
● Backward Signaling - A bit can be set in a packet moving in the direction opposite to the congestion.
This bit can warn the source that there is congestion and that it needs to slow down to avoid the
discarding of packets.
● Forward Signaling - A bit can be set in a packet moving in the direction of the congestion. This bit can
warn the destination that there is congestion. The receiver in this case can use policies, such as
slowing down the acknowledgments, to alleviate the congestion
Q8: List and explain various congestion control algorithms/define leaky bucket and token
bucket algorithm for congestion control.
A:
Leaky Bucket Algorithm
● Each host is connected to the network by an interface containing a leaky bucket, that is, a
finite internal queue.
● No matter the rate at which water enters the bucket, the outflow is at a constant rate.
● If a packet arrives at the queue when it is full, the packet is discarded.
Q9: What is meant by QoS? Explain the techniques for achieving good QoS.
A:
● Quality of Service (QoS) refers to the capability of a network to provide better service to
selected network traffic over various technologies, including Frame Relay, Asynchronous
Transfer Mode (ATM),Ethernet etc.
● Four parameters that determine QoS are:
○ Reliability: No bits must be delivered incorrectly.
○ Delay: The time it takes for a packet to go from its source to its end destination.
○ Jitter: The irregular speed of packets on a network as a result of congestion, which can result
in packets arriving late and out of sequence.
○ Bandwidth : Bandwidth management mechanisms measure and control traffic flows on the
network to avoid exceeding its capacity and the resulting network congestion that occurs.
Techniques for achieving good Quality of Services:
1. Scheduling
Packets from different flows arrive at a switch or router for processing. A good scheduling technique
treats the different flows in a fair and appropriate manner. Following are some scheduling techniques:
a) FIFO Queuing
● Packets wait in a buffer (queue) until the node (router or switch) is ready to
process them.
● If the average arrival rate is higher than the average processing rate, the queue will
fill up and new packets will be discarded.
b) Priority Queuing
● Packets are first assigned to a priority class. Each priority class has its own queue.
● The packets in the highest-priority queue are processed
● A priority queue can provide better QoS than the FIFO queue because higher priority
traffic, such as multimedia, can reach the destination with less delay.
● If there is a continuous flow in a high-priority queue, the packets in the lower-priority
queues will never have a chance to be processed. This is a condition called starvation.
2. Traffic shaping
● It is a mechanism to control the amount and the rate of the traffic sent to the network.
● Traffic shaping is about regulating the average rate (and burstiness) of data transmission.
● It reduces congestion.
● There are 2 techniques: Leaky bucket & Token bucket algorithms
i) Leaky Bucket Algorithm
● Each host is connected to the network by an interface containing a leaky bucket,
that is, a finite internal queue.
● No matter the rate at which water enters the bucket, the outflow is at a constant rate.
● If a packet arrives at the queue when it is full, the packet is discarded.
3. Resource reservation
● A flow of data needs resources such as a buffer, bandwidth, CPU time, and so on. The quality
of service is improved if these resources are reserved beforehand.
4. Admission control
● Admission control refers to the mechanism used by a router, or a switch, to accept or reject
a flow based on predefined parameters called flow specifications.
● Before a router accepts a flow for processing, it checks the flow specifications to see if its
capacity (in terms of bandwidth, buffer size, CPU speed, etc.) and its previous commitments
to other flows can handle the new flow.
Q10: Find the shortest path from node A to all other nodes using Dijkstra's algorithm.
A:
Source vertex: A
Assign distance infinity to all vertices, except source.
d(B)=d(A)+c(A,B)=0+2=2 < ∞
d(C)=d(A)+c(A,C)=0+5=5 < ∞
d(D)=d(A)+c(A,D)=0+4=4 <∞
Q11: Consider the following subnet. Distance vector routing is used and the following have
just come in to router E: from B: (13,0,6,10,4), from C: (11,7,0,10,1) and from D: (3,16,3,0,9).
The measured delays to B,C and D are 5,2,6 respectively. What is E’s new routing table?
Give both the outgoing line to use and the expected delay.
A:
B’s TABLE
A B C D E
B 13 0 6 10 4
E
C’s TABLE
A B C D E
C 11 7 0 10 1
D’s TABLE
A B C D E
D 3 16 3 0 9
E
Measured delay for B=5, So add 5 to B’s table
Outgoing line through B: (18,5,11,15,9)
Measured delay for C=2, so add 2 to C’s table
Outgoing line through C: (13,9,2,12,3)
Measured delay for D=6, so add 6 to D’s table
Outgoing line through D: (9,22,9,6,15)
Taking minimum for each destination (except E):
E’s table: (9,5,2,6,0)
Outgoing lines are: (D,B,C,D,-)
E’s TABLE
A B C D E
B 18 5 11 15 9
C 13 9 2 12 3
D 9 22 9 6 15
E 9 5 2 6 0