0% found this document useful (0 votes)
3 views28 pages

Routing Algorithms

The document provides an overview of interior routing protocols used in IP networks, detailing how routers forward IP datagrams and make routing decisions based on network topology and cost criteria. It discusses fixed and adaptive routing methods, challenges associated with adaptive routing, and various routing strategies including distance-vector, link-state, and path-vector approaches. Additionally, it covers specific protocols like RIP and the characteristics of distance vector routing, highlighting their historical development and operational mechanics.

Uploaded by

subhrand66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views28 pages

Routing Algorithms

The document provides an overview of interior routing protocols used in IP networks, detailing how routers forward IP datagrams and make routing decisions based on network topology and cost criteria. It discusses fixed and adaptive routing methods, challenges associated with adaptive routing, and various routing strategies including distance-vector, link-state, and path-vector approaches. Additionally, it covers specific protocols like RIP and the characteristics of distance vector routing, highlighting their historical development and operational mechanics.

Uploaded by

subhrand66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Interior Routing Protocols

Routing in IP

Introduction
• Routers forward IP datagrams from one router
to another on the path from source towards
destination
• Routing protocols
—To decide on routes to be taken
• Routers must have idea of topology of internet
in order to pick best route to take
—Decisions are based on some least cost criteria
—May depend on the current conditions

Chapter 15 1
Interior Routing Protocols

A Sample Configuration of
Routers and Networks
• Link costs are at
the output of the
links
• There is cost of
putting data to
the network
• There is no cost
of getting data
from the
network
• For example, the
cost of the path
X-A-F-Y is
1+1+4=6

Routing Table
• One routing table is needed for each router
• One entry for each destination network
— Not for each destination host
— Once datagram reaches router attached to destination network,
that router can deliver to host
• Each entry shows next node on the route to destination
— Not whole route
• Routing tables may also exist in hosts
— If multiple routers attached to network, host needs table saying
which to use
— If the attached network has single router, then routing table is
not needed
• All traffic must go through that router (called the gateway)

Chapter 15 2
Interior Routing Protocols

Example Routing Tables

Fixed Routing
• Single permanent route configured for each
source-destination pair
—Routes are fixed
—May change when topology changes (not so often)
• No dynamic updates

Chapter 15 3
Interior Routing Protocols

Adaptive Routing
• As conditions on internetwork change, routes
may change
—Failure
• of routers or networks
—Congestion
• If a particular section of the network is heavily congested, it
is better not to use that part and change the route

Adaptive Routing - Challenges


• Complex routing decisions
—Router processing increases
• Depends on information collected in one place
but used in another
—More information exchange improves routing
decisions, but increases overhead
• May react too fast
—causing congestion through oscillation (fluttering)
• May react too slow
—By the time routing decision changes, the network
conditions may be much more different

Chapter 15 4
Interior Routing Protocols

Adaptive Routing - Challenges


• Looping
—Packet forwarded by a router eventually returns to
the same router
—May occur when changes in connectivity are not
propagated fast enough to all other routers
—An important pathology that must be prevented in
routing algorithms

• Despite all challenges, adaptive routing prevails


due to its flexibility

Classification of Adaptive
Routing Strategies
• Based on information sources
—Local
• E.g. route each datagram to network with shortest queue
– Balance loads on outgoing networks
– May not be heading in correct direction
• Rarely used
—Adjacent nodes
• Delay and outage info from adjacent nodes
• Distance vector algorithms
– Discussed later
—All nodes
• Link-state algorithms
– Discussed later

Chapter 15 5
Interior Routing Protocols

Flooding
• No network info required
• Packet sent by node to every neighbor
• Incoming packets retransmitted on every link
except incoming link
• Eventually a number of copies will arrive at
destination
• Each packet is uniquely numbered so duplicates
can be discarded at destination

Flooding
Example

Chapter 15 6
Interior Routing Protocols

Flooding- Improvements
• Precautions against unlimited grow in circulation
—Nodes can remember packets already forwarded to
keep network load within allowed limits
• called "Restricted Flooding"
—Include a hop count in packets.
• Set to a maximum value
• Decrease one at each hop
• Discard when 0

Properties of Flooding
• All possible routes are tried
—very robust
—can be used for emergency messaging
• At least one packet will use minimum hop count
route
—Can be used once to set up a route
• All nodes are visited
—Useful to distribute information (e.g. routing info)

Chapter 15 7
Interior Routing Protocols

Random Routing
• Node selects one outgoing path for
retransmission of incoming packet
• Selection is at random
—equally likely
• all outgoing links are utilized equally in the long-run
—can select outgoing path based on a probability
• e.g. probability based on data rate
– good traffic distribution
• No network info needed
• Route is typically neither least cost nor minimum
hop

Autonomous Systems (AS)


• An important concept for TCP/IP routing in IP
layer

• AS is defined as set of routers and networks


managed by single organization (e.g. an ISP)
—Exchange routing information in itself
—Common routing protocol
• An AS must be connected in itself
—There is at least one route between any pair of nodes
and networks

Chapter 15 8
Interior Routing Protocols

Interior Routing Protocol (IRP)


Exterior Routing Protocol (ERP)
• (not actually protocols, just concepts)
• IRP passes routing information between routers
within AS
—Need exchange of info among the routers only in AS
—Different autonomous systems may have different IRP
mechanisms
• Autonomous systems need to talk to each other
—Need minimum information from each other connected AS
—A few routers in each AS must talk
—Use Exterior Routing Protocol (ERP)
• Again, a concept
—ERP does not deal with details within source and target
AS

Application of Exterior and Interior


Routing Protocols

Chapter 15 9
Interior Routing Protocols

Approaches to Routing –
Distance-vector
• Each router exchange information with neighboring routers
— Definition: Two nodes are said to be neighbors if both are directly
connected to each other or to the same network
• Each node keeps
— distance vector and next-hop vector (Routing table)
• One entry for each destination network
— a vector of link costs for each directly attached network
• First generation routing algorithm for ARPANET
• Used by Routing Information Protocol (RIP)
— will discuss later
• Requires transmission of information by each router to all
neighbors
— Distance vector that contains estimated path costs for all destination
networks
— Changes may take long time to propagate

Approaches to Routing –
Link-state
• Designed to overcome drawbacks of distance-vector
• When router initialized, it determines link cost on each interface
• Advertises set of link costs to all other routers in topology
— Not just neighboring routers
• After that, each router monitors its link costs
— If significant change, router advertises new set of link costs
• In this way, each router builds up a picture of the entire topology
— Can calculate shortest path to each destination
— Use an algorithm to determine shortest paths
• In practice, Dijkstra's algorithm
• Router constructs routing table, listing first hop to each destination
• Second generation routing algorithm for ARPANET
• Open shortest path first (OSPF) protocol uses link-state routing.

Chapter 15 10
Interior Routing Protocols

Distance-vector and Link State


• Both of them is suitable for IRP, not ERP
• Several reasons. Some of them:
—Both require homogenous metrics that may be the
case within an AS, but we cannot assume then same
for several AS systems
—Flooding the link state information across multiple AS
systems is not scalable

Approaches to Routing –
Path-vector
• Suitable approach for Exterior Router Protocols
• Provide information about which networks can
be reached by a given router and Autonomous
Systems crossed to get there
—Does not include distance or cost estimate
• BGP (Border Gateway Protocol) is an example to
path-vector routing protocol

Chapter 15 11
Interior Routing Protocols

Least Cost Algorithms


• Routing decision is based on some least-cost criteria
(minimization problem)
— If minimize number of hops, link cost is 1
— Link cost may be inversely proportional to capacity, proportional
to current load (queue length), or some combination
— May be different in two directions (e.g. if cost is queue length)
• More formal problem definition
— For each pair of nodes,
find the least cost path
— Cost of path between two nodes
is sum of costs of links traversed
• Dijkstra's algorithm
• Bellman-Ford algorithm

Dijkstra's Algorithm
• Find shortest paths from a given node to all
other nodes, by developing paths in the order of
increasing path length (and increasing cost)
• Proceeds in stages
—At each stage shortest path from source to one node
is determined
—The nodes for which shortest path determined are
kept in a set called T
—At each iteration, node not in T but has the shortest
path from source added to T
—As each node added to T, path from source to the
nodes not in T are checked to see whether there is a
better path through this newly added node

Chapter 15 12
Interior Routing Protocols

Dijkstra's Algorithm –
Formal (1)
• N = set of nodes in the network
• s = source node
• T = set of nodes so far incorporated (shortest path
found)
• w(i, j) = link cost from node i to node j
w(i, i) = 0
w(i, j) =  if nodes not directly connected
w(i, j)  0 if nodes are directly connected
• L(n) = cost of current least-cost path from s to n
— At the end of algorithm (actually as soon as n is added to T),
L(n) is the cost of least-cost path from s to n

Dijkstra's Algorithm –
Formal (2)
[Initialization]
T = {s}
i.e. set of nodes so far incorporated consists of only source node
L(n) = w(s, n) for all n ≠ s
i.e. initial path costs to neighboring nodes are link costs

Chapter 15 13
Interior Routing Protocols

Dijkstra's Algorithm –
Formal (3)
Repeat

[Get Next Node]


Find neighboring node not in T with least-cost path from s
Find x T such that min
L x   L j 
jT
Add x to T. L(x) is the shortest path from s to x.

[Update Least-Cost Paths]


L(n) = min[L(n), L(x) + w(x, n)] for all n T
If the latter term is the minimum, the path from s to n is now
the path from s to x concatenated with the edge from x to n.

Until all nodes are in T

Dijkstra’s Algorithm – Check PPT


• Requirements:

• Graph needs to be connected and either directed or undirected


weighted graph

• Non-negative weight

• Search complexity: O(|E| + |V|log|V|)

• BFS approach

• Popularly used in link state routing methods

• Greedy

Chapter 15 14
Interior Routing Protocols

Bellman-Ford Algorithm
• Iterative
1.find the shortest paths from a source to all possible
destinations using only one link
2.then using max. two links by adding appropriate links
to the paths of step 1
3.then using max. 3 links on top of paths with two links
4.so on .. until no improvement is gained by adding
more links

Bellman-Ford Algorithm –
Formal (1)
• s = source node
• w(i, j) = link cost from node i to node j
w(i, i) = 0
w(i, j) =  if nodes are not directly connected
w(i, j)  0 if nodes directly connected
• h = maximum number of links in path at current
stage
• Lh(n) =cost of least-cost path from s to n such
that path contains no more than h links

Chapter 15 15
Interior Routing Protocols

Bellman-Ford Algorithm –
Formal (2)
[Initialization]
L0(n) = , for all n  s
h=0

Bellman-Ford Algorithm –
Formal (3)
[Update]
Loop until no more improvements
For each n ≠ s, compute
min
L h1n 
j
 
Lh  j   w j, n

If s-to-n cost reduced, then path also


changes to s -…- j - n
h=h+1

Chapter 15 16
Interior Routing Protocols

RIP

Approaches to Shortest Path


Routing
• There are two basic routing algorithms found on the
Internet.
1. Distance Vector Routing
• Each node knows the distance (=cost) to its directly connected
neighbors
• A node sends periodically a list of routing updates to its neighbors.
• If all nodes update their distances, the routing tables eventually
converge
• New nodes advertise themselves to their neighbors

2. Link State Routing


• Each node knows the distance to its neighbors
• The distance information (=link state) is broadcast to all nodes in the
network
• Each node calculates the routing tables independently
34

Chapter 15 17
Interior Routing Protocols

Routing Algorithms in the Internet


Distance Vector Link State

• Routing Information Protocol • Intermediate System -


(RIP) Intermediate System (IS-IS)

• Gateway-to-Gateway Protocol • Open Shortest Path First


(GGP) (OSPF)

• Exterior Gateway Protocol (EGP)

• Interior Gateway Routing Protocol


(IGRP)

35

Characteristics of Distance Vector


Routing
• Periodic Updates: Updates to the routing tables
are sent at the end of a certain time period. A
typical value is 90 seconds.
• Triggered Updates: If a metric changes on a link,
a router immediately sends out an update without
waiting for the end of the update period.
• Full Routing Table Update: Most distance vector
routing protocol send their neighbors the entire
routing table (not only entries which change).
• Route invalidation timers: Routing table entries
are invalid if they are not refreshed. A typical value
is to invalidate an entry if no update is received
after 3-6 update periods.
36

Chapter 15 18
Interior Routing Protocols

RIP - Routing Information Protocol


• A simple intradomain protocol
• Straightforward implementation of Distance Vector
Routing
• Each router advertises its distance vector every 30
seconds (or whenever its routing table changes) to
all of its neighbors
• RIP always uses 1 as link metric
• Maximum hop count is 15, with “16” equal to “”
• Routes are timeout (set to 16) after 3 minutes if
they are not updated
37

RIP - History
• Late 1960s : Distance Vector
protocols were used in the ARPANET
• Mid-1970s: XNS (Xerox Network system) routing
protocol is the precursor of RIP in IP (and Novell’s
IPX RIP and Apple’s routing protocol)
• 1982 Release of routed for BSD Unix
• 1988 RIPv1 (RFC 1058)
- classful routing
• 1993 RIPv2 (RFC 1388)
- adds subnet masks with each route
entry
- allows classless routing
• 1998 Current version of RIPv2 (RFC 2453)
38

Chapter 15 19
Interior Routing Protocols

RIP - History
• Late 1960s : Distance Vector
protocols were used in the ARPANET
• Mid-1970s: XNS (Xerox Network system) routing
protocol is the precursor of RIP in IP (and Novell’s
IPX RIP and Apple’s routing protocol)
• 1982 Release of routed for BSD Unix
• 1988 RIPv1 (RFC 1058)
- classful routing
• 1993 RIPv2 (RFC 1388)
- adds subnet masks with each route
entry
- allows classless routing
• 1998 Current version of RIPv2 (RFC 2453)
39

RIPv1 Packet Format


IP header UDP header RIP Message 1: RIPv1

1: request
2: response
Command Version Set to 00...0
2: for IP
address family Set to 00.00
0…0: request full rou-
one route entry

ting table 32-bit address


(20 bytes)

Unused (Set to 00...0)


Address of destination
Unused (Set to 00...0)

Cost (measured in hops) metric (1-16)

Up to 24 more routes (each 20 bytes)


One RIP message can
have up to 25 route entries
40
32 bits

Chapter 15 20
Interior Routing Protocols

RIPv2
• RIPv2 is an extends RIPv1:
—Subnet masks are carried in the route information
—Authentication of routing messages
—Route information carries next-hop address
—Exploites IP multicasting

• Extensions of RIPv2 are carried in unused fields


of RIPv1 messages

41

RIPv2 Packet Format


IP header UDP header RIP Message 2: RIPv1

1: request
2: response
Command Version Set to 00...0
2: for IP
address family Set to 00.00
0…0: request full rou-
one route entry

ting table 32-bit address


(20 bytes)

Unused (Set to 00...0)


Address of destination
Unused (Set to 00...0)

Cost (measured in hops) metric (1-16)

Up to 24 more routes (each 20 bytes)


One RIP message can
have up to 25 route entries
42
32 bits

Chapter 15 21
Interior Routing Protocols

RIPv2 Packet Format


IP header UDP header RIPv2 Message 2: RIPv2

Used to carry information


from other routing
protocols (e.g., Command Version Set to 00.00
autonomous system
address family route tag
number)

one route entry


IP address

(20 bytes)
Subnet mask for IP
address Subnet Mask
Next-Hop IP address
Identifies a better next-hop
metric (1-16)
address on the same
subnet than the advertising
router, if one exists Up to 24 more routes (each 20 bytes)
(otherwise 0….0)
43
32 bits

RIP Messages
• This is the operation of RIP in routed.
Dedicated port for RIP is UDP port 520.

• Two types of messages:


—Request messages
• used to ask neighboring nodes for an update
—Response messages
• contains an update

44

Chapter 15 22
Interior Routing Protocols

Routing with RIP


• Initialization: Send a request packet (command = 1, address
family=0..0) on all interfaces:
• RIPv1 uses broadcast if possible,
• RIPv2 uses multicast address 224.0.0.9, if possible
requesting routing tables from neighboring routers
• Request received: Routers that receive above request send their
entire routing table
• Response received: Update the routing table

• Typically, there is a routing daemon (routed) that is an application


layer process that provides access to routing tables.

45

Routing with Rip Cont.


• Regular routing updates: Every 30 seconds,
send all or part of the routing tables to every
neighbor in an response message
• Triggered Updates: Whenever the metric for
a route change, send entire routing table.
• If a router does not hear from its neighbor once
every 180 seconds, the neighbor is deemed
unreachable.

Chapter 15 23
Interior Routing Protocols

Security
• Issue: Sending bogus routing updates to a
router
• RIPv1: No protection
• RIPv2: Simple authentication scheme

RIP Security

IP header UDP header RIPv2 Message


2: plaintext
password
Command Version Set to 00.00
0xffff Authentication Type
Authetication

Password (Bytes 0 - 3)

Password (Bytes 4 - 7)

Password (Bytes 8- 11)

Password (Bytes 12 - 15)

Up to 24 more routes (each 20 bytes)


48
32 bits

Chapter 15 24
Interior Routing Protocols

RIP Problems

• RIP takes a long time to stabilize


—Even for a small network, it takes several minutes
until the routing tables have settled after a change
• RIP has all the problems of distance vector
algorithms, e.g., count-to-Infinity
• RIP uses split horizon to avoid count-to-infinity
• The maximum path in RIP is 15 hops

49

An Example of RIP

• Routers advertise the cost of


reaching networks. 1 4
• In this example, C’s update to
A would indicate that C can A B
reach Networks 2 and 3 with 2 5
cost 0, Networks 5 and 6 with
cost 1 and Network 4 with cost
C D
2.
3 6

Chapter 15 25
Interior Routing Protocols

Counting to Infinity Problem (1)


• A problem of RIP is slow convergence to a change in topology
• Consider the example network below with all link costs 1
— The distance of B to network 5 is 2, next hop is D
— A and C have distances of 3 and next hop is B

Counting to Infinity Problem (2)


• Suppose router D fails:
— B determines network 5 no longer reachable via D
• Sets distance to 4 based on report from A or C
— At next update, B tells A and C this new distance to network 5
— A and C receive this and increment their network 5 distance to 5
• 4 from B, plus 1 to reach B
— B receives distance count 5 and assumes network 5 is 6 unit
cost away
— Repeat until reach infinity (16)
— Update interval is 30 seconds, so reaching 16 takes several
minutes. If infinity is larger, then convergence would take
longer.

Chapter 15 26
Interior Routing Protocols

Split Horizon Rule


• Counting to infinity problem is caused by
misunderstanding between B and A, and
between B and C
—Each thinks it can reach network 5 via the other
• Split Horizon rule says “do not send information
about a route back in the direction it came from”
—Router sending information is nearer to the
destination than you are
—Don't teach your grandma how to suck eggs! 
• Erroneous route now eliminated within time out
period (180 seconds)

Open Shortest Path First


(OSPF)
• RIP has limitations in large internets
• OSPF is preferred interior routing protocol for
TCP/IP based internets
• Link state routing used

Chapter 15 27
Interior Routing Protocols

Link State Routing


• When initialized, router determines link cost on
each interface
• Router advertises these costs to all other
routers in topology
• Router monitors its costs
—When changes occur, costs are re-advertised
• Each router constructs topology and calculates
shortest path to each destination network
—Can use any algorithm, but in practice Dijkstra is
used

Chapter 15 28

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy