Week12.1 Final
Week12.1 Final
Computer Networks
1
Please Complete Course evaluations
• https://sucourse.sabanciuniv.edu/mynotif-
tool/goToEvaluationDashboard.jsp
• https://tinyurl.com/SUCS408
2
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
—It is an optimization problem. Decisions are based on some least cost
criteria
—May depend on the current conditions
Routing
• End systems and routers maintain routing tables
—Indicate next router to which datagram should be sent
• Static
—Tables do not change but may contain alternative routes
• Dynamic
—If needed, the tables are dynamically updated
—Flexible response to congestion and errors
—status reports issued by neighbours about down routers
Router Packet Forwarding Decision
What happens when the router receives the frame from the host device?
IP Router Routing Table
network of routers
physical
network network
link link
physical physical
congested” enterprise
network
network
link
physical
Link Costs
• Cost of each hop in each direction is called routing metric
• Normal
— Default metric assigned by administrators
— Typically 1 for minimum hop routing
• Monetary cost
• Reliability
— E.g. based on recent history of outages
• Throughput
• Delay
— Based on propagation and queueing delays for each interface of the routers
• Administrative preference of the route
Sample Configuration of Routers and Networks
(Fixed routing)
used in another
—More information exchange improves the quality of routing enterprise
network
decisions, but also increases overhead
• May react too fast (like in highway)
—causing congestion through oscillation (fluttering)
• May react too slow
—By the time routing decision changes, the network
conditions may be much more different
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
21
Interior Routing Protocol (IRP)
Exterior Routing Protocol (ERP)
N: set of routers = { u, v, w, x, y, z }
E: set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
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 is
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
Dijkstra’s link-state routing algorithm
centralized: network topology, link notation
costs known to all nodes cx,y: direct link cost from
• accomplished via “link state broadcast” node x to y; = ∞ if not
• all nodes have same info direct neighbors
computes least cost paths from one D(v): current estimate of
node (“source”) to all other nodes cost of least-cost-path from
source to destination v
• gives forwarding table for that node
p(v): predecessor node
iterative: after k iterations, know along path from source to v
least cost path to k destinations N': set of nodes whose
least-cost-path definitively
known
Node Shortest Previous
Distance Node
Example A
B
-
∞
C ∞
D ∞
B 6 ∞
E 9 E
2
F ∞
Visited Nodes:
A 5 1
3 C Unvisited Nodes: A B C D E F
8
3
D 2 F
32
Node Shortest Previous
Distance Node
Example A -
B 2 A
C 12 F
B 6 D 7 B
E 9
2 E 8 B
F 9 D
A 5 1
3 C
8
3
D 2 F
From A to C: A B D F C = 12
33
Dijkstra’s algorithm
Each router
applies
Dijkstra
algorithm on
this graph to
find out
minimum
path to each
destination
network
Example: The Spanning Tree for Router R6
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
• In summary, Dijkstra's algorithm is commonly used in link-state routing protocols, while the
Bellman-Ford algorithm is utilized in distance-vector routing protocols. Both algorithms
serve the purpose of finding the shortest paths in IP routing, mostly Dijkstra's algorithm is
used in routers.
RIP (Routing Information Protocol)
• Uses Distance Vector Routing approach
— Each node exchanges information with neighbors
— Neighbor = Directly connected via same network
• Each node maintains three vectors
— Link cost
• One entry for each network it attaches
Routing table