Study The Working of RIP and OSPF
Study The Working of RIP and OSPF
RIP is intended to allow hosts and gateways to exchange information for computing routes
through an IP-based network. RIP is a distance vector protocol which is based on Bellman-
Ford algorithm. This algorithm has been used for routing computation in the network.
Distance vector algorithms are based on the exchange of only a small amount of information
using RIP messages.
Each entity (router or host) that participates in the routing protocol is assumed to keep
information about all of the destinations within the system. Generally, information about all
entities connected to one network is summarized by a single entry, which describes the route
to all destinations on that network. This summarization is possible because as far as IP is
concerned, routing within a network is invisible. Each entry in this routing database includes
the next router to which datagram’s destined for the entity should be sent. In addition, it
includes a "metric" measuring the total distance to the entity.
Distance is a somewhat generalized concept, which may cover the time delay in getting
messages to the entity, the dollar cost of sending messages to it, etc. Distance vector
algorithms get their name from the fact that it is possible to compute optimal routes when the
only information exchanged is the list of these distances. Furthermore, information is only
exchanged among entities that are adjacent, that is, entities that share a common network.
OSPF
In OSPF, the Packets are transmitted through the shortest path between the source and
destination.
Shortest path: OSPF allows administrator to assign a cost for passing through a link. The
total cost of a particular route is equal to the sum of the costs of all links that comprise the
route. A router chooses the route with the shortest (smallest) cost.
Ver 11.1 1
In OSPF, each router has a link state database which is tabular representation of the topology
of the network (including cost). Using Dijkstra algorithm each router finds the shortest path
between source and destination.
1. OSPF-speaking routers send Hello packets out all OSPF-enabled interfaces. If two routers
sharing a common data link agree on certain parameters specified in their respective Hello
packets, they will become neighbors.
2. Adjacencies, which can be thought of as virtual point-to-point links, are formed between
some neighbors. OSPF defines several network types and several router types. The
establishment of an adjacency is determined by the types of routers exchanging Hellos
and the type of network over which the Hellos are exchanged.
3. Each router sends link-state advertisements (LSAs) over all adjacencies. The LSAs
describe all of the router's links, or interfaces, the router's neighbors, and the state of the
links. These links might be to stub networks (networks with no other router attached), to
other OSPF routers, or to external networks (networks learned from another routing
process). Because of the varying types of link-state information, OSPF defines multiple
LSA types.
4. Each router receiving an LSA from a neighbor records the LSA in its link-state
database and sends a copy of the LSA to all of its other neighbors.
5. By flooding LSAs throughout an area, all routers will build identical link-state databases.
6. When the databases are complete, each router uses the SPF algorithm to calculate a loop-
free graph describing the shortest (lowest cost) path to every known destination, with itself
as the root. This graph is the SPF tree.
7. Each router builds its route table from its SPF tree
12.2 Procedure
Sample 1:
Ver 11.1 2
Step 2: Click & drop Routers, Switches and Nodes onto the Simulation Environment
and link them as shown:
Step 3: These properties can be set only after devices are linked to each other as
shown above.
Ver 11.1 3
Node Properties: In Wired Node 10, go to Transport Layer and set TCP as Disable
Application Properties: Click on the Application icon and set properties as follows:
Enable packet trace and run simulation for 100s. After Simulation is performed, save the
experiment.
Ver 11.1 4
Sample 2: To model a scenario, follow the same steps given below:
Application Properties: Click on the Application icon and set properties as follows
Ver 11.1 5
Right click on Router 7 and go to properties. In the WAN Interfaces – INTERFACE_1 (WAN),
INTERFACE_2 (WAN) set the Output Cost as 2000 as shown below:
Note that in a wired network with routers and switches OSPF, Spanning tree etc. takes times
to converge and hence it is a good practice to set the application start time greater than
OSPF convergence time. Convergence time increases as the size of the network grows.
Ver 11.1 6
Simulation Time- 100 Sec
In Distance vector routing, each router periodically shares its knowledge about the entire
network with its neighbors. The three keys for understanding the algorithm,
Router sends all of its collected knowledge about the network to its neighbors
Each router periodically sends its knowledge about the network only to those routers to which
it has direct links. It sends whatever knowledge it has about the whole network through all of
its ports. This information is received and kept by each neighboring router and used to update
that router’s own information about the network.
For example, every 30 seconds, each router sends its information about the whole network to
its neighbors. This sharing occurs whether or not the network has changed since the last time
information was exchanged
Initial Table: This table will show the direct connections made by each Router.
Intermediate Table: The Intermediate table will have the updates of the Network in every 30
seconds
Final Table: This table is formed when there is no update in the Network.
The data should be forwarded using Routing Table with the shortest distance.
Go to NetSim Packet Animation window and play animation. You will be able to see the path
packets take both in the animation and in the packet trace table as shown below:
Ver 11.1 7
Shortest Path from Wired Node 10 to Wired Node 11 in RIP (Use Packet Animation
to view) is Wired Node 10->L2 Switch 8->Router 1->Router 7->Router 6->L2
Switch 9->Wired Node 11. RIP chooses the lower path (number of hops is less)
to forward packets from source to destination since it is based on hop count as
shown below
Ver 11.1 8
OSPF
The main operation of the OSPF protocol occurs in the following consecutive stages and leads
to the convergence of the internetworks:
The LSDB is a database of all OSPF router LSAs. The LSDB is compiled by an ongoing
exchange of LSAs between neighboring routers so that each router is synchronized with its
neighbor. When the Network converged, all routers have the appropriate entries in their LSDB.
Once the LSDB is compiled, each OSPF router performs a least cost path calculation called
the Dijkstra algorithm on the information in the LSDB and creates a tree of shortest paths to
each other router and network with themselves as the root. This tree is known as the SPF
Tree and contains a single, least cost path to each router and in the Network. The least cost
path calculation is performed by each router with itself as the root of the tree
Ver 11.1 9
The OSPF routing table entries are created from the SPF tree and a single entry for each
network in the AS is produced. The metric for the routing table entry is the OSPF-calculated
cost, not a hop count.
Go to NetSim Packet Animation window and play animation. If app start time isn't changed
then:
1. Packets generated before OSPF table convergence may be dropped at the gateway
router.
3. If TCP is enabled TCP may stop after the re-try limit is reached (since the SYN packets
would not reach the destination)
You will be able to see the path packets take both in the animation and in the packet trace
table as shown below:
Shortest Path from Wired Node 10 to Wired Node 11 in OSPF (Use Packet Animation to view)
Wired Node 10->L2 Switch 8->Router 1->Router 2->Router 3->Router 4->Router 5-
Ver 11.1 10
>Router 6->L2 Switch 9->Wired Node 11. OSPF chooses the upper path (cost is less-5)
since OSPF is based on cost.
Note: The device / link numbering and IP Address setting in NetSim is based on order in which in the
devices are dragged & dropped, and the order in which links are connected. Hence if the order in which a
user executes these tasks is different from what is shown in the screen shots, users would notice different
tables from what is shown in the screen shots.
Ver 11.1 11