15 Ip Routing
15 Ip Routing
IP Routing
CS455/CS555/EE407/EE507
Fall 2024
Pat Wilbur
[email protected]
Routing
IP routing: selection of paths (routes) between source and destination,
where routers along the path should send each IP packet one step closer to
its intended destination
How?
➢ Hierarchical routing of some sort (typical)
➢ Can be static routing (pre-configured routes) or dynamic routing (routers
communicate amongst themselves to determine good routes to
destination)
➢ Host routing table via local interfaces → Local Area Networks (LANs)
routers use routing algorithms → Internet uses routing algorithms → ...
*
Routing on various types of nodes
Hosts:
➢ Each host has a routing table within its OS mapping CIDR IP address
(possible destination address) ranges to specific network interfaces
➢ Hosts typically have a default route (for all other destination ranges) via
a router on the same network, often auto configured via DHCP protocol
Intranetwork/intra-AS routers: Use protocols and algorithms that work well
for “smaller” networks (LANs) when routing packets between nodes on, e.g.,
different subnets but within the same network or administrative “domain”
Internetwork/inter-AS routers: Use protocols/algos suitable for Internet
AS = Autonomous System = a network with its own admin and IP allocation (e.g. ISP, large company)
ASN = Autonomous System Number = ID for each net w/ own IP allocation, used for Internet routing
*
Routing on various types of nodes
Hosts:
➢ Each host has a routing table within its OS mapping CIDR IP address
(possible destination address) ranges to specific network interfaces
➢ Hosts typically have a default route (for all other destination ranges) via
a router on the same network, often auto configured via DHCP protocol
Intranetwork/intra-AS routers: Use protocols and algorithms that work well
for “smaller” networks (LANs) when routing packets between nodes on, e.g.,
different subnets but within the same network or administrative “domain”
Internetwork/inter-AS routers: Use protocols/algos suitable for Internet
AS = Autonomous System = a network with its own admin and IP allocation (e.g. ISP, large company)
ASN = Autonomous System Number = ID for each net w/ own IP allocation, used for Internet routing
*
Routing on various types of nodes
Hosts:
➢ Each host has a routing table within its OS mapping CIDR IP address
(possible destination address) ranges to specific network interfaces
➢ Hosts typically have a default route (for all other destination ranges) via
a router on the same network, often auto configured via DHCP protocol
Intranetwork/intra-AS routers: Use protocols and algorithms that work well
for “smaller” networks (LANs) when routing packets between nodes on, e.g.,
different subnets but within the same network or administrative “domain”
Internetwork/inter-AS routers: Use protocols/algos suitable for Internet
AS = Autonomous System = a network with its own admin and IP allocation (e.g. ISP, large company)
ASN = Autonomous System Number = ID for each net w/ own IP allocation, used for Internet routing
*
Static routing
Pre-configured (manually-configured) route(s), might be only one route for a
specific destination or specific CIDR IP address range, multirouting possible
Appropriate in some circumstances, and most commonly used on routing
tables within specific hosts and their OSes
Drawback is that it does not automatically accommodate network/Internet
changing conditions:
➢ No load balancing
➢ No changes due to links/paths going down (becoming unusable)
➢ No changes due to link/path performance changes
Host route table?
You can view your host’s (operating system’s) routing table to see which
network interface a packet with a particular IP address will exit the host
On Linux:
either route
or ip route
Route info beyond a host?
You can view the intra-AS and inter-AS routers beyond your host that are
along a path from your source host to a destination host (assuming routers
are configured to respond to the relevant ICMP request types)
On Linux:
either traceroute
or tracepath
Dynamic routing
Most commonly used by routers, especially inter-AS routers (those on the
Internet)
Nodes (typically routers) exchange information via a routing protocol with
one another to learn about routes (paths) to various destinations, use an
algorithm for route selection (algorithms borrowed from graph theory)
Routes and their individual preference change based upon real-world
changes in “costs” like:
➢ Latency, throughput, packet loss
➢ Congestion level
➢ $
*
Dynamic: global vs. decentralized
Dynamic algorithms can be one of two styles: either global or decentralized
Global dynamic routing algorithms:
➢ All routers have complete network topology (i.e. graph or map), and
have complete link cost information (and receive updates about all link
cost changes)
➢ “link-state” algorithms (a.k.a. “shortest path first” algorithms)
Decentralized dynamic routing algorithms:
➢ Router knows physically-connected neighbors, link costs to neighbors
➢ Iterative process of computing route decisions, share info with neighbors
➢ “distance-vector” algorithms (e.g. Bellman-Ford algorithm)
*
Dynamic: global vs. decentralized
Dynamic algorithms can be one of two styles: either global or decentralized
Global dynamic routing algorithms: ← work best for “smaller” intra-AS networks like LANs
➢ All routers have complete network topology (i.e. graph or map), and
have complete link cost information (and receive updates about all link
cost changes)
➢ “link-state” algorithms (a.k.a. “shortest path first” algorithms)
Decentralized dynamic routing algorithms: ← Internet (inter-AS) is too big for every node
to know entire topology & every link’s cost
➢ Router knows physically-connected neighbors, link costs to neighbors
➢ Iterative process of computing route decisions, share info with neighbors
➢ “distance-vector” algorithms (e.g. Bellman-Ford algorithm)
*
Idealized routing problem: graphs
Routing protocols & algorithms 5
Goal: determine “good” path (sequence
B 3 C
of routers) through network(s) from 2 5
source to destination A
2 1 F
3
1 2
D E
1
Graph abstraction for routing algorithms:
Graph nodes are routers
Graph edges are physical links
“Good” path typically means minimum cost path
*
Link-state algorithm example
Dijkstra’s algorithm can be used to compute shortest paths in L-S algos
Complete network topology w/ “states” (costs) for all links known to all nodes
Link “states” (costs) are kept up-to-date via a process known as “reliable
flooding” (the act of propagating cost updates throughout network)
In theory, all nodes have same info
Based on info from all other nodes, each node individually computes least-
cost paths from itself (“source”) to all other nodes → becomes routing table
Iterative: after k iterations, know least-cost path to k destinations
*
Link-state “reliable flooding”
Link “states” (costs) are kept up-to-date via a process known as “reliable flooding” (the act
of propagating link cost updates throughout network) so that all nodes know not only the
topology of the network, but also the current link costs even as they change.
Source
Link-state “reliable flooding”
Link “states” (costs) are kept up-to-date via a process known as “reliable flooding” (the act
of propagating link cost updates throughout network) so that all nodes know not only the
topology of the network, but also the current link costs even as they change.
Source
Link-state “reliable flooding”
Link “states” (costs) are kept up-to-date via a process known as “reliable flooding” (the act
of propagating link cost updates throughout network) so that all nodes know not only the
topology of the network, but also the current link costs even as they change.
Source
Link-state “reliable flooding”
Link “states” (costs) are kept up-to-date via a process known as “reliable flooding” (the act
of propagating link cost updates throughout network) so that all nodes know not only the
topology of the network, but also the current link costs even as they change.
Source
Link-state algorithm problems
Complexity is O(n2)
➢ n nodes
➢ each iteration: find next w Cost(w) is a minimum; then, for that w, check
its best path to other nodes
➢ n*(n+1)/2 comparisons = O(n2)
More efficient implementations possible using a heap: O(n*log(n))
Route table represents entire network and all paths: huge!
As a result, link-state approach is best-suited for “smaller” intra-AS networks
*
Distance-vector algorithms
Distributed: each node communicates only with directly-attached neighbors
Iterative: continues until no more nodes exchange information
Asynchronous:
➢ Each local iteration caused by:
•
local link cost change
•
message from neighbor (its least-cost path to a destination changed)
➢ Each node notifies neighbors only when its least-cost path to any
destination changes, neighbors then notify their neighbors if necessary
Distance-vector algos can be used for inter-AS (internet) or intra-AS routing
*
Distance-vector example
Example network where we assume costs for each link are all 1 (e.g. perhaps 1 ms of latency, or perhaps a distance of
1 hop). Global view of initial distances (Table 16) is for illustrative purposes only (a global view would not be known by
each node in a distance-vector algorithm, unlike with link-state algorithms). Each host would have its own routing table
intially populated with just the path costs of its neighbors at the start. ...
Source
Distance-vector example
… The initial routing table of Node A (Table 17) will show the cost to each of its neighbors, but will set an initial cost of
infinity (i.e. indeterminate) for each node to which it is not directly connected, because (at this point) initially Node A
doesn’t yet know the costs or if a path to those other nodes even exists on the network. ...
Source
Distance-vector example
… The particular algorithm implementation will then have each node advertise their minimum path costs to reaching all
nodes they know about, either periodically and/or upon path cost changes; each node will maintain a routing table
including minimum path costs of either all other nodes they know about, or just “interesting” ones that have recently
been asked about and are being cached (depending upon the implementation). ...
Source
Distance-vector example
… Eventually, Node A will learn the minimum path costs of all nodes with which it might be “interested” in
communicating (Table 18). An illustrative global view of final routing costs between every pair of nodes is in Table 19. ...
Source
Distance-vector example
… What happens if the link between F and G goes down and becomes unusable? In that case, Node F would start
advertising a path-to-G cost change of infinity (and Node G would start advertising a path-to-F cost change to infinity to
its neighbors). From Node A’s perspective, Node A would first update route table to reflect an infinite path-to-G cost (due
to Node F’s path-to-G cost update advertisement), ...
Source
Distance-vector example
… but Node A would later update its route table to reflect a new (minimum) path-to-G cost of 3 with a new Next Hop via
Node C (instead of via Node F) when Node C advertises its (minimum) path-to-G cost of 2 (3=2+1). This is a good
outcome, and we would call this state of the network as the network having once-again reached convergence of the
truth (a.k.a. reached stability). What about if the path from A to E goes down instead? ...
Source
Distance-vector example
… If the path from A to E went down and became unusable, there would be no paths to E from any other node on the
network, so the correct outcome would be for every node to update its route table with a (minimum) path-to-E cost of
infinity; however, for a brief moment in time, Node C might still think its (minimum) path-to-E cost is still 2 (via A), prior to
receiving A’s updated path-to-E cost of infinity. ...
Source
Distance-vector example
… This presents a possible race condition, which is actually a highly probable race condition (due to the nature of
latency across multiple hops, plus possible loops in the network); so, what can actually happen is C might still advertise
a (minimum) path-to-E cost of 2, causing B to select C as the NextHop for its path-to-E (since C’s advertised path-to-E
cost of 2 is less than A’s path-to-E cost of infinity), ...
Source
Distance-vector example
… and then A would select B as the new NextHop for its path-to-E with a new minimum cost of 4 (because B’s
advertised path-to-E cost of 3 would be less than A’s last path-to-E cost of infinity). A would advertise this new minimum
cost of 4, which would cause C (whose path-to-E NextHop is via A) to now believe A has a path to E with this new
minimum cost of 4 and C would overwrite its route table path-to-E entry with a minimum cost of 5 (4+1). ...
Source
Distance-vector example
… This cycle would continue forever as each node continues counting higher and higher around this loop; and, similar
ever-increasing counting would happen on other nodes and loops on the network. This failure mode is known as the
count-to-infinity problem. To fix, implementations need to include origin/triggering “sender” node ID in each path cost
advertisement, and nodes ignore propagated updates advertised to them that were actually triggered by themselves.
Source
Comparison of L-S and D-V algos
Message complexity:
➢ L-S: nodes send info on direct connections to all nodes, more/smaller msgs
➢ D-V: nodes send info on best paths for every destination to its neighbors, fewer/larger msgs
Speed of convergence:
➢ L-S: O(n2) algorithm
➢ D-V: convergence time varies, routing loops & count-to-infinity problems need solutions
Robustness: what happens if a router malfunctions and advertises incorrect information
➢ L-S: node can advertise incorrect link cost, each node computes only its own route table
➢ D-V: node can advertise incorrect path cost, each node’s table used by other nodes, errors
propagate through network
*
References & attribution:
Original slides by Patrick F. Wilbur, 2024.
Other slides adapted from slides by Professor Yu Liu and Professor Jeanna Matthews.
In this file, slides marked * are heavily adapted or taken from slides by Professor Yu Liu and Professor Matthews.