Comparison of OSPF vs RIP/RIPv2 Routing Protocols in IP

Comparison of OSPF vs RIP/RIPv2 Routing Protocols in IP

Open Shortest Path First (OSPF) and Routing Information Protocol (RIP) are two of the most well-known Internal Gateway Protocols (IGPs) among network professionals and enthusiasts alike. 

comparing ospf vs rip protocols

Both are among the oldest routing protocols developed for IP networks, but they have evolved in very different ways, and are ultimately used today for very different purposes.

Let’s take a closer look at each one and see how they are implemented practically in today’s networks.

So, it this article we’ll compare and discuss OSPF vs RIP/RIPv2 routing protocol together with sample configurations on Cisco routers.

Before continuing though, let’s first see a high-level comparison table of the two:

Comparison Table

The following table compares some of the most important characteristics of these two protocols:

No. Characteristic OSPF RIP
1 Type Distance vector Link-state
2 Open standard? Yes, published in 1989 Yes, published in 1988
3 Routing algorithm Dijkstra’s Algorithm Based on the Bellman-Ford and Ford–Fulkerson algorithms
4 Topology Each router maintains a network topology within the OSPF database of the area in which it resides Each router contains only topology information about routes it has learned via RIP
5 Metric Path cost Hop count
6 Areas Uses areas to break down larger topologies into manageable segments No areas used
7 Scalability Extremely scalable due to area architecture and multiple LSA types Limited to a maximum network diameter of 15 hops
8 Resource usage (CPU, memory, and network throughput) Low usage due to multiple LSA types and area architecture High network throughput due to the periodic sending of the whole routing table
9 Support for IPv4 and IPv6 Yes, in OSPFv3 Yes, in RIPng
10 Convergence speed Fast Slow
11 Default administrative distance (AD) 110 120


RIP has its roots in the 1970s and evolved out of a series of its predecessors that were each developed for various networking and computer platforms. 

As such, RIP had unofficially been extensively deployed before the first official standard of RIPv1 was defined and published in 1988 in the now obsolete RFC 1058. 

It is an open standard and is generally supported by virtually all network equipment vendors.  RIP is a distance-vector routing protocol that employs a simple hop count for its metric. 

It is considered to be a relatively simple routing protocol with few exceptional advantages, and as such is generally not preferred for production networks.


Unlike other routing protocols, RIP uses only the number of hops to a particular destination as the metric of a specific route. 

It does not consider bandwidth, congestion, or other dynamically changing parameters.  This means that it would prefer to route traffic over a 64Kbps single-hop link than via a 1Gbps route that traverses two additional routers.  This extreme example illustrates one of its disadvantages.

RIP supports routes in the routing table with a maximum hop count of 15.  RIP considers a hop count of 16 to be unreachable.  This limits the size of the network within RIP can operate.

Updates and Timers

RIP updates are sent every 30 seconds by default and contain the whole routing table of the local router.  A RIP router will maintain a RIP route within the routing table for up to 180 seconds without being updated. 

Once that time elapses without a newer update, the route is considered invalid, but is not removed from the routing table until an additional 240 seconds elapse.  Once that time is exhausted without an update, the route is removed.

These timers give an idea of how long it takes for RIP to converge, which is another disadvantage of this particular routing protocol.


The original RIP routing protocol uses classful routing.  That means that when advertising networks, it always assumes the classful subnet mask even if a network is further subnetted. 

For example, RIP will advertise the network as since the address itself is a class B address.  Similarly, is advertised as since it is a class A address.

RIP version 2, stylized as RIPv2, is an improvement on RIPv1.  One of the main changes in the protocol is that it resolves this issue by including subnet mask information in the RIP updates.

Configuring RIP

The following are some examples of the configuration of RIP using two Cisco IOS routers.  Take a look at the following topology:

rip configuration

The routers have already been configured with IP addresses on their Fa0/0 and Fa0/1 interfaces as shown.  Now let’s enable RIP on R1 and R2, and advertise the network to R2 and the network to R1.

This can be done by issuing the following commands on R1 and R2:

R1(config)#router rip

R2(config)#router rip

The network command is used to tell RIP which directly connected networks should be advertised using the protocol.

Now let’s take a look and see what RIP routes appear in the routing table of R2.  The following command displays only the routes in the routing table learned via RIP:

R2#show ip route rip

R [120/1] via, 00:00:21, FastEthernet0/0

You may notice that it is the /16 network being advertised and not the /24 network configured on the interface. 

This is because, by default, RIPv1 is active on Cisco IOS routers, which only supports classful subnet masks.  To resolve this issue, we can enable RIP version 2.  To do so, issue the following commands:

R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary

R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary

The no auto-summary command instructs RIP not to automatically summarize routes to their classful subnet mask.  The configured subnet mask will be advertised.  Let’s see how this has changed the way the network is displayed in the routing table of R2:

R2#show ip route rip is subnetted, 2 subnets

R [120/1] via, 00:00:08, FastEthernet0/0

You can see that the network now shows a /24 subnet.  Let’s look at the RIP routes in the routing table of R1:

R1#show ip route rip

R [120/1] via, 00:00:24, FastEthernet0/1


OSPF was first conceived in the 1980s and was officially released in 1989 in RFC 1131 just 16 months after RIP’s official publication. 

Like RIP, it is an open non-proprietary protocol and is supported by virtually all network device vendors.  Its similarities with RIP however end there.

OSPF is a link-state routing protocol.  Where RIP maintains a partial network map, OSPF creates and maintains a topology of the whole network within a data structure known as the OSPF database. 

In a converged network, all OSPF routers will have constructed an identical copy of the network topology in their memories.  This is the main construct via which OSPF operates.


OSPF is much more scalable than RIP because of several important characteristics.  These include:

Areas – OSFP topologies can be subdivided into areas.  An area in OSPF is simply a logical grouping of routers that helps to make OSPF topologies more manageable.  Each OSPF area maintains a separate OSPF database, and OSPF routers can either exist wholly within an area, or they can have interfaces within two or more areas, making them area border routers (ABRs).  The following diagram illustrates this, where R1 is an ABR:

ospf area 0 topology

Metric – OSPF uses the path cost as a metric.  Path cost is based on the cumulative cost of the reported bandwidth of all outgoing interfaces of the path to the desired destination.  This way, the actual speeds of the links a packet must traverse are taken into account, rather than just the number of hops to the destination.  This is a substantial improvement over RIP

Updates – OSPF shares routing information via Link State Advertisements (LSAs).  Because of the scalability introduced with the use of OSPF areas, not all LSAs are flooded out of all interfaces of an OSPF router. 

There are various types of LSAs, each one limited to being shared with specific OSPF neighbors.  In this way, detailed OSPF information is kept localized, ensuring that any routing information not useful for particular routers is not shared.  In addition, routing updates are only sent when there is a network change, rather than periodically like RIP.

Configuring OSPF

The following are some examples of the configuration of OSPF using two Cisco IOS routers.  Once again, we’ll use the same topology:

rip and ospf configuration

We’ll enable OSPF on R1 and R2 and advertise all connected networks:

R1(config)#router ospf 1
R1(config-router)#network area 0
R1(config-router)#network area 0

R2(config)#router ospf 1
R2(config-router)#network area 0
R2(config-router)#network area 0

Note the following differences between the OSPF and RIP configurations:

  • OSPF includes a process ID of 1 in the router ospf 1 command. This process ID is used to distinguish between multiple instances of OSPF running on the same router.  The value is only locally significant.
  • OSPF uses the network command like RIP, but also includes:
    • Subnet mask information in the form of a wildcard mask allowing classless routing
    • Area information, indicating to which OSPF area this particular prefix belongs

Let’s take a look at the OSPF routes in the routing tables of R1 and R2:

R1#show ip route ospf

O [110/2] via, 00:09:45, FastEthernet0/1

R2#show ip route ospf

O [110/2] via, 00:12:15, FastEthernet0/0

Note that the network shows the /24 prefix, which means that subnet mask information is being exchanged.  This means that classless routing is enabled.  This is because OSPFv2 is the default version of OSPF running on Cisco IOS devices.

The verdict

We can come to some conclusions about these protocols based on the above information:

OSPF is a protocol that is very popular for use in production networks.  It has fast convergence, it is highly configurable and scalable, it is supported by virtually all vendors, and is extremely reliable.

RIP on the other hand is slow to converge, limited in scalability, and somewhat inefficient, and for this reason, it is generally not preferred in production environments. 

However, RIP is an exceptional routing protocol to be used for teaching and training in networking.  It is often among the first routing protocols to be learned by networking trainees because it demonstrates many of the fundamentals of routing in a very simple and clear manner.  It is thus an excellent tool to be used in the classroom to understand routing.

Links to relevant standards: