Computer Networks Protocols
Lecture No.3: Network Layer Part 1
Routing Concept
ROUTING is forwarding of packets from one network to another network choosing the best path
from the routing table.
Routing tableconsist of only the best routes for every destinations.
Types of Routing:
It is configure by Administrator manually
Need for destination network ID
Static It is secure and fast
Used for small organization which have network of 10-15 routers
Means automatically routing
Dynamic routes means that the router learns of paths of destinations by
Dynamic receiving periodic updates from other routers
Is automatically choose the best shortest path
Can be done by using routing protocol
Is configured for unknown destination
When there is no entry for the destination network in a routing table, the
Default router will forward the packet to its default router.
It is last preferred routing
Q/ list the Advantages of dynamic over static?
o There is no need to know the destination networks
o Updates the topology changes dynamically
o Administrative work reduced
o Used for large organizations
Routing Algorithm
Routing Algorithms
The main function of the network layer is routing packets from source to destination.
The routing algorithm is that part of the network layer software responsible for deciding
which output line an incoming packet should be transmitted on.
Routing algorithms can be grouped into two major classes: non adaptive and adaptive.
Non adaptive algorithms (static routing) Adaptive algorithms (dynamic routing)
Do not base their routing decisions Change their routing decisions to
on measurements or estimates of the reflect changes in the topology , and
current traffic and topology. usually the traffic as well.
It is called static algorithm. It is called dynamic.
Static Algorithm
1. Flooding routing.
[Link] path routing.
A simple local technique, where each router must make decisions
based on local knowledge, not the complete picture of the network.
is a simple algorithm to send a packet along all paths( Every
incoming packet is sent out on every outgoing line except the one
it arrived on).
Flooding generates infinite number of duplicate packets unless some
measures are taken to damp the process.
One such measure is to have a hop counter in the header of each
packet, which is decremented at each hop, with the packet being
discarded when the counter reaches zero.
Shortest path routing first developed by Dijkstraalgorithm.
Find the shortest path from a specified source to all other
destinations in the network.
Shortest Path Routing
In the general case, the labels on the lines could be computed as a
function of the distance, bandwidth, average traffic,
communication cost, measured delay, and other factors.
Q/ Find the shortest path from router A to router H?
Dynamic Routing Algorithm
1. Distance Vector Routing.
2. Link state routing.
1. Distance Vector Routing.
Distance Vector routing is intra-domain protocols, inside Autonomous system, but not
between Autonomous system.
distance-vector routing are based on the least-cost goal.
Distance Vector developed by Bellman-Ford algorithm.
Bellman equation is used to find the least cost (shortest distance) between a source to
destination.
A distance vector routing algorithm operates by having each router maintain a table (i.e., a
vector) giving the best known distance to each destination.
These tables are updated by exchanging information with the neighbors router. Every router
knows the best link to reach each destination.
RIP based on distance vector routing, each router shares, at regular intervals, its knowledge
about entire AS with its neighbor.
It is so slow and does not take Bandwidth into consideration when choose the root.
Q/Update the Router A using Distance vector algorithm?
2. Link State Routing
The primary problem in distance vector that the algorithm often took too long to converge after the
network topology changed (due to the count-to-infinity problem). Consequently, it was replaced by a
new algorithm, now called link state routing.
The idea behind link state routing is simple and can be stated as five parts. Each router must:
1) Discover its neighbors and learn their network addresses.
2) Measure the delay or cost to each of its neighbors.
3) Construct a packet telling to all it has just learned.
4) Send the packet to all other routers.
5) Compute the shortest path to every other router.
Compared to distance vector routing, link state routing requires more memory and computation.
Also, the computation time grows faster
Nevertheless, in many practical situations, link state routing works well because it does not suffer
from slow convergence problems.
Q/Consider the following network, define OSPF protocol & construct shortest
path tree using dijkstra algorithms :
Q/Consider the following network, define OSPF protocol & construct shortest
path tree using dijkstra algorithms :
Dijkstra’s algorithm: example
D(v) D(w) D(x) D(y) D(z)
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
4 uwxvy 12,y
5 uwxvyz x
9
notes: 5 7
construct shortest path tree by 4
tracing predecessor nodes 8
ties can exist (can be broken u 3 w y z
arbitrarily) 2
3
7 4
v
Network Layer 4-81
Hierarchical Routing
As networks grow in size, the router routing tables grow proportionally.
Not only is router memory consumed by ever-increasing tables, but more CPU time is needed
to scan them and more bandwidth is needed to send status reports about them.
So router can not have table about the entire network.
When hierarchical routing is used, the routers are divided into what we will call regions.
Each router knows all the details about how to route packets to destinations within its own
region but knows nothing about the internal structure of other regions.
Broadcast Routing
For some applications ,hosts need to send messages to many or all other hosts. Broadcast
routing is used for that purpose.
The source should send the packet to all the necessary destinations. One of the problems of
this method is that the source has to have the complete list of destinations.
We have already seen a better broadcast routing technique: flooding.
Multicast Routing
Sending a message to such a group is called multicasting, and the routing algorithm used is
called multicast routing.
All multicasting schemes require some way to create and destroy groups and to identify
which routers are members of group.
Network service model
Q:What service model for “channel” transporting datagrams from sender to receiver?
individual datagrams flow of datagrams
guaranteed delivery in-order datagram delivery
guaranteed delivery with less than 40 msec delay guaranteed minimum bandwidth to flow.
Q/ Datagram or VC network: why?
Internet (datagram) ATM (VC) virtual circuit
data exchange among computers evolved from telephony
–“elastic” service, no strict timing req
human conversation:
many link types
–strict timing, reliability requirements
–different characteristics –need for guaranteed service
–uniform service difficult
“dumb” end systems
“smart” end systems (computers)
–telephones
–can adapt, perform control, error –complexity inside network
recovery
–simple inside network, complexity
at “edge”