Routing algorithms

Routing algorithms
• the routing algorithm is a part of the network layer software
responsible for deciding which output line an incoming packet
should be transmitted on.
• If the subnet uses datagram, this decision must be made anew for
every arriving data packet.
• if the subnet uses virtual circuits, routing decision are made only
when a new virtual circuit is established. thereafter, data packets
just follow the previously established route. This is called session
routing.
• routing
– taking decision of route for a session; updating the routing table.
• forwarding
– forwarding a packet of that session on the decided output line when
arrives.
• Nonadaptive or static
– do not base their routing decisions on
measurements or estimates of the current traffic
and topology.
• adaptive or dynamic
– change their routing decisions to reflect changes
in the topology, and usually the traffic as well.
Flooding
• every incoming packet is sent out on every
outgoing line except the one it arrive on.
• demerits:
– vast number of duplicate packets; infinite.
• Measures
– can be reduce using TTL like measure
– keep track of the flooding packet, not to entertain
such packet again.
– Selective flooding
Distance Vector Algorithm
• Bellman-Ford or Ford-Fulkerson algorithm
• It is iterative, asynchronous and distributed.
• Each node keeps a distance table. Node X’s distance
table entry, DX(Y,Z) is the sum of the cost of the direct
one hop link between X and Z, plus neighbor Z’s
currently known least cost path from itself to Y.
DX(Y,Z) = c(X,Z)+minw{DZ(Y,W)}
After the algorithm converged
Cost to destination via
DE() A
1
B
C
7
2
D
Destination
1
E
C
A
1
14
9
B
7
8
5
C
6
9
4
D
4
11
2
2
8
A
B
Y
1
2
7
X
X
Y
Z
Z
Dx
Y
Z
Dx
Y
Z
Dx
Y
Z
Y
2
∞
Y
2
8
Y
2
8
Z
∞
7
Z
3
7
Z
3
7
Dy
X
Z
Dy
X
Z
Dy
X
Z
X
2
∞
X
2
8
X
2
1+3
Z
∞
1
Z
9
1
Z
2+3
1
Dz
X
Y
Dz
X
Y
Dz
X
Y
X
7
∞
X
7
3
X
7
3
Y
∞
1
Y
9
1
Y
9
1
Link cost changes and failure
Y
1
• When link-cost decreases
1
4
50
X
Z
Dy
X
Z
Dy
X
Z
Dy
X
Z
Dy
X
Z
X
4
6
X
1
6
X
1
6
X
1
3
Dz
X
Y
Dz
X
Y
Dz
X
Y
Dz
X
Y
X
50
5
X
50
5
X
50
2
X
50
2
t0
t1
t2
• When link-cost
increases
Y
60
1
4
50
X
• Routing loop
Z
• Count to infinity problem
Dy
X
Z
Dy
X
Z
Dy
X
Z
Dy
X
Z
Dy
X
Z
X
4
6
X
60
6
X
60
6
X
60
8
X
60
8
Dz
X
Y
Dz
X
Y
Dz
X
Y
Dz
X
Y
Dz
X
Y
X
50
5
X
50
5
X
50
7
X
50
7
X
50
9
t0
t1
t2
t3
Shortest Path Routing
• Build a graph of subnets, with each node of
the graph representing a router, and each arc
of the graph representing a communication
line. to choose a route between a given pair
of routes, the algorithm just finds the shortest
path between them on the graph.
• Dijkstra’s algorithm.
reverse path: DHFEBA