0% found this document useful (0 votes)
24 views21 pages

CN Unit-IV Notes

Uploaded by

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

CN Unit-IV Notes

Uploaded by

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

CS3591 COMPUTER NETWORKS

GNANAMANI COLLEGE OF TECHNOLOGY


DEPARTMENT OF AI&DS

UNIT IV

ROUTING

1. Routing and protocols: Unicast routing


2. Distance Vector Routing
3. RIP
4. Link State Routing
5. OSPF
6. Path-vector routing
7. BGP
8. Multicast Routing: DVMRP – PIM

WHAT IS Routing?

Routing is the process of path selection in any network. A computer network is


made of many machines, called nodes, and paths or links that connect those nodes. Communication
between two nodes in an interconnected network can take place through many different paths. .
Routing is the process of selecting the best path using some predetermined rules.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
Unicast routing

Most of the traffic on the internet and intranets known as unicast data or unicast traffic is sent
with specified destination. Routing unicast data over the internet is called unicast routing. It is
the simplest form of routing because the destination is already known.

Major Protocols of Unicast Routing

1. Distance Vector Routing: Distance-Vector routers use a distributed algorithm to compute their
routing tables.
2. Link-State Routing: Link-State routing uses link-state routers to exchange messages that allow
each router to learn the entire network topology.
3. Path-Vector Routing: It is a routing protocol that maintains the path that is updated
dynamically.

Distance Vector Routing (DVR) Protocol


A distance-vector routing (DVR) protocol requires that a router inform its
neighbors of topology changes periodically.

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 –

What is Distance Vector Routing Protocol?

The Distance vector routing algorithms operate by having each router maintain a table (i.e., a
vector), giving the best-known distance to each destination and which path to use to get there.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
These tables are updated by exchanging information with the neighbors.

Three Keys to understand the working of Distance Vector Routing Algorithm

The three keys to understanding the working of the Distance Vector Routing Algorithm are:

1. Distance Metric
2. Routing Table
3. Bellman-Ford Algorithm

Working of Distance vector routing (DVR) protocol

 In this protocol, a routing table is maintained by each router, and it contains only one entry for
each router. It consists of two parts: one is a preferred outgoing line for that destination, and the
other is an estimate of time or delay.
 The tables are updated by exchanging the information with the connected adjacent nodes( or
neighbor's nodes).
 Each router knows the time delay in reaching its neighbors(or connected nodes).
 Routing tables are exchanged with each of their neighbors periodically by routers.

Example of Distance Vector Routing

Consider the following network; three routers are there: A, B, and C with AB=1, BC=2, and CA=5.

Let's see the following steps to understand it better.


CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
Step 1:

Each router shares its routing table with every neighbor in this distance vector routing network.
As A will share its routing table with neighbors B and C, neighbors B and C will share their
routing table with A.

Routing table A:
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS

Step 2:

If the path via a neighbor has a lower cost, the router updates its local table to forward packets to
the neighbor. In this table, router A will be updated.

Routing table A:

Routing table B:
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS

Routing table C:

Step 3:

The following are the final routing table for all the routers A, B, and C with lower cost distance
vector routing protocols.

Router for table A:


CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS

Router for table B:

Router for table C:

Example − Distance Vector Router Protocol

In the network shown below, there are three routers, A, B, and C, with the following weights − AB
=2, BC =3 and CA =5.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
Step 1 − In this DVR network, each router shares its routing table with every neighbor. For
example, A will share its routing table with neighbors B and C and neighbors B and C will share
their routing table with A.

Step 2 − If the path via a neighbor has a lower cost, then the router updates its local table to forward
packets to the neighbor. In this table, the router updates the lower cost for A and C by updating the
new weight from 4 to 3 in router A and from 4 to 3 in router C.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS

Step 3 − The final updated routing table with lower cost distance vector routing protocol for all
routers A, B, and C is given below –
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS

RIP

Routing Information Protocol (RIP) is a distance-vector routing protocol. Routers


running the distance-vector protocol send all or a portion of their routing tables in routing-update
messages to their neighbors. You can use RIP to configure the hosts as part of a RIP network.

Routing Information Protocol (RIP) is a dynamic routing protocol that uses hop count as a
routing metric to find the best path between the source and the destination network. It is a
distance-vector routing protocol that has an AD value of 120 and works on the Network layer of the
OSI model. RIP uses port number 520.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
Hop Count

Hop count is the number of routers occurring in between the source and destination network.
The path with the lowest hop count is considered as the best route to reach a network and
therefore placed in the routing table. RIP prevents routing loops by limiting the number of hops
allowed in a path from source and destination. The maximum hop count allowed for RIP is 15 and a
hop count of 16 is considered as network unreachable.

Features of RIP

1. Updates of the network are exchanged periodically.


2. Updates (routing information) are always broadcast.
3. Full routing tables are sent in updates.
4. Routers always trust routing information received from neighbor routers. This is also
known as Routing on rumors.

What is Routing Information Protocol (RIP)?

Routing Information Protocol (RIP) is a distance vector protocol that uses hop count as its primary
metric. RIP defines how routers should share information when moving traffic among an
interconnected group of local area networks.

In the enterprise, Open Shortest Path First (OSPF) routing has largely replaced RIP as the most
widely used Interior Gateway Protocol. RIP has been supplanted mainly due to its simplicity
and inability to scale to very large and complex networks. Border Gateway Protocol (BGP) is
another distance vector protocol that is now used to transfer routing information across
autonomous systems on the internet.

Versions of RIP

There are three versions of the Routing Information Protocol:

1. RIPv1
2. RIPv2
3. RIPng

How Does the RIP Work?

To understand how RIP works, we will consider two types of networks.

In the first example, there are eight routers connected to a network where router 1 wants to send
data to router 3. If the network is configured with RIP, it will choose the route with the least hop
count. In other words, it will choose the shortest path.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS

In this network, we have three possible routes to deliver the data from R1 to R4:

 Route 1:

It has 3 hop count. The data travels from R1 to R2 to R3 to R4.

 Route 2:

It has 2 hop count. The packet travels from R1 to R5 to R4.

 Route 3:

It has 4 hop count. The data travels from R1 to R6 to R7 to R8 to R4.

Therefore, the shortest path is router 2 as it has 2 hop counts only!

2. 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
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
learned topology, each router is then able to compute its routing table by using the shortest path
computation.

Features of Link State Routing Protocols

 Link State Packet: A small packet that contains routing information.


 Link-State Database: A collection of information gathered from the link-state packet.
 Shortest Path First Algorithm (Dijkstra algorithm): A calculation performed on the database
results in the shortest path
 Routing Table: A list of known paths and interfaces.

Calculation of Shortest Path

To find the shortest path, each node needs to run the famous Dijkstra algorithm. Let us understand
how can we find the shortest path using an example.

Illustration

To understand the Dijkstra Algorithm, let’s take a graph and find the shortest path from the
source to all nodes.

Note: We use a boolean array sptSet[] to represent the set of vertices included in SPT. If a value
sptSet[v] is true, then vertex v is included in SPT, otherwise not. Array dist[] is used to store the
shortest distance values of all vertices.Consider the below graph and src = 0

STEP 1: The set sptSet is initially empty and distances assigned to vertices are {0, INF, INF, INF,
INF, INF, INF, INF} where INF indicates infinite. Now pick the vertex with a minimum distance
value. The vertex 0 is picked and included in sptSet. So sptSet becomes {0}. After including 0 to
sptSet, update the distance values of its adjacent vertices. Adjacent vertices of 0 are 1 and 7. The
distance values of 1 and 7 are updated as 4 and 8.

The following subgraph shows vertices and their distance values. Vertices included in SPT are
included in GREEN color.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS

3.What is Open Shortest Path First (OSPF) in


Networking?

Open Shortest Path First (OSPF)


There are many routing protocols in the networking domain that define a set of rules on
how data should be transmitted. Open Shortest Path First (OSPF) is one such dynamic
routing protocol. It is called a dynamic protocol as it is able to dynamically exchange
routing information between the routers that are the nearest neighbors.

In this blog, we will learn what the OSPF protocol is and how it works. We will also learn
about the different states of the OSPF protocol. In the end, we will also discuss the
advantages and disadvantages of the protocol.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
What is the OSPF Protocol?

Open Shortest Path First (OSPF) is an Interior Gateway Protocol (IGP) that has an algorithm type
of Link-State.

understand the OSPF in detail:

 If we expand the term OSPF, it is Open Shortest Path First.


 It uses the Shortest Path First algorithm which is also called Dijkstra’s algorithm. This algorithm
is named after the name of a Dutch computer scientist.
 There are three versions of OSPF:
o OSPFv1: This is the first version of OSPF created in the year 1989. It is no longer in use.
o OSPFv2: This is the second version of OSPF created in 1998. It is used in IPv4. This
version is important for CCNA 200-301.
o OSPFv3: This is the latest version of OSPF created in the year 2008. This version is used
for IPv6 and as well as for IPv4.

several state:

Before establishing a neighbor relationship, OSPF routers need to go through several state changes.
These states are explained below.

1. Init state – a router has received a Hello message from the other OSPF router
2. 2-way state – the neighbor has received the Hello message and replied with a Hello message of
his own
3. Exstart state – beginning of the LSDB exchange between both routers. Routers are starting to
exchange link state information.
4. Exchange state – DBD (Database Descriptor) packets are exchanged. DBDs contain LSAs
headers. Routers will use this information to see what LSAs need to be exchanged.
5. Loading state – one neighbor sends LSRs (Link State Requests) for every network it doesn’t
know about. The other neighbor replies with the LSUs (Link State Updates) which contain
information about requested networks. After all the requested information have been received, other
neighbor goes through the same process
6. Full state – both routers have the synchronized database and are fully adjacent with each other.

OSPFTerms

1. Router Id – It is the highest active IP address present on the router. First, the highest loopback
address is considered. If no loopback is configured then the highest active IP address on the interface
of the router is considered.
2. Router priority – It is an 8-bit value assigned to a router operating OSPF, used to elect DR and
BDR in a broadcast network.
3. Designated Router (DR) – It is elected to minimize the number of adjacencies formed. DR
distributes the LSAs to all the other routers. DR is elected in a broadcast network to which all the
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
other routers share their DBD. In a broadcast network, the router requests for an update to DR, and
DR will respond to that request with an update.
4. Backup Designated Router (BDR) – BDR is a backup to DR in a broadcast network. When DR
goes down, BDR becomes DR and performs its functions.
5. DR and BDR election – DR and BDR election takes place in the broadcast network or multi-access
network. Here are the criteria for the election:
o The router having the highest router priority will be declared as DR.
o If there is a tie in router priority then the highest router I’d be considered. First, the highest
loopback address is considered. If no loopback is configured then the highest active IP
address on the interface of the router is considered.

path-vector routing protocol

A path-vector routing protocol is a network routing protocol which maintains the path
information that gets updated dynamically. Updates that have looped through the network and
returned to the same node are easily detected and discarded.

Border Gateway Protocol (BGP)


Border Gateway Protocol (BGP) is used to Exchange routing information for the internet and is
the protocol used between ISP which are different ASes.

The protocol can connect together any internetwork of autonomous system using an arbitrary
topology. The only requirement is that each AS have at least one router that is able to run BGP and
that is router connect to at least one other AS’s BGP router. BGP’s main function is to exchange
network reach-ability information with other BGP systems. Border Gateway Protocol constructs an
autonomous systems’ graph based on the information exchanged between BGP routers.

Characteristics of Border Gateway Protocol (BGP):

 Inter-Autonomous System Configuration: The main role of BGP is to provide communication


between two autonomous systems.
 BGP supports Next-Hop Paradigm.
 Coordination among multiple BGP speakers within the AS (Autonomous System).
 Path Information: BGP advertisement also include path information, along with the reachable
destination and next destination pair.
 Policy Support: BGP can implement policies that can be configured by the administrator. For ex:- a
router running BGP can be configured to distinguish between the routes that are known within the
AS and that which are known from outside the AS.
 Runs Over TCP.
 BGP conserve network Bandwidth.
 BGP supports CIDR.
 BGP also supports Security.
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
Functionality of Border Gateway Protocol (BGP):

BGP peers performs 3 functions, which are given below.

1. The first function consist of initial peer acquisition and authentication. both the peers
established a TCP connection and perform message exchange that guarantees both sides
have agreed to communicate.
2. The second function mainly focus on sending negative or positive reach-ability
information.
3. The third function verifies that the peers and the network connection between them are
functioning correctly.

BGP Route Information Management Functions:

 Route Storage: Each BGP stores information about how to reach other networks.
 Route Update: In this task, Special techniques are used to determine when and how to use
the information received from peers to properly update the routes.
 Route Selection: Each BGP uses the information in its route databases to select good
routes to each network on the internet network.
 Route advertisement: Each BGP speaker regularly tells its peer what is known about
various networks and methods to reach them.

MULTICAST ROUTING (DVMRP, PIM)

DVMRP
The Distance Vector Multicast Routing Protocol (DVMRP), defined in RFC 1075, is a routing
protocol used to share information between routers to facilitate the transportation of IP
multicast packets among networks. It formed the basis of the Internet's historic multicast
backbone, Mbone.

What Does Distance Vector Multicast Routing Protocol Mean?

Distance Vector Multicast Routing Protocol (DVMRP) is an efficient Interior Gateway Protocol
routing mechanism that combines Routing Information Protocol features with a truncated
reverse path broadcasting algorithm for IP multitask data sharing between connectionless
autonomous systems.

DVRMP’s main tasks include:


CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
 Tracks multicast datagram source paths
 Encapsulates packets as Internet Protocol (IP) datagrams
 Supports multicast IP datagram tunneling via unsupported encapsulated and addressed
unicast packet routers
 Generates dynamic multicast IP delivery trees via reverse path multicasting and a distributed
routing algorithm
 Exchanges routing datagrams made up of small, fixed-length headers and tagged data
streams via Internet Group Management Protocol
 Handles tunnel and physical interfacing according to broadcast routing exchange source
trees produced during truncated tree branch removal
 Manages reverse path forwarding for multicast traffic forwarding to downstream interfaces

DVMRP header components are as follows:

 Version
 Type
 Subtype: Response, request, non-membership report or non-membership cancellations
 Checksum: Complete message sum of 16-bit ones, not including IP headers. Requires 16-
bit alignment. Checksum computation field is zero.

Multicast (PIM)?
Protocol Independent Multicast (PIM) is a collection of multicast routing protocols, each
optimized for a different environment.

There are two main PIM protocols, PIM Sparse Mode and PIM Dense Mode. A third PIM
protocol, Bi-directional PIM, is less widely used.

Typically, either PIM Sparse Mode or PIM Dense Mode will be used throughout a multicast
domain. However, they may also be used together within a single domain, using Sparse Mode for
some groups and Dense Mode for others. This mixed-mode configuration is known as Sparse-
Dense Mode. Similarly, Bi-directional PIM may be used on its own, or it may be used in
conjunction with one or both of PIM Sparse Mode and PIM Dense Mode.

All PIM protocols share a common control message format. PIM control messages are sent as raw
IP datagrams (protocol number 103), either multicast to the link-local ALL PIM ROUTERS
multicast group, or unicast to a specific destination.

PIM Sparse Mode

PIM Sparse Mode (PIM-SM) is a multicast routing protocol designed on the assumption that
recipients for any particular multicast group will be sparsely distributed throughout the network. In
other words, it is assumed that most subnets in the network will not want any given multicast
CS3591 COMPUTER NETWORKS
GNANAMANI COLLEGE OF TECHNOLOGY
DEPARTMENT OF AI&DS
packet. In order to receive multicast data, routers must explicitly tell their upstream neighbors about
their interest in particular groups and sources. Routers use PIM Join and Prune messages to join and
leave multicast distribution trees.

PIM-SM by default uses shared trees, which are multicast distribution trees rooted at some selected
node (in PIM, this router is called the Rendezvous Point, or RP) and used by all sources sending to
the multicast group. To send to the RP, sources must encapsulate data in PIM control messages and
send it by unicast to the RP. This is done by the source's Designated Router (DR), which is a router
on the source's local network. A single DR is elected from all PIM routers on a network, so that
unnecessary control messages are not sent.

PIM Dense Mode

PIM Dense Mode (PIM-DM) is a multicast routing protocol designed with the opposite assumption
to PIM-SM, namely that the receivers for any multicast group are distributed densely throughout
the network. That is, it is assumed that most (or at least many) subnets in the network will want any
given multicast packet. Multicast data is initially sent to all hosts in the network. Routers that do not
have any interested hosts then send PIM Prune messages to remove themselves from the tree.

Bi-directional PIM

Bi-directional PIM (BIDIR-PIM) is a third PIM protocol, based on PIM-SM. The main way BIDIR-
PIM differs from PIM-SM is in the method used to send data from a source to the RP. Whereas in
PIM-SM data is sent using either encapsulation or a source-based tree, in BIDIR-PIM the data
flows to the RP along the shared tree, which is bi-directional - data flows in both directions along
any given branch.

You might also like