0% found this document useful (0 votes)
30 views47 pages

Lecture 17 (Dijkstra)

Uploaded by

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

Lecture 17 (Dijkstra)

Uploaded by

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

Network Layer Delivery,Forwarding and Routing

Lecture-17

Computer Communication Networking


(University of central Punjab)
Lecture Topics
 Introduction, the Network Layer

 What is routing

 Internet and autonomous systems

 Types of routing algorithms and routing methods

 Static - Shortest Path Routing


Introduction – The Network Layer

 Network layer is concerned with getting packets from


the source to destination

 Network layer must know the topology of the subnet, it must take care to
choose routes to avoid overloading
Network layer – Connectionless Services

 Connectionless services – datagram subnet

 Datagram subnet – Router maintains table of entries

 Entries - pair consisting of a destination and directly connected outgoing line to


use for that destination

 Router can route packets on any route in datagram subnet


Network layer – Connection oriented services
 Connection oriented services, Virtual circuit (VC) subnet

 VC subnet avoids choosing new routes for every packet but use the
same route stored in router tables

 VC is only there for the session and is terminated at the end of


connection

 Packets are routed based on VC identifiers


Functions of Network layer
application
transport
network
 Transfer segment from sending to receiving host data link network
physical data link
network network
data link physical data link
physical physical
 On sending side encapsulates segments into datagrams network
data link
physical network
data link
 On physical
receiver side, delivers segments to transport layer
network
network data link
data link physical
physical
 Network layer protocols in every host, router network
data link application
physical transport
network
 Router examines header fields in all IP datagrams passing through it data link
physical
Key Network-Layer Functions
Analogy:
 Forwarding

 Move packets from router’s input to


• Routing: Process of planning
 appropriate router output
trip from source to
destination
 Routing

 Routing algorithms • Forwarding: Process of


 Determine route taken by packets getting through single
from source to destination interchange
Network Layer Connection and Connection-Less
Services
 3rd important function
 Connection Less Network Service
 Datagram Network

 Connection Oriented Network Service


 Virtual Circuit Network

 Datagram Network provides network-layer connectionless service

 VC Network provides network-layer connection service


( Source: Tannenbaum Book )
Virtual Circuits
“Source-to-Destination Path behaves much like telephone circuit”
• Performance-wise
• Network actions along Source-to-Destination path

 Call Setup, Teardown for each call before data can flow
 Each Packet carries VC identifier (not destination host address)
 Every router on source-destination path maintains “state” for each passing
connection
 Link, Router Resources (bandwidth, buffers) may be allocated to VC
Virtual Circuits (Signaling Protocols)

 Used to setup, maintain teardown VC


 Used in ATM, frame-relay, X.25
 Not used in today’s Internet
Datagram Networks

 No call setup at network layer


 Routers: no state about end-to-end connections
 no network-level concept of “connection”
 Packets forwarded using destination host address
 Packets between same source-destination pair may take different paths
What is Routing?

 Routing is all about network layer design

 The algorithms that manages the routing tables and makes routing decisions is
called routing algorithm

 Routing algorithm is the main topic of interest in network layer design (more
about routing will follow on coming slides)
Routing….. 5
3
 “good” path: B C 5
2
 typically means minimum cost path A 2
3
1 F
 link “cost” : 1 2
D E
 Weight on a graph edge reflect “cost” of traversing the “link” 1

 Can based on different performance criteria


 E.g.,

 delay,
NOTE:
 £, cost,
Resulting shortest path
 Hop count (weight = 1)
may not have fewest hops.
 Throughput (utilization)
 or congestion level
Types of Routing Algorithms

 Non-adaptive routing algorithms (a.k.a. static routing algorithms). Choice of


route is computed in advance, offline and downloaded to the routers during
the network boot

 Adaptive-routing algorithms (a.k.a. dynamic routing algorithms). Routing


decisions can be changed to reflect changes in topology and traffic load
Routing Methods

 Next-Hop Routing
 The routing table holds only the address of the next hop instead of holding info
about the complete route.
 A technique to reduce the routing table

 Network-Specific Routing
 Insteadof having an entry for every host connected to the same physical
network, only one entry is used to give the network address.
 Another way to reducing the routing table.
Routing Methods…..

 Host-Specific Routing
 The destination host address is given in the routing table.
 Useful when the administrator wants to have more control over the routing to a
particular host.
 Default Routing
 A routing method in which a router is assigned to receive all packets with no
match in the routing table.
Next-Hop Routing

( Source: TCP/IP Protocol Suite, by Forouzan )


Network-Specific Routing

( Source: TCP/IP Protocol Suite, by Forouzan )


Host-Specific
Routing
( Source: TCP/IP
Protocol Suite,
by Forouzan )
Default Routing

( Source: TCP/IP Protocol


Suite, by Forouzan )
Some Static and Dynamic routing algorithms

 Non-adaptive / Static routing algorithms


 Shortestpath routing
 Flooding
 Dynamic / Adaptive routing algorithms
 Distance Vector Routing
 Link State Routing
Pre-requisite - Terms and definitions
 Shortest Path
 thepath with the least cost if there are multiple paths available between two
routers.
 Path (Link) Cost
 the cost of transmitting a packet over a path (link),
 canbe manually configured, or can be based on various parameters (i.e.,
metrics) such as the bandwidth availability or congestion.
 adjusting the cost influences the results produced by routing algorithms.
Pre-requisite - Terms and definitions …..

 Routing Metric
 Used to decide the cost value associated with each link,
 can be based on a number of functions – bandwidth, distance etc.,
 Capacity, Delay, Expense and Error Rate are examples of routing metrics.

 Hops
 Every time a packet is received by a router (on the route to the destination), this is known as a
hop
 Hop Count
 the total number of hops a packet needs to make before arriving at its destination.
Pre-requisite - Terms and definitions …..

 Optimality Principle
 R1  R2  R3
 If router R2 is on the optimal path from router R1 to router R3, the optimal path
from R2 to R3 also falls along the same route.
 Next Hop Routing
 Given the Optimality principle, a router need only know the next router to
transmit to, and need not necessarily have a global view of the network
Shortest Path Routing

 Subnet represented by a graph, each node of the graph represents


router and each arc of graph represents a communication link
 Shortest path between two nodes of the graph can be computed by
several algorithms (e.g.Dijkstra)
 Path length (shortest path) can be computed as a function of,
 Numberof hops, Geographic distance, Bandwidth, mean queue length,
measured delay etc
Static Routing--Review

 Manually performed by the network administrator. The administrator is


responsible for discovering and propagating routes through the network

 A device once configured, simply forwards packets out the predetermined


ports. There is no communication between routers regarding the current
topology of the network
Static Routing….
 Advantages:
 Manual definition of a default route
 Definition of route not automatically advertised
 To provide more secure network environment

 Disadvantages:
 Static routes require considerable amount of coordination and maintenance in
non-trivial network environments
 Static routes can not dynamically adapt to the current operational state of
network
Dijkstra Algorithm

 network topology, link costs known to all nodes


 accomplished via “link state broadcast”
 all nodes have same info
 calculates least cost paths from one node (‘source”) to all other nodes
 produces routing table for that node
 iterative: after k iterations, know least cost path to k destinations
Dijsktra Algorithm…..
Notation:
 c(i,j):

link cost from node i to j. cost infinite if not direct neighbors


 D(v):

current value of cost of path from source to destination v


 p(v):

predecessor node along path from source to v


 N:

set of nodes whose least cost paths have become known


Dijsktra Algorithm…..
1 Initialization:
2 N = {A}
3 for all nodes v
4 if v adjacent to A
5 then D(v) = c(A,v)
6 else D(v) = infinity
7
8 Loop
Assuming A is a source node,
9 find w not in N such that D(w) is a minimum
10 add w to N
11 update D(v) for all v adjacent to w and not in N:
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N
Dijsktra Algorithm…..

3
B C
2 5

A 2 1 F
3
1
2
D E
1
Dijkstra’s Algorithm: an example
Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F)
0 A 2,A 5,A 1,A infinity infinity
1 AD 2,A 4,D 2,D infinity
2 ADE 2,A 3,E 4,E
3 ADEB 3,E 4,E
4 ADEBC 4,E
5 ADEBCF

5
3
B C 5
2
A 2 1 F
3
1 2
D E
1
Distance Vector Routing
 Itallows each device in the network to automatically build and maintain a local
IP routing table
 Eachrouter in the internetwork maintains a distance or cost from itself to every
known destination, this value represents the overall desirability of the path
 The path represented by the smallest cost becomes the preferred path to reach
destination.
 The information is maintained in a distance vector table, which is periodically
advertised to each neighbouring router
Distance Vector Routing…..
 When a node is first turned on, it constructs its initial distance table (see below
for how to construct) and then transmits the table to its neighbours.
 On receipt of a packet containing the distance table from a neighbour, a node
compares the entries in this table with their own. If an entry contains a lower
cost, it adds the new entry to its table.
 In this way, the entries are updated and created across the network.
 Thisrouting algorithm is known with these names: Bellman-Ford, Ford-
Fulkerson
Distance Vector Routing…..
Distance Table data structure:
 Each node has its own distance table
 Each row for each possible destination
 Each column for each directly-attached neighbor to node
 example: in node X, for destination Y via neighbor Z

distance from X to
X = Y, via Z as next hop
D (Y,Z)
Z
= c(X,Z) + minw{D (Y,w)}
Link State Routing

 Algorithms use principle of link state to determine network topology

 A linkstate is the description of an interface on a router (e.g. IP address, subnet


mask) and its relationship to the neighbouring routers

 The collection of these link states forms a link state database


Link State Routing, determining network topology

 Each router identifies all other routing devices on the directly connected
networks

 Each router advertises a list of all directly connected network links and
associated cost of each link through exchange of link state advertisements
(LSAs)

 Using LSAs, each router creates a database detailing the current topology
Link State Routing….
Link State Routing….
Link State Routing….

( After R1 receives the link state info from R2 )


Link State Routing….
Link State Routing….
Link State Routing….
Link State Routing….
Path Vector Routing
 Path vector somewhat similar to the distance vector algorithm

 Networks are advertised as destination addresses and path descriptions to reach


those destinations

 The name path vector routing –because a route is defined as a pairing between a
destination and the attributes of the path to that destination (routers receive a
vector that contains paths to a set of destinations)
Recommended Reading

1. Chapters 6 and 13 of Forouzan’s Book (Behrouz A. Forouzan, TCP/IP Protocol Suite, 2/e,
McGraw Hall).
2. Sections 5.2 (5.2.1-5.2.7) and 5.6 (5.6.4-5.6.5) of Tanenbaum’s Book (Andrew S.
Tanenbaum, Computer Networks, 4/e, Prentice Hall, 2003, ISBN 0-13-038488-7)
3. Sections 4.2, 4.3 and 4.5 of Kurose’s Book (James F. Kurose, Keith W. Ross, Computer
Networking, 2/e, Addison-Wesley, ISBN 0-201-97699-4).
4. Sections 9.4, 10.2, 16.1 and Apendix 10A of Stallings’ book (William Stallings, Data &
Computer Communications, 6/e, Prentice Hall, 2000. ISBN: 0-13-084370-9).
5. Chapters 13 and 25 of Comer’s book (Douglas E. Comer, Computer Networks and
Internets with Internet Applications, 3/e, Prentice Hall, 2001, ISBN 0-13-091449-5).

You might also like