CN Mod3 NOTES
CN Mod3 NOTES
NETWORK LAYER ●
Implementation of connectionless service
●
Implementation of connection-oriented service
●
Comparison of virtual-circuit and datagram networks
Routing Routing decisions are made once during connection setup Routing decisions are made independently for each packet and can vary ●
A router might be connected to multiple routers
and remain fixed throughout the duration of the based on network conditions.
connection. ●
Each router has a routing table that decides the route to be followed for each packet
Flow Control Uses explicit flow control, where the sender adjusts its rate Uses implicit flow control, where the sender assumes a certain level of
●
Routers look into routing table when a new packet arrives.
of transmission based on feedback from the receiver. available bandwidth and sends packets accordingly. ●
It helps the network devices in deciding the best path for data packets as they move from their source to a destination.
●
Routing table
Congestion Uses end-to-end congestion control, where the sender Uses network-assisted congestion control, where routers monitor network
Control adjusts its rate of transmission based on feedback from the conditions and may drop packets or send congestion signals to the sender.
network.
Error Control Provides reliable delivery of packets by detecting and Provides unreliable delivery of packets and does not guarantee delivery or
retransmitting lost or corrupted packets. correctness.
●
Routing table consists of atleast 3 fields
Overhead Requires less overhead per packet because connection Requires more overhead per packet because each packet contains ●
1. Network ID: Destination Network ID
setup and state maintenance are done only once. information about its destination address and other routing information.
●
2. Cost : Cost or metric of the path through which the packet is to be sent
●
Multicast Routing
●
Routing for Mobile Hosts
●
Routing in Ad Hoc Networks
●
The set of optimal routes from all sources to a given destination form a tree
rooted at the destination. This tree is called a sink tree 2. shortest-paths algorithms
●
The distance metric is the number of hops.
●
It is one of the simple static routing algorithms that are widely used for routing in the
●
The goal of all routing algorithms is to discover and use the sink trees for all network.
routers ●
The basic idea of it is to build a graph with each node representing a router and each
line representing a communication link.
●
To choose a route between any two nodes in the graph, the algorithm simply finds the
shortest path between the nodes.
●
Shortest Path means that the path in which anyone or more metrics is minimized.
●
The metric may be distance, bandwidth, average traffic, communication cost, mean
queue length, measured delay or any other factor.
●
Common Shortest Path Algorithms
– Bellman Ford’s Algorithm
– Dijkstra’s Algorithm
– Floyd Warshall’s Algorithm
●
Consider the graph given below
2.1. Dijkstra's Algorithm
●
Dijkstra’s algorithm is a single-source shortest path algorithm.
●
Here, single-source means that only one source is given, and we have to find the shortest path from
the source to all the nodes.
●
The Dijkstra’s Algorithm is a greedy algorithm that is used to find the minimum distance between a
single node and all other nodes in a given graph. ●
First, we have to consider any vertex as a source vertex.
●
In this Algorithm , the criteria for shortest path is distance.
●
Note : A node has zero cost w.r.ts itself
●
Here we assume that 0 as a source vertex, and distance to all the other vertices is
●
Note: Dijkstra's Algorithm is applicable only when cost of all the nodes is non-negative.
infinity.
Algorithm for Dijkstra’s Algorithm:
1. Mark the source node with a current distance of 0 and the rest with infinity.
2. Set the non-visited node with the smallest current distance as the current node.
3. For each neighbor, N of the current node adds the current distance of the adjacent node with the
weight of the edge connecting x->y. If it is smaller than the current distance of Node, set it as the new ●
Initially, we do not know the distances. First, we will find out the vertices which are
current distance of N.
directly connected to the vertex 0.
4. Mark the current node y as visited.
5. Go to step 2 if there are any nodes are unvisited.
●
As we can observe in the below graph that two vertices are directly connected to vertex
0.
●
Till now, two nodes have been selected, i.e., 0 and 1.
●
Now we have to compare the nodes except the node 0 and 1.
●
The node 4 has the minimum distance, i.e., 8. Therefore, vertex 4 is selected.
●
Since vertex 4 is selected, so we will consider all the direct paths from the vertex 4.
●
The direct paths from vertex 4 are 4 to 0, 4 to 1, 4 to 8, and 4 to 5.
●
Since the vertices 0 and 1 have already been selected so we will not consider the vertices 0 and 1.
●
We will consider only two vertices, i.e., 8 and 5.
●
First, we consider the vertex 8. First, we calculate the distance between the vertex 4 and 8.
●
Consider the vertex 4 as 'x', and the vertex 8 as 'y'.
●
d(x, y) = d(x) + c(x, y) < d(y) = (8 + 7) < ∞ = 15 < ∞
●
Since 15 is less than the infinity so we update d(8) from infinity to 15.
●
Now, we consider the vertex 5. First, we calculate the distance between the vertex 4 ●
Since the vertex 5 is selected, so we will consider all the direct paths from vertex
and 5.
5. The direct paths from vertex 5 are 5 to 8, and 5 to 6.
●
Consider the vertex 4 as 'x', and the vertex 5 as 'y'. ●
First, we consider the vertex 8. First, we calculate the distance between the vertex
●
d(x, y) = d(x) + c(x, y) < d(y) = (8 + 1) < ∞ =9<∞ 5 and 8. Consider the vertex 5 as 'x', and the vertex 8 as 'y'.
●
Since 5 is less than the infinity, we update d(5) from infinity to 9.
●
d(x, y) = d(x) + c(x, y) < d(y) = (9 + 15) < 15 = 24 < 15
●
Since 24 is not less than 15 so we will not update the value d(8) from 15 to 24.
●
The node 5 has the minimum value, i.e., 9. Therefore, vertex 5 is selected.
●
Now, we consider the vertex 6. First, we calculate the distance between the vertex
5 and 6. Consider the vertex 5 as 'x', and the vertex 6 as 'y'.
●
d(x, y) = d(x) + c(x, y) < d(y) = (9 + 2) < ∞ = 11 < ∞
●
Since 11 is less than infinity, we update d(6) from infinity to 11
●
Till now, nodes 0, 1, 4 and 5 have been selected.
●
We will compare the nodes except the selected nodes.
●
The node 6 has the lowest value as compared to other nodes.
●
Therefore, vertex 6 is selected.
Since vertex 6 is selected, we consider all the direct paths from vertex 6. The direct paths from vertex 6 are 6 to 2, 6 to 3, and 6 to 7.
Till now, nodes 0, 1, 2, 4, 5, and 6 have been selected. We compare all the
●
●
●
First, we consider the vertex 2. Consider the vertex 6 as 'x', and the vertex 2 as 'y'.
●
d(x, y) = d(x) + c(x, y) < d(y) = (11 + 4) < 12 = 15 < 12 unvisited nodes, i.e., 3, 7, and 8. Among nodes 3, 7, and 8, node 8 has the
●
Since 15 is not less than 12, we will not update d(2) from 12 to 15 minimum value.
●
Now we consider the vertex 3. Consider the vertex 6 as 'x', and the vertex 3 as 'y'.
●
d(x, y) = d(x) + c(x, y) < d(y) = (11 + 14) < ∞ = 25 < ∞
●
The nodes which are directly connected to node 8 are 2, 4, and 5.
Since 25 is less than ∞, so we will update d(3) from ∞ to 25.
Since all the directly connected nodes are selected so we will not consider
●
●
●
Now we consider the vertex 7. Consider the vertex 6 as 'x', and the vertex 7 as 'y'.
●
d(x, y) = d(x) + c(x, y) < d(y) = (11 + 10) < ∞ = 22 < ∞ any node for the updation.
●
Since 22 is less than ∞ so, we will update d(7) from ∞ to 22.
●
Till now, nodes 0, 1, 4, 5, and 6 have been selected. Now we have to compare all the unvisited nodes, i.e., 2, 3, 7, and 8. Since node 2 has
●
The unvisited nodes are 3 and 7. Among the nodes 3 and 7, node 3 has the
the minimum value, i.e., 12 among all the other unvisited nodes. Therefore, node 2 is selected. minimum value, i.e., 19.
●
Since node 2 is selected, so we consider all the direct paths from node 2. The direct paths from node 2 are 2 to 8, 2 to 6, and 2 to 3.
●
First, we consider the vertex 8. Consider the vertex 2 as 'x' and 8 as 'y'.
●
Therefore, the node 3 is selected.
●
d(x, y) = d(x) + c(x, y) < d(y) = (12 + 2) < 15 = 14 < 15
●
Since 14 is less than 15, we will update d(8) from 15 to 14.
●
The nodes which are directly connected to the node 3 are 2, 6, and 7. Since
●
Now, we consider the vertex 6. Consider the vertex 2 as 'x' and 6 as 'y'. the nodes 2 and 6 have been selected so we will consider these two nodes.
●
d(x, y) = d(x) + c(x, y) < d(y) = (12 + 4) < 11 = 16 < 11
●
Since 16 is not less than 11 so we will not update d(6) from 11 to 16.
●
Now, we consider the vertex 7. Consider the vertex 3 as 'x' and 7 as 'y'.
●
Now, we consider the vertex 3. Consider the vertex 2 as 'x' and 3 as 'y'.
●
d(x, y) = d(x) + c(x, y) < d(y) = (19 + 9) < 21 = 28 < 21
●
d(x, y) = d(x) + c(x, y) < d(y) = (12 + 7) < 25 = 19 < 25
●
Since 19 is less than 25, we will update d(3) from 25 to 19.
●
Since 28 is not less than 21, so we will not update d(7) from 28 to 21.
●
Step 2 : Updation When to Share DVs to neighbours?
●
When does a node send its partial routing table (only two
columns) to all its immediate neighbors?
– The table is sent both periodically and when there is a change in the
table.
– a. Periodic Update: A node sends its routing table, normally every
30 s, in a periodic update.
– The period depends on the protocol that is using distance vector routing.
– b. Triggered Update: A node sends its two-column routing table to
its neighbours anytime there is a change in its routing table.
– The change can result from the following.
– 1) A node receives a table from a neighbor, resulting in changes in its own table after
updating.
– 2) A node detects some failure in the neighboring links which results in a distance
change to infinity.
●
Q1: Consider 3-routers X, Y and Z as shown in figure. Each router have their
routing table. Every routing table will contain distance to the destination nodes.
●
Q2: Consider the following subnet. Distance vector routing is used, and the
following vectors have just come in to router C: from B: (5, 0, 8, 12, 6, 2); from D:
(16, 12, 6, 0, 9, 10); and from E: (7, 6, 3, 9, 0, 4). The measured delays to B, D, and
E, are 6, 3, and 5, respectively. What is C’s new routing table? Give both the
outgoing line to use and the expected delay.
●
Updated routing table of C is:
To Cost Next
A 11 B
B 6 B
C 0 C
D 3 D
E 5 E
F 8 B
Count to infinity problem
●
At the beginning, both nodes A and B know how to reach node X.
●
But suddenly, the link between A and X fails. Node A changes its table.
●
If A can send its table to B immediately, everything is fine.
●
System becomes unstable if B sends its routing table to A before receiving A's routing table.
●
Node A receives the update and, assuming that B has found a way to reach X, immediately updates its routing table.
●
Based on the triggered update strategy,
●
A sends its new update to B.
●
Now B thinks that something has been changed around A and updates its routing table.
●
The cost of reaching X increases gradually until it reaches infinity.
●
It is also known as count to infinity problem
●
Node A thinks that the route to X is via B; node B thinks that the route to X is via A.
●
Packets bounce between A and B, creating a two-node loop problem.
●
Split Horizon
Solution for Count to Infinity problem:- – The split horizon is a method for resolving instability.
●
Defining Infinity: – Each node in this technique delivers a portion of its table across each interface rather than flooding the table
through all of them.
– Solution is to redefine infinity to a smaller number, such as 16. – If node B believes that the best way to go to X is through node A, then node B need not inform node A of this
information because it has already been provided by node A (A already knows).
– The system will be stable in less than a few updates. – Confusion is brought on by receiving data from node A, altering it, then sending it back to node A.
●
Route Poisoning: – In our example, node B trims the end of its forwarding table before transmitting it to node A. In this instance,
node A maintains a distance to X of infinity.
– When a route fails, distance vector protocols spread the bad news about a – Later, node B similarly makes corrections to its forwarding table when node A transmits it to it.
route failure by poisoning the route. – After the initial update, the system is stable because both nodes A and B are aware that X cannot be reached.
●
Poison Reverse
– Route poisoning refers to the practice of advertising a route, but with a
– The split-horizon approach has one disadvantage.
special metric value called Infinity.
– If there is no news about a route after a certain amount of time, the corresponding protocol typically employs a
– Routers consider routes advertised with an infinite metric to have failed. timer and instructs the node to remove the route from its table.
– In the previous example, node A is unable to determine whether node B's decision to remove the route to X
– Each distance vector routing protocol uses the concept of an actual metric from its advertisement to node A is the result of the split-horizon technique (the information came from A) or
value that represents infinity. the fact that B has not recently received any news concerning X.
– In the poison reverse technique, B can still state the value for X, but if the information came from A, it can
– RIP defines infinity as 16. substitute infinite for the distance as a warning: " Do not utilise this value; you are the source of my knowledge
regarding this route."
Link state routing ●
Link state routing is a technique in which each router shares the knowledge of its
●
A method in which each router shares its neighbourhood information with every neighborhood with every other router in the internetwork.
other router in the internetwork. ●
The three keys to understand the Link State Routing algorithm:
●
Each node has a complete map of the topology – Knowledge about the neighborhood: Instead of sending its routing table, a
●
Used in packet switching networks. router sends the information about its neighborhood only. A router broadcast its
identities and cost of the directly attached links to other routers.
●
Each router must do the following – Flooding: Each router sends the information to every other router on the
– Discover its neighbors and learn their network addresses. internetwork except its neighbors. This process is known as Flooding. Every
router that receives the packet sends the copies to all its neighbors. Finally, each
– Measure the distance or cost metric to each of its neighbors. and every router receives a copy of the same information.
– Construct a packet telling all it has just learned. – Information sharing: A router sends the information to every other router only
– Send this packet to and receive packets from all other routers. when the change occurs in the information.
– Compute the shortest path to every other router.
Step 2: Flooding
●
Eg: R1 will flood the packet(link state table) to all the other routers
●
Now, R1 will receive link state table from R2,R3,R4,R5 and R6.
With the help of Single source shortest path algorithm, ie, Dijkstra’s algorithm, R1
will find shortest distance to reach R2,R3,R4,R5,R6.
Comparison between Distance Vector Routing and Link State Routing MULTICAST ROUTING
Distance Vector Routing Link State Routing
●
Multicast routing is a protocol that sends one copy of data to multiple users
Each router periodically share its knowledge about the entire network with
its neighbours
Router share the knowledge of only their neighbouring routers to entire
network
simultaneously on a closed network. Eg: video conferencing
Updates full routing table Updates only the link state
●
Sending a message to a group is called multicasting, and its routing algorithm is called
multicast routing
Bandwidth required is less due to local sharing, small packets and no Bandwidth required is more due to flooding and sending of large link state
flooding. packets. ●
Sending a packet to all destinations simultaneously is called broadcasting.
Make use of Bellman Ford Algorithm. . Make use of Dijkstra’s algorithm.
●
In broadcast routing, packets are sent to all nodes even if they do not want it.
Simple to implement and manage Complex and requires trained network administrator ●
But in Multicast routing, the data is sent to only nodes which wants to receive the
Traffic is less. Traffic is more. packets.
Converges slowly Converges faster.
●
The router must know that there are nodes, which wish to receive the multicast packets
(or stream). Then only it should forward.
Count of infinity problem. No count of infinity problem.
●
Multicast routing protocols use trees, i.e. spanning tree to avoid loops.
Persistent looping problem i.e, loop will be there forever. No persistent loops, only transient loops.
●
When a process sends a multicast packet to a group, the first router examines its
Practical implementation is RIP and IGRP. Practical implementation is OSPF and ISIS. spanning tree and prunes it, removing all lines that do not lead to hosts that are
members of the group.
●
To do multicast routing, each router computes a spanning tree covering all other routers.
●
For example, in Fig.(a) we have two groups, 1 and 2.
●
Some routers are attached to hosts that belong to one or both of these groups, as indicated in the
figure.
●
In our example, Fig.(c) shows the pruned spanning tree for group 1.
●
A spanning tree for the leftmost router is shown in Fig. (b).
●
Similarly, Fig. (d) shows the pruned spanning tree for group 2.
●
Multicast packets are forwarded only along the appropriate pruned spanning tree.
●
When a process sends a multicast packet to a group, the first router examines its spanning tree
and prunes it, removing all lines that do not lead to hosts that are members of the group.
3. Implicit Signaling
●
In implicit signaling, there is no communication between the congested node or nodes
and the source.
●
The source guesses that there is a congestion somewhere in the network from other ●
Backward Signaling -
symptoms without performing any additional communications.
– A bit can be set in a packet moving in the direction opposite to the
●
For example, when a source sends several packets and there is no acknowledgment for congestion.
a while, one assumption is that the network is congested.
– This bit can warn the source that there is congestion and that it needs to
●
The delay in receiving an acknowledgment is interpreted as congestion in the network;
slow down to avoid the discarding of packets.
the source should slow down.
4. Explicit Signaling
●
Forward Signaling -
●
The node that experiences congestion can explicitly send a signal to the source or
– A bit can be set in a packet moving in the direction of the congestion.
destination. – This bit can warn the destination that there is congestion.
●
In the choke packet method, a separate packet is used for this purpose. But, in the
explicit signaling method, a signal is included in the packets that carry data.
●
Explicit signaling can occur in either the forward or the backward direction.
●
Reliability - Reliability is a characteristic that a flow needs. Lack of
reliability means losing a packet or acknowledgment, which entails
retransmission.
●
Delay - Source-to-destination delay is another flow characteristic.
●
Jitter -Jitter is the variation in delay for packets belonging to the same
flow.
– For example, if four packets depart at times 0, 1, 2, 3 and arrive at
20, 21, 22, 23, all have the same delay, 20 units of time.
– On the other hand, if the above four packets arrive at 21, 23, 21,
and 28, they will have different delays: 21,22, 19, and 25.
●
Bandwidth - Different applications need different bandwidths.
– Eg: In video conferencing, we need to send millions of bits per
second to refresh a color screen.
2. Traffic Shaping
●
Traffic shaping is a mechanism to control the amount and the rate of the traffic sent to
the network. Two techniques can shape traffic: leaky bucket and token bucket.
a) Leaky Bucket
– If a bucket has a small hole at the bottom, the water leaks from the bucket at a constant rate as
long as there is water in the bucket.
– Flow of water from bucket is at a constant rate which is independent of water entering the bucket
– If bucket is full, any additional water entering in the bucket is thrown out
●
Same technique is applied to control congestion in network traffic
●
In practice the bucket is a finite queue that outputs at a fixed rate
●
Every host in the network is having a buffer with finite queue length.
●
Packets which are put in the buffer when buffer is full are thrown away.
●
The buffer may drain onto the subnet either by some no. of packets per unit time, or by
some total no. of bytes per unit time.
b) Token Bucket
●
Token bucket algorithm is a variant of the leaky bucket
●
The leaky bucket is very restrictive. It does not credit an idle host.
●
For example, if a host is not sending for a while, its bucket becomes empty.
●
Now if the host has bursty data, the leaky bucket allows only an average rate.
●
The time when the host was idle is not taken into account.
●
A FIFO queue holds the packets. If the traffic consists of fixed-size packets (e.g., cells in ATM ●
On the other hand, the token bucket algorithm allows idle hosts to accumulate credit for the future in
networks), the process removes a fixed number of packets from the queue at each tick of the clock. the form of tokens.
●
If the traffic consists of variable-length packets, the fixed output rate must be based on the number of – For each tick of the clock, the system sends n tokens to the bucket.
bytes or bits. – The system removes one token for every cell (or byte) of data sent.
●
This mechanism turns an uneven flow of packets from the user processes inside the host into an even – For example, if n is 100 and the host is idle for 100 ticks, the bucket collects 10,000 tokens.
flow of packets onto the network, smoothing out bursts and greatly reducing the chances of congestion. ●
Ie, Token bucket is similar to the leaky bucket, but it allows for varying output rates
●
The Leaky Bucket algorithm can be implemented for packets or a constant amount of bytes, send ●
This is useful when larger burst of traffic arrive
within each time interval. ●
In this approach, a token bucket is used to manage the queue regulator that controls the rate of packet
●
Conceptually each network interface contains a leaky bucket. And the following steps are performed: flow into the network.
– When the host has to send a packet, the packet is thrown into the bucket. ●
Each token grants the ability to transmit a fixed no. of bytes, if the token bucket fills,newly generated
– The bucket leaks at a constant rate, meaning the network interface transmits packets at a constant rate. tokens are discarded
– Burst traffic is converted to a uniform traffic by the leaky bucket. ●
If the flow delivers more packets than the queue can store, the excess packets are discarded
●
The leaky bucket algorithm enforces a rigid output pattern at the average rate, no matter how bursty the
traffic is. For many applications, it is better to allow the output to speed up somewhat when large bursts
3) Resource Reservation
arrive. One such algorithm is the token bucket algorithm. ●
A flow of data needs resources such as a buffer space, bandwidth, CPU time,
●
Eg: the leaky bucket holds tokens, generated by a clock at the rate of one token every T sec. and so on.
●
In Fig. 4 (a) a bucket is holding three tokens, with five packets waiting to be transmitted. ●
The quality of service is improved if these resources are reserved beforehand.
●
For a packet to be transmitted, it must capture and destroy one token.
4) Admission Control
●
In Fig. (b) three of the five packets have gotten through, but the other two are stuck waiting for two more
tokens to be generated. ●
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.