ROUTING ALGORITHMS
by Moctard
OLOULADE
December 2018
Wuhan University ofTechnology
What is an algorithm ?
• A list of instructions, procedures, or formula
• Can be proven.
• Something that always finishes and works
A routing algorithm is a set of step-by-step operations used to direct
Internet traffic efficiently.
When a packet of data leaves its source, there are many different paths it can take to its destination. The routing
algorithm is used to determine mathematically the best path to take
Routing algorithm classification
all routers have complete
topology, link cost info
“link state”
algorithms
router knows physically-
connected neighbors, link costs to
neighbors
“distance vector”
algorithms
computes the least-cost path between
a source and destination
centralized
information
decentralized
information
Static
Dynamic
computes the least-cost path between
a source and destination
routes change very slowly over
time, often as a result of human
intervention
for example, a human manually
editing a link costs
routes change more quickly
adapt routes in response to
changes in network topology
link costs vary dynamically to
reflect the current level of
congestion in the underlying link
ARPAnet routing
algorithms
a link’s cost does not explicitly
reflect its current (or recent past)
level of congestion
RIP,OSPF,
and BGP
For height cost, tend to
choose routes around such
a congested link
load-sensitive
load-insensitive
LINK STATE ROUTING
"tell about your neighbors to everyone"
at the end of it Each node then independently runs Dijkstra's
shortest path algorithm to get the shortest path to every
destination
Dijkstra’s algorithm
Distance vector routing
"tell about everyone to your neighbors"
at the end of a node updates its distance vector by adding its
link cost to neighbor's distance vector, and if a better path is
found through neighbor, it updates its best route
This is called the Bellman-Ford update algorithm.
Bellman-Ford equation
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min {c(x,v) + dv(y) }
Initialization of tables in distance vector routing
In distance vector routing, each node shares its table with
its immediate neighbor periodically (eg every 30s) and when
there is a change. to
Updating in distance vector routing
Step 1: Add cost (2) to table received from neighbor (C).
Step 2: Compare ModifiedTable with OldTable (row by row).
If Next node entry is different, select the row with the smaller
cost. If tie, keep the old one.
If Next node entry the same, select the new row value (regard-
less of whether new value is smaller or not).
Distance vector routing tables
Comparison of LS and DV algorithms
Link state routing Distance vector routing
message complexity with n nodes, E links, O(nE)
msgs sent
exchange between neighbors
only
speed of convergence O(n2) algorithm requires O(nE)
msgs (may have oscillations)
convergence time varies (may
be routing loops, count-to-
infinity problem
Robustness ( What can happen if
a router fails)
- node can advertise incorrect
link cost
- each node computes only its
own table
-DV node can advertise
incorrect path cost
-each node’s table used by
others
-error propagate thru network
Neither algorithm is an obvious winner over the other;
indeed, both algorithms are used in the Internet.
Question:
How to resolve Scale and Administrative autonomy
problems
Answer:
organize routers into autonomous systems (ASs)
Routing protocols
Intra-autonomous
system routing
protocol
Link State
OSPF
Distance Vector
RIP
inter-autonomous
system routing
protocol
Path Vector
BGP
Intra-AS Routing in the Internet: OSPF
• Is a link-state protocol that uses flooding of link-state
information and a Dijkstra’s least-cost path algorithm.
• Provides for authentication of routing messages.
• 8-byte password designed to avoid misconfiguration.
• Provides additional hierarchy
• Domains are partitioned into areas.
• This reduces the amount of information transmitted in packet.
• Provides load-balancing via multiple routes.
Areas in an autonomous system
otwo-level hierarchy: local area, backbone.
oarea border routers: “summarize” distances to nets in own area,
advertise to other Area Border routers.
obackbone routers: run OSPF routing limited to backbone.
oboundary routers: connect to other AS’es.
advances embodied in OSPF
Security
all OSPF messages authenticated (to
prevent malicious intrusion)
Multiple same-cost paths
a single path need not be chosen for carrying all
traffic when
multiple equal-cost paths exist
Integrated support for unicast and multicast
routing
provides simple extensions to OSPF to provide for
multicast routing
Support for hierarchy within a single AS
An OSPF autonomous system can be configured
hierarchically into areas
RIP - Routing Information Protocol
• A simple intradomain protocol
• Straightforward implementation of DistanceVector 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
22
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
23
RIP Messages
• 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
24
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec --> neighbor/link
declared dead
• routes via neighbor invalidated
• new advertisements sent to neighbors
• neighbors in turn send out new advertisements (if tables changed)
• link failure info quickly propagates to entire net
• poison reverse used to prevent ping-pong loops (infinite distance = 16
hops)
Security
• Issue: Sending bogus routing updates to a router
• RIPv1: No protection
• RIPv2: Simple authentication scheme
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
27
BGP
Border Gateway Protocol (BGP) is an interdomain routing protocol using path vector routing. It first
appeared in 1989 and has gone through four versions. BGP uses the services of TCP
on port 179.
BGP interconnects three different types of AS:
1. Stub AS, e.g. a corporate network
2. Multihomed AS, e.g. a large corporate network with connections to
multiple ASs, but does not allow traffic to pass thru (transient)
3. Transit AS - one that allows transient traffic, such as an Internet backbone
The Role of BGP
Obtain prefix reachability information from
neighboring Ass
Determine the “best” routes to the prefixes
BGP Operation
• Runs over a reliable transport protocol (TCP)
• Uses TCP port 179 to establish connections
• BGP Speaker is router running BGP protocol ,speakers communicate acrossTCP and become peers or neighbors.
• External links: connections between BGP speakers in differentAS.
• Internal links: connections between BGP speakers in the same AS.
• Resolve connection collisions if two BGP peers Simultaneously try to open connection.
BGP Session Estblishment
• Connect.req
SYN(179)
SYN +ACK
CONNECT.conf
TCP session established
DATA.req(OPEN)
DATA(BGPopen)
DATA.req
TCP session Established
DATA(BGPopen)
ACK(179)
ACK
ACK
DATA.req(OPEN)
BGP Session Established
BGP Session Established
Connect.ind
Connect.resp
DATA.req(open)
eBGP and iBGP
• eBGP
• BGP running between two different ASs
• iBGP
• BGP running within the same AS
• An AS has multiple BGP speakers
• Distribute routing info among BGP routers
• Minor but important difference with eBGP
Why Choose External BGP (E-BGP)
• Link state or distance vector?
• No universal metric – policy decisions
• Problems with distance-vector:
• Bellman-Ford algorithm may not converge
• Problems with link state:
• Metric used by routers not the same – loops
• LS database too large – entire Internet
• May expose policies to other AS’s
Solution: DistanceVector with Path
• Each routing update carries the entire path
• Loops are detected as follows:
• WhenAS gets route check if AS already in path
• If yes, reject route
• If no, add self and (possibly) advertise route further
• Advantage:
• Metrics are local - AS chooses path, protocol ensures no loops
Interconnecting BGP Peers
• BGP usesTCP to connect peers
• Advantages:
• Simplifies BGP
• No need for periodic refresh - routes are valid until withdrawn, or the connection is lost
• Incremental updates
• Disadvantages
• Congestion control on a routing protocol?
• Poor interaction during high load
Policy with BGP
• BGP provides capability for enforcing various policies
• Policies are not part of BGP: they are provided to BGP as configuration
information
• BGP enforces policies by choosing paths from multiple alternatives and
controlling advertisement to otherAS’s
Examples of BGP Policies
• A multi-homed AS refuses to act as transit
• Limit path advertisement
• A multi-homed AS can become transit for someAS’s
• Only advertise paths to some AS’s
• An AS can favor or disfavor certain AS’s for traffic transit from itself
BGP Messages
• Open
• AnnouncesAS ID
• Determines hold timer – interval between keep_alive or update messages, zero interval implies no
keep_alive
• Keep_alive
• Sent periodically (but before hold timer expires) to peers to ensure connectivity.
• Sent in place of an UPDATE message
• Notification
• Used for error notification
• TCP connection is closed immediately after notification
BGP UPDATE Message
• List of withdrawn routes
• Network layer reachability information
• List of reachable prefixes
• Path attributes
• Origin
• Path
• Metrics
• All prefixes advertised in message have same path attributes
Path Selection Criteria
• Information based on path attributes
• Attributes + external (policy) information
• Examples:
• Hop count
• Policy considerations
• Preference forAS
• Presence or absence of certain AS
• Path origin
• Link dynamics
Internal BGP (I-BGP)
• Same messages as E-BGP
• Different rules about re-advertising prefixes:
• Prefix learned from E-BGP can be advertised to I-BGP neighbor and vice-versa, but
• Prefix learned from one I-BGP neighbor cannot be advertised to another I-BGP
neighbor
• Reason: noAS PATH within the same AS and thus danger of looping.
Lecture #13: 02-24-04
Internal BGP (I-BGP)
R3 R4
R1
R2
E-BGP
I-BGP
•R3 can tell R1 and R2 prefixes from R4
•R3 can tell R4 prefixes from R1 and R2
•R3 cannot tell R2 prefixes from R1
R2 can only find these prefixes through a direct connection to R1
Result: I-BGP routers must be fully connected (via TCP)!
•contrast with E-BGP sessions that map to physical links
AS1 AS2
Routing algorithms

Routing algorithms

  • 1.
    ROUTING ALGORITHMS by Moctard OLOULADE December2018 Wuhan University ofTechnology
  • 2.
    What is analgorithm ? • A list of instructions, procedures, or formula • Can be proven. • Something that always finishes and works
  • 3.
    A routing algorithmis a set of step-by-step operations used to direct Internet traffic efficiently. When a packet of data leaves its source, there are many different paths it can take to its destination. The routing algorithm is used to determine mathematically the best path to take
  • 4.
    Routing algorithm classification allrouters have complete topology, link cost info “link state” algorithms router knows physically- connected neighbors, link costs to neighbors “distance vector” algorithms computes the least-cost path between a source and destination centralized information decentralized information Static Dynamic computes the least-cost path between a source and destination routes change very slowly over time, often as a result of human intervention for example, a human manually editing a link costs routes change more quickly adapt routes in response to changes in network topology link costs vary dynamically to reflect the current level of congestion in the underlying link ARPAnet routing algorithms a link’s cost does not explicitly reflect its current (or recent past) level of congestion RIP,OSPF, and BGP For height cost, tend to choose routes around such a congested link load-sensitive load-insensitive
  • 5.
    LINK STATE ROUTING "tellabout your neighbors to everyone" at the end of it Each node then independently runs Dijkstra's shortest path algorithm to get the shortest path to every destination
  • 6.
  • 9.
    Distance vector routing "tellabout everyone to your neighbors" at the end of a node updates its distance vector by adding its link cost to neighbor's distance vector, and if a better path is found through neighbor, it updates its best route This is called the Bellman-Ford update algorithm.
  • 12.
    Bellman-Ford equation let dx(y) :=cost of least-cost path from x to y then dx(y) = min {c(x,v) + dv(y) }
  • 13.
    Initialization of tablesin distance vector routing In distance vector routing, each node shares its table with its immediate neighbor periodically (eg every 30s) and when there is a change. to
  • 14.
    Updating in distancevector routing Step 1: Add cost (2) to table received from neighbor (C). Step 2: Compare ModifiedTable with OldTable (row by row). If Next node entry is different, select the row with the smaller cost. If tie, keep the old one. If Next node entry the same, select the new row value (regard- less of whether new value is smaller or not).
  • 15.
  • 16.
    Comparison of LSand DV algorithms Link state routing Distance vector routing message complexity with n nodes, E links, O(nE) msgs sent exchange between neighbors only speed of convergence O(n2) algorithm requires O(nE) msgs (may have oscillations) convergence time varies (may be routing loops, count-to- infinity problem Robustness ( What can happen if a router fails) - node can advertise incorrect link cost - each node computes only its own table -DV node can advertise incorrect path cost -each node’s table used by others -error propagate thru network Neither algorithm is an obvious winner over the other; indeed, both algorithms are used in the Internet.
  • 17.
    Question: How to resolveScale and Administrative autonomy problems Answer: organize routers into autonomous systems (ASs)
  • 18.
    Routing protocols Intra-autonomous system routing protocol LinkState OSPF Distance Vector RIP inter-autonomous system routing protocol Path Vector BGP
  • 19.
    Intra-AS Routing inthe Internet: OSPF • Is a link-state protocol that uses flooding of link-state information and a Dijkstra’s least-cost path algorithm. • Provides for authentication of routing messages. • 8-byte password designed to avoid misconfiguration. • Provides additional hierarchy • Domains are partitioned into areas. • This reduces the amount of information transmitted in packet. • Provides load-balancing via multiple routes.
  • 20.
    Areas in anautonomous system otwo-level hierarchy: local area, backbone. oarea border routers: “summarize” distances to nets in own area, advertise to other Area Border routers. obackbone routers: run OSPF routing limited to backbone. oboundary routers: connect to other AS’es.
  • 21.
    advances embodied inOSPF Security all OSPF messages authenticated (to prevent malicious intrusion) Multiple same-cost paths a single path need not be chosen for carrying all traffic when multiple equal-cost paths exist Integrated support for unicast and multicast routing provides simple extensions to OSPF to provide for multicast routing Support for hierarchy within a single AS An OSPF autonomous system can be configured hierarchically into areas
  • 22.
    RIP - RoutingInformation Protocol • A simple intradomain protocol • Straightforward implementation of DistanceVector 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 22
  • 23.
    RIPv2 • RIPv2 isan 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 23
  • 24.
    RIP Messages • Dedicatedport 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 24
  • 25.
    RIP: Link Failureand Recovery If no advertisement heard after 180 sec --> neighbor/link declared dead • routes via neighbor invalidated • new advertisements sent to neighbors • neighbors in turn send out new advertisements (if tables changed) • link failure info quickly propagates to entire net • poison reverse used to prevent ping-pong loops (infinite distance = 16 hops)
  • 26.
    Security • Issue: Sendingbogus routing updates to a router • RIPv1: No protection • RIPv2: Simple authentication scheme
  • 27.
    RIP Problems • RIPtakes 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 27
  • 28.
    BGP Border Gateway Protocol(BGP) is an interdomain routing protocol using path vector routing. It first appeared in 1989 and has gone through four versions. BGP uses the services of TCP on port 179. BGP interconnects three different types of AS: 1. Stub AS, e.g. a corporate network 2. Multihomed AS, e.g. a large corporate network with connections to multiple ASs, but does not allow traffic to pass thru (transient) 3. Transit AS - one that allows transient traffic, such as an Internet backbone
  • 29.
    The Role ofBGP Obtain prefix reachability information from neighboring Ass Determine the “best” routes to the prefixes
  • 30.
    BGP Operation • Runsover a reliable transport protocol (TCP) • Uses TCP port 179 to establish connections • BGP Speaker is router running BGP protocol ,speakers communicate acrossTCP and become peers or neighbors. • External links: connections between BGP speakers in differentAS. • Internal links: connections between BGP speakers in the same AS. • Resolve connection collisions if two BGP peers Simultaneously try to open connection.
  • 31.
    BGP Session Estblishment •Connect.req SYN(179) SYN +ACK CONNECT.conf TCP session established DATA.req(OPEN) DATA(BGPopen) DATA.req TCP session Established DATA(BGPopen) ACK(179) ACK ACK DATA.req(OPEN) BGP Session Established BGP Session Established Connect.ind Connect.resp DATA.req(open)
  • 32.
    eBGP and iBGP •eBGP • BGP running between two different ASs • iBGP • BGP running within the same AS • An AS has multiple BGP speakers • Distribute routing info among BGP routers • Minor but important difference with eBGP
  • 33.
    Why Choose ExternalBGP (E-BGP) • Link state or distance vector? • No universal metric – policy decisions • Problems with distance-vector: • Bellman-Ford algorithm may not converge • Problems with link state: • Metric used by routers not the same – loops • LS database too large – entire Internet • May expose policies to other AS’s
  • 34.
    Solution: DistanceVector withPath • Each routing update carries the entire path • Loops are detected as follows: • WhenAS gets route check if AS already in path • If yes, reject route • If no, add self and (possibly) advertise route further • Advantage: • Metrics are local - AS chooses path, protocol ensures no loops
  • 35.
    Interconnecting BGP Peers •BGP usesTCP to connect peers • Advantages: • Simplifies BGP • No need for periodic refresh - routes are valid until withdrawn, or the connection is lost • Incremental updates • Disadvantages • Congestion control on a routing protocol? • Poor interaction during high load
  • 36.
    Policy with BGP •BGP provides capability for enforcing various policies • Policies are not part of BGP: they are provided to BGP as configuration information • BGP enforces policies by choosing paths from multiple alternatives and controlling advertisement to otherAS’s
  • 37.
    Examples of BGPPolicies • A multi-homed AS refuses to act as transit • Limit path advertisement • A multi-homed AS can become transit for someAS’s • Only advertise paths to some AS’s • An AS can favor or disfavor certain AS’s for traffic transit from itself
  • 38.
    BGP Messages • Open •AnnouncesAS ID • Determines hold timer – interval between keep_alive or update messages, zero interval implies no keep_alive • Keep_alive • Sent periodically (but before hold timer expires) to peers to ensure connectivity. • Sent in place of an UPDATE message • Notification • Used for error notification • TCP connection is closed immediately after notification
  • 39.
    BGP UPDATE Message •List of withdrawn routes • Network layer reachability information • List of reachable prefixes • Path attributes • Origin • Path • Metrics • All prefixes advertised in message have same path attributes
  • 40.
    Path Selection Criteria •Information based on path attributes • Attributes + external (policy) information • Examples: • Hop count • Policy considerations • Preference forAS • Presence or absence of certain AS • Path origin • Link dynamics
  • 41.
    Internal BGP (I-BGP) •Same messages as E-BGP • Different rules about re-advertising prefixes: • Prefix learned from E-BGP can be advertised to I-BGP neighbor and vice-versa, but • Prefix learned from one I-BGP neighbor cannot be advertised to another I-BGP neighbor • Reason: noAS PATH within the same AS and thus danger of looping.
  • 42.
    Lecture #13: 02-24-04 InternalBGP (I-BGP) R3 R4 R1 R2 E-BGP I-BGP •R3 can tell R1 and R2 prefixes from R4 •R3 can tell R4 prefixes from R1 and R2 •R3 cannot tell R2 prefixes from R1 R2 can only find these prefixes through a direct connection to R1 Result: I-BGP routers must be fully connected (via TCP)! •contrast with E-BGP sessions that map to physical links AS1 AS2