Week11.2 Final
Week11.2 Final
Computer Networks
1
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 protocols mobile network
national or global ISP
Routing protocol goal: determine
“good” paths (routes), from sending application
transport
hosts to receiving host, through network
link
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
https://stat.ulakbim
.gov.tr/ulaknet/
5
A Sample Configuration of Routers and
Networks
• Link costs are at the output of the
links
• Two principles:
• 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 each device!)
— Not for each destination host
— Once datagram reaches router attached to destination network, that router can deliver to
host
• Each entry shows next node (router) on the route to destination
— Not whole route
• Routing tables may also exist in hosts (e.g. On PC check with: route print)
— 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 default gateway)
8
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)
• Mostly manual
• No dynamic updates
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
datacenter
network
enterprise
network
Autonomous Systems (AS)
• An important concept for TCP/IP routing in IP layer
17
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
Example
Node Shortest Previous
Distance Node
B 6
E 9 A -
2
B ∞
C ∞
A 5 1
3 C D ∞
E ∞
8
3 F ∞
D 2 F
Visited Nodes:
Unvisited Nodes: A B C D E F
28
Example
Node Shortest Previous
Distance Node
B 6
E 9 A -
2
B 2 A
C 12 F
A 5 1
3 C D 7 B
E 8 B
8
3 F 9 D
D 2 F
Visited Nodes:
Unvisited Nodes: A B C D E F
29
Dijkstra’s algorithm
• 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
Each router
applies
Dijkstra
algorithm on
this graph to
find out
minimum
path to each
destination
network
Example: The Spanning Tree for Router R6
Application of Exterior and Interior Routing
Protocols
Border Gateway Protocol (BGP)
• For use with TCP/IP internets
• Preferred ERP of the Internet
• Allows routers (gateways) in different Autonomous Systems to
exchange routing information
• Current version is BGP-4
—RFC 4271
• No time to cover
—See the book for details (in Chapter 12)
—Not responsible
47