Lecture #5 THR

Download as pdf or txt
Download as pdf or txt
You are on page 1of 45

Computer Networks

Instructor: Fatima Shahzadi


[email protected]

Lecture # 05
Agenda

Network Layer
Routing v/s Routed Protocols
Data Packets –
The user data is transferred in the inter-network by these data packets.
Routed protocols are those protocols which support such data traffic.
Examples of routed protocols are IPv4, IPv6 and AppleTalk.
Route Update Packets –
The information about the networks connected to all the routers is updated
to the neighbouring routers through route update packets. Routing protocols
are the ones that are responsible for sending them. Examples of routing
protocols are RIP(Routing Information Protocol), EIGRP(Enhanced Interior
Gateway Routing Protocol) and OSPF(Open Shortest Path First).
IGP – Interior Gateway Protocol
EGP – Exterior Gateway Protocol
RIP – Routing Information Protocol
IGRP – Interior Gateway Routing Protocol
OSPF – Open Shortest Path First
ISIS – Intermediate System to Intermediate System
EIGRP – Enhanced Interior Gateway Routing Protocol
BGP – Border Gateway Protocol
Fixed and Flooding Routing algorithms
Desirable Properties of Routing Algorithms:-

Correctness and Simplicity


Robustness : Ability of the network to deliver packets via some route
even in the face of failures.
Stability : The algorithm should converge to equilibrium fast in the
face of changing conditions in the network.
Fairness and Optimality
Efficiency : Minimum overhead.

Fixed Routing
Flooding
Dynamic Routing
Random Routing
Flow-based Routing
Design Parameters of Routing Algorithms :

1. Performance Criteria : Number of hops, Cost(Send packet with high


bandwidth path as cost is less) , Delay(Size of Queue) , Throughput
time(Number of packets delivered/time).
2. Decision Time : When to decide to route a packet? Per-
Packet(Datagram) or Per-session(Virtual-Circuit).
3. Decision Place : Who will decide about routing? Each
Node(distributed), Central Node (centralized),Originated Node
(source)
4. Network Information Source: None , Local, Adjacent node, Nodes
along route , All nodes.
5. Network Information Update Time : Continuous, Periodic, Major
Load Change , Topology Change.
Fixed Routing
1. A route is selected for each source and destination pair of node in the network.
2. The route are fixed ; changes only if topology of the network changes.
3. Fixed Routing : Example (1)

Figure – A simple packet switching network with six nodes (routers)


Figure – Central routing table based on least cost path algorithm

A Central routing matrix is created based on the least-cost path which


is stored in the network control center
The matrix, shows for each source-destination of the route , the
identity of the next node on the route.
Drawback: If the network control center fails, then everything will
collapse. Hence it is not reliable.
Fixed Routing : Example (2)
Figure – Routing table stored in different nodes of the network
• Routing Table is created for each node. This is called as distributed
routing algorithm
• Routing table can be created using least-min path or min-hop reach
method. Two famous path algorithms
1. Dijkstra Algorithm
2. Bellman Ford Algorithm

Advantages –
Simple
Works well in reliable network with stable load in reliable network
Same for virtual circuit and datagram

Disadvantages –
Lack of flexibility
Doesn’t react to failure or network congestion
Flooding
Requires no network information like topology, load condition ,cost of diff. paths
Every incoming packet to a node is sent out on every outgoing like except the one it
arrived on.
For Example in above figure
A incoming packet to (1) is sent out to (2),(3)
from (2) is sent to (6),(4) and from (3) it is sent to (4),(5)
from (4) it is sent to (6),(5),(3) , from (6) it is sent to (2),(4),(5),from (5) it is sent to
(4),(3)
Characteristics –

All possible routes between Source and Destination is tried. A packet will always get
through if path exists
As all routes are tried, the will be at least one route which is the shortest
All nodes directly or indirectly connected are visited
Limitations
Flooding generates vast number of duplicate packets
Suitable damping mechanism must be used
Hop-Count –

• A hop counter may be contained in the packet header which is decremented at


each hop.
• with the packet being discarded when the counter becomes zero
• The sender intializes the hop counter . If no estimate is known, it is set to the
full diameter of the subnet.
• Keep track of the packets which are responsible for flooding using a sequence
number . Avoid sending them out a second time.
• Selective Flooding : Routers do not send every incoming packet out on every
line , only on those lines that go in approximately in the direction of destination.

Advantages of Flooding :

• Highly Robust, emergency or immediate messages can be sent (eg military


applications)
• Set up route in virtual circuit
• Flooding always chooses the shortest path
• Broadcast messages to all the nodes
Classes for Routing Protocols
1. Distance Vector Routing Protocol – These protocols selects best path in the basis
of hop counts to reach a destination network in the particular direction. Dynamic
protocol like RIP is an example of distance vector routing protocol. Hop count is each
router which occurs in between the source and the destination network. The path
with the least hop count will be chosen as the best path.

Features –
• Updates of network are exchanged periodically.
• Updates (routing information) is always broadcast.
• Full routing tables are sent in updates.
• Routers always trust on routing information received from neighbor routers. This
is also known as routing on rumors.

Disadvantages –
• As the routing information are exchanged periodically, unnecessary traffic is
generated which consumes available bandwidth.
• As full routing tables are exchanged, therefore it has security issues. If an un-
authorized person enters the network, then the whole topology will be very easy
to understand.
• Also broadcasting of network periodically creates unnecessary traffic.
2. Link State Routing Protocol – These protocols know more about the Internetwork than any
other distance vector routing protocol. These re also known as SPF (Shortest Path First)
protocol. OSPF is an example of link state routing protocol.

Features –
• Hello messages, also known as keep-alive messages are used for neighbor discovery and
recovery.
• Concept of triggered updates are used i.e updates are triggered only when there is a
topology change .
• Only that much updates are exchanged which is requested by the neighbor router.
• Link state routing protocol maintains three tables namely:

Neighbor table- the table which contains information about the neighbors of the router only,
i.e, to which adjacency has been formed.
Topology table- This table contains information about the whole topology i.e contains both
best and backup routes to particular advertised network.
Routing table- This table contains all the best routes to the advertised network.
Advantages –
• As it maintains separate tables for both best route and the backup routes ( whole topology)
therefore it has more knowledge of the inter network than any other distance vector
routing protocol.
• Concept of triggered updates are used therefore no more unnecessary bandwidth
consumption is seen like in distance vector routing protocol.
• Partial updates are triggered when there is a topology change, not a full update like
distance vector routing protocol where whole routing table is exchanged.
3. Advanced Distance vector routing protocol – It is also
known as hybrid routing protocol which uses the concept
of both distance vector and link state routing protocol.
Enhanced Interior Gateway Routing Protocol (EIGRP) is an
example of this class if routing protocol. EIGRP acts as a link
state routing protocol as it uses the concept of Hello
protocol for neighbor discovery and forming adjacency.
Also, partial updates are triggered when a change occurs.
EIGRP acts as distance vector routing protocol as it learned
routes from directly connected neighbors.
Types of Routing
1. Static routing –
Static routing is a process in which we have to manually add routes in
routing table.
Advantages –
• No routing overhead for router CPU which means a cheaper router
can be used to do routing.
• It adds security because only administrator can allow routing to
particular networks only.
• No bandwidth usage between routers.
Disadvantage –
• For a large network, it is a hectic task for administrator to manually
add each route for the network in the routing table on each router.
• The administrator should have good knowledge of the topology. If a
new administrator comes, then he has to manually add each route so
he should have very good knowledge of the routes of the topology.
2- Default Routing
This is the method where the router is configured to send
all packets towards a single router (next hop). It doesn’t
matter to which network the packet belongs, it is
forwarded out to router which is configured for default
routing. It is generally used with stub routers. A stub router
is a router which has only one route to reach all other
networks.
Dynamic routing
Dynamic routing makes automatic adjustment of the routes according to the current state of
the route in the routing table. Dynamic routing uses protocols to discover network
destinations and the routes to reach it. RIP and OSPF are the best examples of dynamic
routing protocol. Automatic adjustment will be made to reach the network destination if
one route goes down.

A dynamic protocol have following features:

1. The routers should have the same dynamic protocol running in order to exchange
routes.
2. When a router finds a change in the topology then router advertises it to all other
routers.
Advantages –
• Easy to configure.
• More effective at selecting the best route to a destination remote network and also for
discovering remote network.

Disadvantage –
• Consumes more bandwidth for communicating with other neighbors.
• Less secure than static routing.
Classification of Routing Algorithms
1. Adaptive Algorithms –
These are the algorithms which change their routing decisions whenever network
topology or traffic load changes. The changes in routing decisions are reflected in the
topology as well as traffic of the network. Also known as dynamic routing, these make
use of dynamic information such as current topology, load, delay, etc. to select routes.
Optimization parameters are distance, number of hops and estimated transit time.

(a) Isolated – In this method each, node makes its routing decisions using the the
information it has without seeking information from other nodes. The sending nodes
doesn’t have information about status of particular link. Disadvantage is that packet
may be sent through a congested network which may result in delay. Examples: Hot
potato routing, backward learning.
(b) Centralized – In this method, a centralized node has entire information about the
network and makes all the routing decisions. Advantage of this is only one node is
required to keep the information of entire network and disadvantage is that if central
node goes down the entire network is done.
(c) Distributed – In this method, the node receives information from its neighbors and
then takes the decision about routing the packets. Disadvantage is that the packet may
be delayed if there is change in between interval in which it receives information and
sends packet.
2. Non-Adaptive Algorithms
These are the algorithms which do not change their routing
decisions once they have been selected. This is also known as static
routing as route to be taken is computed in advance and
downloaded to routers when router is booted.

(a) Flooding – This adapts the technique in which every incoming


packet is sent on every outgoing line except from which it arrived.
One problem with this is that packets may go in loop and as a result
of which a node may receive duplicate packets. These problems can
be overcome with the help of sequence numbers, hop count and
spanning tree.
(b) Random walk – In this method, packets are sent host by host or
node by node to one of its neighbors randomly. This is highly robust
method which is usually implemented by sending packets onto the
link which is least queued.
Routing v/s Flooding
Routing Protocol Set 1
Distance Vector Table

A distance-vector routing (DVR) protocol requires that a router inform its neighbors
of topology changes periodically. Historically known as the old ARPANET routing
algorithm (or known as Bellman-Ford algorithm).

Bellman Ford Basics – Each router maintains a Distance Vector table containing the
distance between itself and ALL possible destination nodes. Distances,based on a
chosen metric, are computed using information from the neighbors’ distance
vectors.

Information kept by DV router -


• Each router has an ID
• Associated with each link connected to a router,
• there is a link cost (static or dynamic).
• Intermediate hops

Distance Vector Table Initialization -


• Distance to itself = 0
• Distance to ALL other routers = infinity number.
Distance Vector Algorithm –

1. A router transmits its distance vector to each of its neighbors in a routing packet.
2. Each router receives and saves the most recently received distance vector from each of
its neighbors.
3. A router recalculates its distance vector when:
• It receives a distance vector from a neighbor containing different information than
before.
• It discovers that a link to a neighbor has gone down.
• The DV calculation is based on minimizing the cost to each destination

Dx(y) = Estimate of least cost from x to y


C(x,v) = Node x knows cost to each neighbor v
Dx = [Dx(y): y ∈ N ] = Node x maintains distance vector
Node x also maintains its neighbors' distance vectors
– For each neighbor v, x maintains Dv = [Dv(y): y ∈ N ]
Note
•From time-to-time, each node sends its own distance vector estimate to neighbors.
•When a node x receives new DV estimate from any neighbor v, it saves v’s distance vector
and it updates its own DV using B-F equation

:Dx(y) = min { C(x,v) + Dv(y)} for each node y ∈ N


Example – Consider 3-routers X, Y and Z as shown in figure. Each router have their routing
table. Every routing table will contain distance to the destination nodes.
r1
Consider router X , X will share it routing table to neighbors and neighbors will share it
routing table to it to X and distance from node X to destination will be calculated using
bellmen- ford equation.

Dx(y) = min { C(x,v) + Dv(y)} for each node y ∈ N


As we can see that distance will be less going from X to Z when Y is intermediate node(hop)
so it will be update in routing table X.
Similarly for Z also –
Finally the routing table for all
Advantages of Distance Vector routing –

• It is simpler to configure and maintain than link state routing.


Disadvantages of Distance Vector routing –

• It is slower to converge than link state.


• It is at risk from the count-to-infinity problem.
• It creates more traffic than link state since a hop count change
must be propagated to all routers and processed on each router.
Hop count updates take place on a periodic basis, even if there are
no changes in the network topology, so bandwidth-wasting
broadcasts still occur.
• For larger networks, distance vector routing results in larger
routing tables than link state since each router must know about all
other routers. This can also lead to congestion on WAN links
Routing Link problems
Broadcast Storm –
A switch forwards out the broadcast frame, generated by another device, to all its ports. If
no loop avoidance schemes are applied then the switches will flood broadcasts endlessly
throughout the network which consumes all the available bandwidth . This phenomenon is
called broadcast storm.
Broadcast storm is a serious network problem and can shut down entire network in
seconds.
Here, there are 3 switches connected to each other in order to provide redundancy. When
host A generate a broadcast for host B, it is first received by switch A which in turn floods
the traffic to all its ports. As switch B and Switch C is also connected to switch A therefore,
these switches also receives the broadcast frame and floods the frame through all its ports.

As a result, switch A and switch C will also receive the broadcast frame generated by switch
B. Also, switch C will also generate broadcast frame for switch B and switch A. This will result
in a loop which will consumes all the available bandwidth and can lead to shut down of a
network.
Multiple copies –
A device can receive multiple copies of the same frame if a frame arrives from different
network segments at the same time.

Here is a small topology in which a router is


connected with 2 switches. Switch A is connected to
host A and switch C. On the other hand, switch B is
connected to switch C and host B. Suppose, if host
A wants to send a unicast frame to router then it
will forward out the frame to switch A. Switch A in
turn forward out it to router and switch C. At this
time, router will receive the packet.

But switch C in turn forwards the packet to Switch B


and Switch B will forward it out to router. At this
time, router will receive the multiple copies of a
single frame. This is a problem as most protocols
cannot correctly handle duplicate transmissions.
MAC table thrashing –
Switches use MAC address table to forward out the frames. When a switch receives a frame,
it makes an entry of the device mac address with the switch port on which the frame is
received but if the switch receives the frame of same source from more than one link then it
will be confusing for switch to make an entry in the MAC table. It will lead to instability of
MAC table.

In the given topology, if host A sends a


unicast frame for host B then switch A will
receive the frame. Switch A will forward it
out to both switch B and switch D which in
turn both forward it out to switch C. Now,
switch C will receive the frame on two
different ports with same source mac
address therefore it will lead to unstability
in the MAC table in switch C. Spanning Tree
Protocol (STP) is used to prevent these
loops. It will block down a (port) path using
its own mechanism by which a single path
is available for a frame delivery at a time. If
one path goes down, then the blocked path
becomes active and frame transmission can
take place from that path (in switches).
Administrative Distance
Administrative Distance (AD) is used to rate the trustworthiness of routing information
received from the neighbour router. The route with the least AD will be selected as the
best route to reach the destination remote network and that route will be placed in the
routing table. It defines how much reliable a routing protocol is. It is an integer value
ranging from 0 to 255 where 0 shows that the route is most trusted and 255 means that
no traffic will be passed through that route or that route is never installed in the routing
table.

Example –
The smaller the value of AD, the more reliable
routing protocol is. For example if a router receives
an advertised route to a remote destination
network from OSPF and EIGRP, then the advertised
route of EIGRP will be considered as best route and
will be placed in the routing table as EIGRP has
lower AD.
Best path selection process by dynamic protocol – Route sources Default AD
If a router receives same advertised routes from
Connected interface 0
more than one source for a remote network, then
Static route 1
first AD value is check. The advertised route
External BGP 20
having least AD value will get preference. If the
EIGRP 90
AD value of the advertised routes are same, then
OSPF 110
metrics of advertised routes is check. The
RIP 120
advertised route with the least metric will be
External EIGRP 170
placed in the routing table. If both AD and metric
are same then load balancing is done i.e the Internal BGP 200
traffic will traverse through different routes. The 255 (This route is not
Unknown
used)
load balancing can be equal or unequal. In equal
load balancing, the same amount of traffic will
traverse through both routes one at a time while
different amount of traffic will traverse in
unequal load balancing.
Autonomous System (AS)
is a group of routers and networks working under a single administrative domain. It
is a 16 bit value which defines the routing domain of the routers. These numbers
range from 1 to 65535.

Public Autonomous System Number –


These are 16 bit values which range from 1 to 64511.The service provider will
provide a public AS if the customer is connected to more than one ISPs such as
multihoming. A global autonomous number, which will be unique, is provided
when the customer wants to propagate it’s BGP routes through 2 ISPs.
Private Autonomous system Number –
Private Autonomous System Number are 16 bit values which range from 64512 to
65535.The service provider will provide a private autonomous system number to
the customer when the customer wants multi connection to a single ISP (single
home or dual home network) but not to more than one ISPs. These are provided in
order to conserve the autonomous system numbers.
Assigning of AS numbers –
The Autonomous numbers are first assigned by IANA (Internet Assign Number
Authority) to the respective regional registries. Further, the regional registry
distribute these autonomous numbers (from the block of autonomous numbers
provided by IANA) to entities within their designated area.
Unicast Routing (Link State Routing)
Unicast – Unicast means the transmission from a single sender to a single receiver. It is a
point to point communication between sender and receiver. There are various unicast
protocols such as TCP, HTTP, etc.

• TCP is the most commonly used unicast protocol. It is a connection oriented protocol that
relay on acknowledgement from the receiver side.
• HTTP stands for Hyper Text Transfer Protocol. It is an object oriented protocol for
communication.
There are three major protocols for unicast routing:

1. Distance Vector Routing


2. Link State Routing
3. Path-Vector Routing
Link State Routing –
Link state routing is the second family of routing protocols. While distance vector routers
use a distributed algorithm to compute their routing tables, link-state routing uses link-state
routers to exchange messages that allow each router to learn the entire network topology.
Based on this learned topology, each router is then able to compute its routing table by
using a shortest path computation.
Features of link state routing protocols –

• Link state packet – A small packet that contains routing information.


• Link state database – A collection information gathered from link state packet.
• Shortest path first algorithm (Dijkstra algorithm) – A calculation performed on the
database results into shortest path
• Routing table – A list of known paths and interfaces.
Calculation of shortest path –
To find shortest path, each node need to run the famous Dijkstra algorithm. This famous
algorithm uses the following steps:
Step-1: The node is taken and chosen as a root node of the tree, this creates the tree with a
single node, and now set the total cost of each node to some value based on the
information in Link State Database
Step-2: Now the node selects one node, among all the nodes not in the tree like structure,
which is nearest to the root, and adds this to the tree.The shape of the tree gets changed .
Step-3: After this node is added to the tree, the cost of all the nodes not in the tree needs to
be updated because the paths may have been changed.
Step-4: The node repeats the Step 2. and Step 3. until all the nodes are added in the tree
Link State protocols in comparison to Distance Vector protocols have:

• It requires large amount of memory.


• Shortest path computations require many CPU circles.
• If network use the little bandwidth ; it quickly reacts to topology changes
• All items in the database must be sent to neighbors to form link state packets.
• All neighbors must be trusted in the topology.
• Authentication mechanisms can be used to avoid undesired adjacency and problems.
• No split horizon techniques are possible in the link state routing.
OSPF Messages – OSPF is a very complex protocol. It uses five different types of messages.
These are as follows:

• Hello message (Type 1) – It is used by the routers to introduce itself to the other routers.
• Database description message (Type 2) – It is normally send in response to the Hello
message.
• Link-state request message (Type 3) – It is used by the routers that need information
about specific Link-State packet.
• Link-state update message (Type 4) – It is the main OSPF message for building Link-State
Database.
• Link-state acknowledgement message (Type 5) – It is used to create reliability in the OSPF
protocol.
Open shortest path first (OSPF) routing protocol –

• Open Shortest Path First (OSPF) is a unicast routing protocol developed by working group
of the Internet Engineering Task Force (IETF).
• It is a intradomain routing protocol.
• It is an open source protocol.
• It is similar to Routing Information Protocol (RIP)
• OSPF is a classless routing protocol, which means that in its updates, it includes the
subnet of each route it knows about, thus, enabling variable-length subnet masks. With
variable-length subnet masks, an IP network can be broken into many subnets of various
sizes. This provides network administrators with extra network-configuration
flexibility.These updates are multicasts at specific addresses (224.0.0.5 and 224.0.0.6).
• OSPF is implemented as a program in the network layer using the services provided by
the Internet Protocol
• IP datagram that carries the messages from OSPF sets the value of protocol field to 89
• OSPF is based on the SPF algorithm, which sometimes is referred to as the Dijkstra
algorithm
• OSPF has two versions – version 1 and version 2. Version 2 is used mostly
Distance Vector Routing –
Link State Routing –
• It is a dynamic routing algorithm in which
each router computes distance between itself
and each possible destination i.e. its •It is a dynamic routing algorithm in which
immediate neighbors. each router shares knowledge of its
• The router share its knowledge about the neighbors with every other router in the
whole network to its neighbors and network.
accordingly updates table based on its •A router sends its information about its
neighbors. neighbors only to all the routers through
• The sharing of information with the flooding.
neighbors takes place at regular intervals. •Information sharing takes place only
• It makes use of Bellman Ford Algorithm for whenever there is a change.
making routing tables. •It makes use of Dijkastra’s Algorithm for
• Problems – Count to infinity problem which making routing tables.
can be solved by splitting horizon. •Problems – Heavy traffic due to flooding
• – Good news spread fast and bad news of packets.
spread slowly. – Flooding can result in infinite looping
• – Persistent looping problem i.e. loop will be which can be solved by using Time to
there forever. leave (TTL) field.
References

https://en.wikipedia.org/wiki/Classful_network
TechNet – Microsoft
Classful network – Wikipedia
Questions?

??
?
?? ??
?? ? ??
? ?
? ?
?? ? ? ?
? ? ? ? ?
? ? ??
? ??? ? ? ?
? ? ?
? ?
? ? ???
??
?
?
? ? ??
? ?? ? ?
? ? ?
? ?

You might also like