You are on page 1of 54

1

Module 5
Routing Algorithms
Mr. A. Swaminathan

Mr. A. Swaminathan VIT Chennai


2

Routing
▪ Network Layers
▪ Routing
▪ Congestion control
▪ Internetworking
▪ The process of forwarding the packets in a network to reach its
intended destination.

Mr. A. Swaminathan VIT Chennai


3

Goals of routing
▪ Correctness
▪ Simplicity
▪ Robust
▪ Stability
▪ Fairness
▪ Optimality

Mr. A. Swaminathan VIT Chennai


The purpose of any routing protocol 4

▪ to dynamically communicate information about all network paths


used to reach a destination
▪ to select the best path to reach a destination network.

Mr. A. Swaminathan VIT Chennai


5

Routing Classification
▪ Adaptive / Dynamic ▪ Non-Adaptive (Static)
▪ Gathers information at run ▪ Route is predetermined offline
time locally from neighbour and downloaded to the
routers
routers when the network is
▪ Changes routes periodically booted
▪ For every t seconds
▪ load changes
▪ Topology changes
Mr. A. Swaminathan VIT Chennai
6

Routing Types
▪ Distance Vector routing ▪ Shortest path routing
▪ Routing information Protocol ▪ Flooding
▪ Link state routing
▪ Flow based routing
▪ Open Shortest Path First OSPF

Mr. A. Swaminathan VIT Chennai


7

Routing types
▪ Hierarchical routing
▪ Routing for mobile host

Mr. A. Swaminathan VIT Chennai


8

Shortest path routing algorithm


▪ Finds the shortest path between the pair of routes
▪ The cost of link depends upon
▪ Distance
▪ Bandwidth
▪ Average traffic
▪ Communication cost
▪ Delay

Mr. A. Swaminathan VIT Chennai


Dijkstra's Algorithm 9

A B C D E F G H
A 0
B 0
C 0
D 0
E 0
F 0
G 0
H 0
Mr. A. Swaminathan VIT Chennai
10

Mr. A. Swaminathan VIT Chennai


11

Mr. A. Swaminathan VIT Chennai


12

Mr. A. Swaminathan VIT Chennai


Dijkstra's Algorithm 13

A B C D E F G H
A 0 2 ꝏ ꝏ ꝏ ꝏ 6 ꝏ
B 2 0 7 ꝏ 2 ꝏ ꝏ ꝏ
C ꝏ 7 0 3 ꝏ 3 ꝏ ꝏ
D ꝏ ꝏ 3 0 ꝏ ꝏ ꝏ 2
E ꝏ 2 ꝏ ꝏ 0 2 1 ꝏ
F ꝏ ꝏ 3 ꝏ ꝏ 0 ꝏ 2
G 6 ꝏ ꝏ ꝏ 1 ꝏ 0 4
H ꝏ ꝏ ꝏ 2 ꝏ 2 4 0

Mr. A. Swaminathan VIT Chennai


Dijkstra's Algorithm 14

A B C D E F G H
A 0 2 6
B 2 0 7 2
C 7 0 3 3
D 3 0 2
E 2 0 2 1
F 3 0 2
G 6 1 0 4
H 2 2 4 0
Mr. A. Swaminathan VIT Chennai
Flooding 15

▪ Every incoming packets is sent to every outgoing path. (Broadcast)


except the source.
▪ Disadvantages
▪ Large no. of duplicate packets
▪ Bandwidth
▪ How to eliminate the duplicate
▪ Hop counter
▪ Decrement each router
▪ Discard packet if counter is ‘0’
▪ Apply sequence number in packet
▪ It avoid sending the same packet to a router for second time
▪ Maintain the source list in each router
▪ Selective Flooding
▪ Select approximately right direction

Mr. A. Swaminathan VIT Chennai


16

Flow based Routing


▪ Routing based on
▪ Topology
▪ Network traffic/Load
▪ Quick sending
▪ Finds shortest path
▪ If path is Network traffic/Load
▪ Find next shortest path

Mr. A. Swaminathan VIT Chennai


17

Flow based technology


▪ Subnet topology (different routes)
▪ Traffic matrix
▪ Line capacity matrix (Bandwidth)

Mr. A. Swaminathan VIT Chennai


Distance Vector Routing
18

▪ Least cost between pair of nodes


▪ Bellman Ford Algorithm
▪ One routing table
▪ dx(y)=min{cost(x,v)+dv(y)}
▪ dx = Source
▪ Y = destination
▪ V = intermediate node

Mr. A. Swaminathan VIT Chennai


19

Distance Vector Routing


▪ Completely decentralized
▪ No node has complete information about the costs of all network
links
▪ Gradual calculation of path by exchanging information with
neighbors

Mr. A. Swaminathan VIT Chennai


Specifics 20

▪ Each node constructs a one-dimensional array


containing the “distances” or “costs” to all other
nodes (as it relates to its knowledge) and
distributes it to its immediate neighbors.
▪ Key thing -- each node knows the cost of links to its
neighbors.
▪ If no link exists between two nodes, the cost of a
direct link between the nodes is “infinity”.

Mr. A. Swaminathan VIT Chennai


An Example 21

B A B C D E F G
C
A

A 0 1 1 ∞ 1 1 ∞
D

B 1 0 1 ∞ ∞ ∞ ∞
E

C 1 1 0 1 ∞ ∞ ∞
F G

• Internal Information
D ∞ ∞ 1 0 ∞ ∞ 1
at each node -----> E 1 ∞ ∞ ∞ 0 ∞ ∞
F 1 ∞ ∞ ∞ ∞ 0 1
G ∞ ∞ ∞ 1 ∞ 1 0
Mr. A. Swaminathan VIT Chennai
Routing Tables 22

B
Cost Next
Hop
C
A
D

E B 1 B
F G C 1 C
▪ With this D ∞ -
information, routing E 1 E
table at A is --> F 1 F
G ∞ -

Mr. A. Swaminathan VIT Chennai


23

Evolution of the table.


▪ Each node sends a message to Cost Next
neighbors with a list of distances.
▪ F --> A with G is at a distance 1 Hop
▪ C --> A with D at distance 1. B 1 B
C 1 C
D 2 C
B

C
E 1 E
A
D F 1 F
E
G 2 F
F G

Mr. A. Swaminathan VIT Chennai


Final Distance Matrix 24

B A B C D E F G
C
A

A 0 1 1 2 1 1 2
D

B 1 0 1 2 2 2 3
E

C 1 1 0 1 2 2 2
F G

D 2 2 1 0 3 2 1
E 1 2 2 3 0 2 3
F 1 2 2 2 2 0 1
G 2 3 2 1 3 1 0
Mr. A. Swaminathan VIT Chennai
25

Convergence
▪ In the absence of topological changes -- few exchanges between
neighbors before complete routing table is formed.
▪ This table is consistent.
▪ Convergence is achieved.
▪ Notice -- no centralized authority

Mr. A. Swaminathan VIT Chennai


Routing updates 26

▪ When are routing updates sent ?


1. Periodic updates
– Even if nothing has changed, send periodically. Main reason is to let other
nodes know that the sender is alive.
– Refresh information that might be needed if some of the routes were to
become unavailable.
2. Triggered updates
– When a node receives an update from one of its neighbors which may lead to a
change in its routing tables (could be due to change in link cost).
o Note: typically order of periodicity is seconds to several minutes.

Mr. A. Swaminathan VIT Chennai


27

Link/Node Failures
▪ Nodes that first notice send new lists of distances to neighbors.
▪ How do they detect failures ?
▪ Route updates don’t arrive
▪ Probing with test packets.

Mr. A. Swaminathan VIT Chennai


Example Revisited 28

▪ Let link from F to G fail.


▪ F sets new distance to G to ∞; sends B
update to A. C
A
▪ A was initially routing to G via F. So it now D

sets link cost to G to ∞. E


▪ Next update from C; A learns that C has 2
hop path to G. F G

▪ A now can reach G in 3 hops via C.


▪ A sends an update to F. Thus, F now, can
reach G via A in 4 hops.

Mr. A. Swaminathan VIT Chennai


Count to Infinity 29

▪ A discovers that link to E is lost. • The process


▪ If before A’s message (saying that link cost to continues and thus,
E is ∞) is received, if B or C advertise that the system does not
they can reach E in two hops, then A can be
confused. stabilize.
▪ Another possibility, B gets A’s update • This is the count to
followed by C’s update which says that E is
infinity problem.
reachable in 2 hops.
▪ So B tells A this, and A thinks it can now
reach E via B in 3 hops. B
▪ This information reaches C who now thinks C
that it can reach E in 4 hops via A. A
D

F G

Mr. A. Swaminathan VIT Chennai


Split Horizon 30

▪ One solution would be to approximate ∞ to say 16 hops.


▪ With Split Horizon, when a node sends a routing table update
to its neighbors, it “does not” send those routes it learned
from “a particular” neighbor, back to that neighbor.
▪ For example, B had E, 2, A. When it sends a route update to A, it does
not include this.
▪ With split horizon with poison reverse, this update is reported
but the link weight is set to ∞.
▪ For example B sends (E, ∞) to A.

Mr. A. Swaminathan VIT Chennai


31

Does this work ?


▪ Typically, in static networks where link failures/node failures are
rare, this may be enough.
▪ Speed of convergence is why, link state routing may be
preferable -- it takes a while before routes converge.

Mr. A. Swaminathan VIT Chennai


32

Purging routing entries


▪ Each routing entry has a time-to-live (or TTL) field.
▪ A counter -- initially set to MaxTTL.
▪ This is then decremented and if TTL = 0, then, time to purge the
entry.

Mr. A. Swaminathan VIT Chennai


RIP 33

▪ Stands for Routing Information Protocol


▪ Built based on distance vector routing.
▪ In the Internet, goal of routers is to learn how to
forward packets to various networks.
▪ Send/receive updates (Routing information) from
neighbors
▪ Routing table & update time – 30 sec

Mr. A. Swaminathan VIT Chennai


34

An Example of RIP
▪ Metric : hop count
▪ Rumors based protocol 1 4
▪ Loop issue – star hybrid
▪ Routers advertise the cost of A B
reaching networks. 2 5
▪ In this example, C’s update to A
would indicate that C can reach C D
Networks 2 and 3 with cost 0, 3 6
Networks 5 and 6 with cost 1 and
Network 4 with cost 2.

Mr. A. Swaminathan VIT Chennai


35

Other RIP Details


▪ Routing tables are exchanged every 30 seconds using the RIP
advertisement.
▪ If a router does not hear from its neighbor once every 180
seconds, the neighbor is deemed unreachable.
▪ The router that detects this will modify its routing table and
propagate the information.

Mr. A. Swaminathan VIT Chennai


36

RIP implementation
▪ RIP packets are sent using UDP.
▪ Typically, there is a routing daemon (routed) that is an
application layer process that provides access to routing tables.
▪ Allows for the access of the tables.
▪ Use “netstat -rn” to view routing table at host.

Mr. A. Swaminathan VIT Chennai


37

An Example
▪ X receives LSP from some node Y.
▪ X checks to see if it already has an
update from Y. If it does, it compares
the sequence number in the new LSP X A X A

to the one stored.


▪ If New seq no < Old sequence number, C B D C B D

then, discard LSP. (a) (b)

▪ Else -- store LSP and send the LSP to all


neighbors except the one that sent the X A X A
LSP.
▪ If no update from Y, keep it. C B D C B D

(c) (d)

Mr. A. Swaminathan VIT Chennai


38

Dissemination of LSPs
▪ LSPs are sent periodically (upon the expiry of a timer) or may be triggered
due to a change in topology (as in RIP).
▪ The only topology change that triggers the creation of a new LSP is a
change to one of the directly connected links.
▪ Failures detected by link layer protocol by using what are known as “HELLO”
packets -- probes to determine if neighbor is alive.
▪ To minimize overhead, LPSs are not created unless needed --periodicity is
of the order of hours.
▪ Sequence numbers help in identifying new info and TTL helps in ensuring
that packets don’t stay in the network indefinitely.

Mr. A. Swaminathan VIT Chennai


39
Graph abstraction
▪ Used for computation of shortest path using Dijkstra’s.
▪ Let N denote the set of nodes in the graph.
▪ l(i,j) denotes the non-negative cost or weight associated with
the edge between nodes i and j.
▪ l(i,j) = ∞ if there is no edge between i and j.
▪ Remember -- each node has entire map of network.

Mr. A. Swaminathan VIT Chennai


An Example 40

B
5 3
10 C
A
11
2
D
Mr. A. Swaminathan VIT Chennai
Steps for building routing table of node D 41

Mr. A. Swaminathan VIT Chennai


Link State Routing 42

▪ Initial state : similar to distance vector i.e., state of link to


neighbors known (up/down).
▪ Goal : To find the path of least cost to destination.
▪ Basic Idea -- Every node knows how to reach its neighbors. If
this info is dissemination to every node, every node ultimately
has the info. to build the complete map of the network.
▪ Open Shortest Path First:

Mr. A. Swaminathan VIT Chennai


43

Link State Information


▪ Each node creates a link-state packet (LSP) that contains:
▪ ID of the node that created LSP
▪ a list of directly connected nodes and the cost to each node.
▪ sequence number
▪ TTL

} for
reliability
Mr. A. Swaminathan VIT Chennai
Open Shortest Path First 44

▪ Link state protocol


▪ It is more complex than EIGRP.
▪ Features
▪ Open standard protocol
▪ it supports features such as Variable length subnet mask (VLSM)/ Classless
Inter-Domain Routing (CIDR) etc
▪ Highly scalable
▪ Does not have hop count limit
▪ It works in multivendor environment
▪ Minimizes works between neighbors

Mr. A. Swaminathan VIT Chennai


OSPF 45

▪ route computation using Dijkstra’s algorithm


▪ It supports hierarchical design
▪ larger network divided into smaller networks
▪ Even though these areas are separated but it works with single OSPF
autonomous system
▪ EIGRP is different from other it works on multiple autonomous system
▪ Though the areas are independent the EIGRP requires redistribution
and vice versa

Mr. A. Swaminathan VIT Chennai


OSPF (Open Shortest Path First) 46

▪ “Open”: publicly available

▪ Uses Link State algorithm


▪ link state (LS) packet dissemination
▪ topology map at each node
▪ route computation using Dijkstra’s algorithm

Mr. A. Swaminathan VIT Chennai


47
OSPF “Advanced” Features (not in RIP)
▪ Multiple same-cost paths allowed (only one path in RIP)
▪ For each link, multiple cost metrics for different Type Of
Service (eg, satellite link cost set “low” for best effort;
high for real time)
▪ Security: all OSPF messages authenticated (to prevent
malicious intrusion); TCP connections used
▪ Hierarchical OSPF

Mr. A. Swaminathan VIT Chennai


OSPF 48

▪ Advantages
▪ decrease routing overhead and flow of updates
▪ limit network problems such as instability to an area
▪ Speed up convergence
▪ disadvantages
▪ planning and Configuration is difficult

Mr. A. Swaminathan VIT Chennai


49
OSPF “Advanced” Features (not in RIP)
▪ Multiple same-cost paths allowed (only one path in RIP)
▪ For each link, multiple cost metrics for different Type Of
Service (eg, satellite link cost set “low” for best effort;
high for real time)
▪ Security: all OSPF messages authenticated (to prevent
malicious intrusion); TCP connections used
▪ Hierarchical OSPF

Mr. A. Swaminathan VIT Chennai


Hierarchical OSPF 50

“summarize” distances to run OSPF routing


nets in own area, advertise limited to
to other Area Border backbone.
routers.

- Link-state advertisements only in area


each nodes has detailed area topology;
- only know direction (shortest path) to nets in
other areas. Mr. A. Swaminathan VIT Chennai
Two-level hierarchy: local area, backbone.
Why Hierarchy? 51

▪ Information hiding (filtered) => reduce computation,


bandwidth, storage

Mr. A. Swaminathan VIT Chennai


52

Mr. A. Swaminathan VIT Chennai


53

Mr. A. Swaminathan VIT Chennai


54

References
▪ CISCO Packet Magazine, 2nd Quarter 2002
http://www.cisco.com/en/US/about/ac123/ac114/ac173/ac168/ab
out_cisco_packet_issue_home.html
▪ 3Com University – Wireless LANs A Technology Overview
www.3com.com/3comu
▪ National Institute of Standards and Technology Wireless Network
Security http://csrc.nist.gov/publications/drafts/draft-sp800-
48.pdf
Mr.A.Swaminathan VIT Chennai

You might also like