0% found this document useful (0 votes)
67 views

CN-Unit 1 Routing Algorithms

The document discusses various routing algorithms and network layer design issues. It covers topics like shortest path routing, flooding, distance vector routing, link state routing, and hierarchical routing. It also discusses the differences between connection-oriented and connectionless services as well as virtual circuit and datagram subnets.

Uploaded by

Daksha 2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

CN-Unit 1 Routing Algorithms

The document discusses various routing algorithms and network layer design issues. It covers topics like shortest path routing, flooding, distance vector routing, link state routing, and hierarchical routing. It also discusses the differences between connection-oriented and connectionless services as well as virtual circuit and datagram subnets.

Uploaded by

Daksha 2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 68

Network layer (Part – I)

Topics to be discussed

1. Network layer design issues


2. Routing algorithms
• The Optimality Principal
• Shortest Path Routing
• Flooding
• Distance Vector Routing,
• Link state Routing,
• Hierarchical Routing,
• Broadcast Routing, Multicast Routing
• Anycast Routing
• Routing for Mobile Hosts,
• Routing in Ad hoc Networks
Network layer design issues:

1. Store and Forward packet Switching


2. Services Provided to the Transport Layer
3. Implementation of Connectionless Service
4. Implementation of Connection-Oriented Service
5. Virtual Circuit v/s Datagram Subnets;
1. Store and Forward packet Switching

The packet is stored there until it has fully arrived so the checksum can be verified. Then
it is forwarded to the next router along the path until it reaches the destination host,
where it is delivered.
2. Services Provided to the Transport Layer

The network layer services have been designed with the following
goals in mind.
• The services should be independent of the router technology.

• The transport layer should be shielded from the number, type, and

topology of the routers present.

• The network addresses made available to the transport layer should use

a uniform numbering plan, even across LANs and WANs.


2. Services Provided to the Transport Layer

connection-oriented service or connectionless service ?

If connectionless service :

• the subnet is unreliable

• packet ordering , error control and flow control should be

performed by the hosts

• each packet must carry the full destination address

Example: Internet (unreliable)


2. Services Provided to the Transport Layer

connection-oriented service or connectionless service ?


If connection-oriented service
• the subnet is reliable

• packet ordering , error control and flow control should be

performed by the subnet

• each packet contains a connection identifier

• quality of service is the dominant factor here.

Example : ATM (reliable)


3. Implementation of Connectionless Service

• If connectionless service is offered


• packets are injected into the subnet individually and routed

independently of each other.

• packets are frequently called datagrams. and the subnet is called a

datagram subnet

• No advance setup is needed.


3. Implementation of Connectionless Service
How a datagram subnet works ?

Each packet(1,2,3) is forwarded to C


according to A's table.

For some reason, A decided to send


packet 4 via a different route than that of
the first three.

The algorithm that manages the tables


and makes the routing decisions is called
the routing algorithm.
4. Implementation of Connection-Oriented Service

If connection-oriented service is used

• A path from the source router to the destination router

must be established before any data packets can be sent.

• This connection is called a VC (virtual circuit), and the

subnet is called a virtual-circuit subnet.


4. Implementation of Connection-Oriented Service

how a virtual-circuit subnet works ?

host H1 has established connection 1 with host H2.


5. Comparison of Virtual-Circuit and Datagram Subnets
Routing Algorithms
Routing Algorithms

• The routing algorithm is that part of the network


layer software responsible for deciding which output
line an incoming packet should be transmitted on.
• For datagram subnet, this decision must be made a
new for every arriving data packet.
• For virtual circuit subnet, this decision is made only
when a new virtual circuit is being set up. (also called
session routing )
Forwarding v/s Routing
• Routing

• making the decision which routes to use

• involves filling in and updating the routing tables.

• Forwarding :

• what happens when a packet arrives.

• looking up the outgoing line to use for it in the routing tables


Routing algorithm properties

1. Correctness : Error free

2. Simplicity : should be simple

3. Robustness : coping with changes in the topology and traffic without


requiring all jobs in all hosts to be aborted and the network to be
rebooted every time some router crashes

4. Stability : Should reach equilibrium and stay there. Under any

condition the algorithm must not react slowly.

5. Fairness: equally treating every node


Contradictory
6. Optimality : Maximizing the flow goals
Routing algorithm properties
Conflict between fairness and optimality.

Is it fair to shut off the traffic between X and X’ to maximize the traffic
between A and A’ , B and B’ and C and C’ ?
Two classes of Routing Algorithms

Nonadaptive algorithms (static routing)


• The choice of the route to use is computed in advance, off-line, and
downloaded to the routers when the network is booted.
• Inability to react rapidly to network failures

Adaptive algorithms (dynamic routing)


• change their routing decisions to reflect changes in the topology, and
usually the traffic as well.
• Added complexity
The Optimality Principle

“ It states that if router J is on the optimal path from router I to router K,


then the optimal path from J to K also falls along the same route “

r1 r2
I J K

r3

If r2 is the optimal path from J to K , the optimal path from I to K is r1r2

If r3 is the optimal path from J to K , the optimal path from I to K is r1r3


The Optimality Principle

The set of optimal routes from all sources to a given destination form a tree

rooted at the destination. Such a tree is called a sink tree

(a) A subnet. (b) A sink tree for router B. (metric is no. of hops)
The Optimality Principle

Note :
• The goal of all routing algorithms is to discover and use the sink
trees for all routers.
• Since a sink tree is a tree, it does not contain any loops
• Each packet will be delivered within a finite and bounded number
of hops
The Optimality Principle

PROBLEM:

Find a sink tree for the destination C. Assume that path


distance metric is number of hops
Shortest Path Routing
(static algorithm)

• Several algorithms exists for computing the shortest path


between two nodes of a graph
• Dijkstra’s algorithm (1959) is a Shortest Path Routing,

• A node is labeled with its distance from the source node along the best
known path and the parent node label. <distance, parent>
• Initially , all nodes are labeled with infinity, As the algorithm proceeds and
paths are found, the labels may change, reflecting better paths
• When it is discovered that a label represents the shortest possible path from
the source to that node, it is made permanent
Shortest Path Routing
Dijkstra’s algorithm A→D The arrows indicate the working node.
Shortest Path Routing

PROBLEM:
Apply Dijkstra’s algorithm to find the shortest path from A to D
Shortest Path Routing

PROBLEM:
Apply Dijkstra’s algorithm to find the shortest path from A to G
Flooding ( static algorithm )

• Every incoming packet is sent out on every outgoing line except


the one it arrived on.

The drawback is that


it generates a vast
number of duplicate
packets.
Flooding ( static algorithm )

• Some measures to avoid duplicate packets.

1. Hop Count Method


• A hop counter is included in the header of each packet,

• The counter is decremented at each hop

• when the counter reaches zero ,the packet will be discarded


Flooding ( static algorithm )

2. Sequence number Method

• Source router adds a unique sequence number to each packet.

• When a router receives a packet, the router records the source

address and the sequence number.

• if the packet is already seen by the router , then it simply discards the

packet.
Flooding ( static algorithm )

3. Selective flooding
• The routers do not send every incoming packet out on
every line

• A packet is sent only on those lines that are going


approximately in the right direction
Flooding ( static algorithm )

Applications of flooding
1. Military
• If a large number of routers are destroyed ,then information can
be propagated with the help of flooding .

2. Distributed database applications


• to update all the databases concurrently

3. Wireless networks,
• If all messages transmitted by a station can be received by all other
stations within its radio range

4. As a metric against which other routing algorithms can be compared.


Distance Vector Routing
(Bellman, 1957; and Ford and Fulkerson, 1962)

• Each router maintains a routing table indexed by, and containing one entry for,

each router in the subnet.

• This entry contains two parts:

1. the preferred outgoing line to use for that destination

2. an estimate of the time or distance to that destination.

• The router is assumed to know the ''distance'' to each of its neighbors.


Distance Vector Routing
(Bellman, 1957; Ford and Fulkerson, 1962)

Assuming that delay is used as a metric and that the router knows the delay to each
of its neighbors, the algorithm works as follows:

• Once every T msec each router sends to each neighbor a list of its estimated

delays to each destination. It also receives a similar list from each neighbor.

• Suppose that the router has received from X, Xi being X's estimate of how long

it takes to get to router i. If the router knows that the delay to X is m msec, it also

knows that it can reach router i via X in Xi + m msec.

• By performing this calculation for each neighbor, a router can find out which

estimate seems the best and use that estimate and the corresponding line
Distance Vector Routing
(Bellman, 1957; Ford and Fulkerson, 1962)
Example

8 34 32 27
20 46 43 34

8
12 26 41 18 37

10 6

(a) A subnet. (b) Input from A, I, H, K, and the new routing table for J.
Distance Vector Routing
(Bellman, 1957; Ford and Fulkerson, 1962)

The Count-to-Infinity Problem

• Distance vector routing has a serious drawback in practice:

Although it converges to the correct answer, it may do so slowly.

i.e. It reacts very slowly to a link failure.

(experiencing unstability - 4th property)


Distance Vector Routing
(Bellman, 1957; Ford and Fulkerson, 1962)

The Count-to-Infinity Problem - Example


Suppose A is down initially and all the other routers have recorded the delay to A as
infinity. When A comes up, the other routers learn about it via the vector exchanges.

Reaction to the
good news

In a subnet whose longest path is of length N hops, within N exchanges everyone will
know about newly-revived lines and routers
Distance Vector Routing
(Bellman, 1957; Ford and Fulkerson, 1962)

The Count-to-Infinity Problem - Example


Let us consider the situation of in which all the lines and routers are initially up. Routers B, C, D, and
E have distances to A of 1, 2, 3, and 4, respectively. Suddenly A goes down, or alternatively, the line
between A and B is cut,

Reaction to the bad


news
Distance Vector Routing
(Bellman, 1957; Ford and Fulkerson, 1962)

The Count-to-Infinity Problem - Example

At the first packet exchange , B thinks it can reach A via C, with a path length

of 3. B does not know that C's path runs through B itself. So it


updates its entry with 3 (1+2) to A via C. D and E do not update their entries
for A on the first exchange. Similar problem occurs with other nodes in the
subsequent exchanges. This continues to infinity at which point routers will
come to know that A is down.
Distance Vector Routing
(Bellman, 1957; Ford and Fulkerson, 1962)

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.
Link State Routing
DV was used in the ARPANET. Two primary problems caused its demise

1. Count – to – infinity problem

2. The delay metric was queue length. It did not take line bandwidth into

account when choosing routes.

With DV ,the 'route'


chosen would be AB
,even though that link is
about 10 times slower
than the route ACDB.
Link State Routing
The idea behind link state routing is simple. Each router must do the
following:

1. Discover its neighbors and learn their network addresses.

2. Measure the delay or cost to each of its neighbors.

3. Construct a packet telling all it has just learned.

4. Send this packet to all other routers.

5. Compute the shortest path to every other router


Link State Routing
1. Learning about the Neighbors

• Each router sends a special HELLO packet to each of its

neighbors.

• A neighbor is expected to reply giving its ID.

• These names (IDs) must be globally unique


Link State Routing
1. Learning about the Neighbors
When two or more routers are connected by a LAN, the situation is slightly
more complicated. The fact that it is possible to go from A to C on the LAN is
represented by the path ANC here

a) Nine routers and a LAN. (b) A graph model of (a).


Link State Routing
2. Measuring Line Cost

• A special ECHO packet is sent to each neighbour and other side is

required to send back immediately

• RTT is measured to get a reasonable delay to each of its

neighbours.

delay = RTT / 2 ;
Link State Routing
2. Measuring Line Cost

Whether to take the load into account when measuring the


delay ?

• If taken into account , the round-trip timer must be started when the
ECHO packet is queued.
• To ignore the load, the timer should be started when the ECHO packet
reaches the front of the queue
Link State Routing
2. Measuring Line Cost
• Including load in the delay measurements may cause routing tables to
oscillate wildly, leading to erratic routing and many potential problems.

If load is ignored and


only bandwidth is
considered, this
problem does not
occur.
Link State Routing
3. Building Link State Packets

• The next step is for each router to build a packet containing all the data
• The packet starts with the identity of the sender, followed by a sequence
number and age , and a list of neighbours

a) A subnet. (b) The link state packets for this subnet.

Question: When to build?


Link State Routing
4. Distributing the Link State Packets

• Basic distribution algorithm is flooding to distribute Link State


Packets.
• To keep flood in check, packet sequencing method (2nd method )
can be used
• Each new packet is given a sequence number

• At every router , If packet is new, it is forwarded on all lines except the

one it arrived on. If it is a duplicate, it is discarded.


Link State Routing
4. Distributing the Link State Packets

• Some issues in distributing LSPs


1. What if the sequence numbers wrap around?
• the next packet will be rejected as a duplicate

2. What if a router ever crashes ?


• it will lose track of its sequence number.
• If it starts again at 0, the next packet will be rejected as a duplicate

3. What if a sequence number is ever corrupted ?


• if 65,540 is received instead of 4 (a 1-bit error), packets 5 through
65,540 will be rejected as obsolete
Link State Routing
4. Distributing the Link State Packets

• Solutions

• Use 32 bit sequence number.

• The solution to 2nd and 3rd problems is to include the Age of


each packet after the sequence number and decrement it
once per second. When the age hits zero, the information
from that router is discarded.
Link State Routing
4. Distributing the Link State Packets

An example of data structure used by router B for the subnet shown below.
Each row here corresponds to a recently-arrived, but as yet not fully-
processed, LSP

Table used by router B


Link State Routing
4. Distributing the Link State Packets

Note
• The link state packet from A arrives directly, so it must be sent to C and F and
acknowledged to A, as indicated by the flag bits.

• The situation with the third packet, from E, is different. It arrived twice, once
via EAB and once via EFB, Consequently, it has to be sent only to C but
acknowledged to both A and F

• If a duplicate arrives while the original is still in the buffer, bits have to be
changed
Link State Routing
5. Computing the New Routes

• Once a router has accumulated a full set of link state packets, it can
construct the entire subnet graph because every link is represented

• Now Dijkstra's algorithm can be run locally to construct the shortest path to

all possible destinations.

• The results of this algorithm can be installed in the routing tables, and

normal operation resumed.


Link State Routing

• Things can go wrong if


• hardware or software failure occurs .

• If a router fails to forward packets or corrupts them while forwarding

them

• if it runs out of memory or does the routing calculation wrong

Examples :

1. OSPF (Open Shortest Path First) routing - used The Internet

2. IS-IS (Intermediate System-Intermediate System), - used in DECnet


Hierarchical Routing

Why Hierarchical Routing ?

• As networks grow in size, the router routing tables grow proportionally

• At a certain point, it may not feasible for every router to have an entry for

every other router.

• So the routing will have to be done hierarchically


Hierarchical Routing

• The routers are divided into regions

• Each router knows how to route packets to destinations within its own

region, but knows nothing about the internal structure of other regions

• For huge networks , it may be necessary to group the regions into clusters,

the clusters into zones, the zones into groups, and so on,
Hierarchical Routing
• Example : A two-level hierarchy with five regions.

With hierarchal
routing a table
would require only
7 entries

Without hierarchal
routing a table would
require 17 entries
Hierarchical Routing

Note :
• The full routing table for router 1A has 17 entries, as shown . When routing
is done hierarchically, 1A has 7 entries

• The disadvantage of Hierarchical Routing can easily be seen from figure.


The best route from 1A to 5C is via region 2, but with hierarchical routing
all traffic to region 5 goes via region 3

• it is discovered that the optimal number of levels for an N router subnet is


ln N
Broadcast Routing

• Sending a packet to all destinations simultaneously is called


broadcasting
Techniques for broadcasting:
1. Simple Broadcasting
2. Flooding
3. Multi - destination routing
4. Spanning tree method
5. Reverse path forwarding
Broadcast Routing

1. Simple Broadcasting :
• send a distinct packet to each destination
• wastes of bandwidth
• source should have a complete list of all destinations
Broadcast Routing

2. Flooding :
• It generates too many packets
• So consumes too much bandwidth.
Broadcast Routing

3. Multi-destination routing :
• Each packet contains a list of destinations .

• When a packet arrives at a router, the router checks all the destinations to

determine the set of output lines that will be needed.

• The router generates a new copy of the packet for each output line to be used

and includes in each packet only those destinations that are to use the line.

• After a sufficient number of hops, each packet will carry only one destination and

can be treated as a normal packet.


Broadcast Routing
Multi-destination routing B

Example - 1
C
D

BCDEFGHI E
E

H F

I I
Broadcast Routing

Multi-destination routing :

Example - 2
Broadcast Routing

4. spanning tree method (sink tree) :


• If each router knows which of its lines belong to the spanning tree, it can
copy an incoming broadcast packet onto all the spanning tree lines
except the one it arrived on.

• Minimum number of packets necessary to do the job

• So makes excellent use of bandwidth,

• Each router must have knowledge of some spanning tree


Broadcast Routing

4. spanning tree method (sink tree) :

4 1
3

2
Broadcast Routing

5. Reverse path forwarding:


• When a broadcast packet arrives at a router, the router checks to see if the
packet arrived on the optimal path to the source .

• If so, the broadcast packet itself followed the best route from the router
and is therefore the first copy to arrive at the router. the router forwards
copies of it onto all lines except the one it arrived on.

• If, however, the broadcast packet has not arrived on the preferred one for
reaching the source, the packet is discarded as a likely duplicate.
Broadcast Routing

5. Reverse path forwarding: Example

(a) shows a subnet, part (b) shows a sink tree for router I of that
subnet, and part (c) shows how the reverse path algorithm works.

You might also like