Packets take different routes when sent in large and complex networks. Some routes can be longer while others are shorter.
The fastest available routes are always the best hence a mechanism is needed to identify them.
This article will cover how we can apply classless routing protocols on networks to identify fast routes using the Open Shortest Path First (OSPF) protocol.
Table of contents
- OSPF components and characteristics
- OSPF implementation
- OSPF configuration
- OSPF Verification
To follow along, the reader should:
- Have a good understanding of networks and configurations.
- Have a prior understanding of the basic network routing concepts.
- Know how to use the Cisco Packet Tracer.
You can download the Cisco packet tracer from here.
Classless routing - It refers to a type of routing where the router uses the default route to forward traffic if no other specific routes are found. It includes subnet mask information in the routing update and is supported by RIPv2, OSPF, and EIGRP protocols.
Administrative Distance (AD) - This feature is used by routers to select the best path possible.
Metric - It refers to the ways used by each classless routing protocol to determine the best path to a network. OSPF uses the
Sum of Inverse of Bandwidthwhile RIP uses
Hop Count. EIGRP relies on
Min Bandwidth + Delay.
Wildcard Mask - It refers to the inverses of subnet masks configured on interfaces and used by OSPF to specify the range of IP addresses to examine for a match. It is usually 32-bit long.
A logical grouping of OSPF networks, routers, and links with the same area identification is referred to as an OSPF area. A router within an area is required to have a topological database for that particular region.
OSPF neighbors - It is the relationship that exists between two OSPF-enabled routers in the same area that is connected by a common network.
OSPF components and characteristics
The Open Shortest Path First (OSPF) protocol is a link-state, classless, open standard routing protocol that was created as an inner gateway protocol.
It uses the concept of areas and the routing metric
cost to help control routing traffic by providing fast convergence and scaling to much larger network implementations.
The OSPF protocol manages several routing zones and assists in determining the quickest available route for a particular situation.
The OSPF protocol has comparable components. That is:
Routing Protocol Messages - OSPF allows routers to send and receive messages in the form of packets. Such as hello packets, link-state request packets, and database description packets.
Data Structures - They are created by the OSPF neighbors’ messages and contains a list of surrounding routers that they share routing information. They are stored in the RAM.
- The neighbor table is created by the
- The topology table is created by the
- The routing table is generated by the
- Algorithm - OSPF employs the Shortest Path First(SPF) algorithm, which is based on the total cost of reaching a target.
- OSPF uses link-state routing algorithm.
- It supports CIDR addressing model.
- OSPF only sends updates rather than the complete routing table.
- The simplest routing statistic is path cost.
- It supports authentication and sends updates after every 10 seconds.
- Updates are sent with the multi-cast address
OSPF can be set up in two different ways:
i). Single area OSPF
This form of OSPF implementation happens in small networks with all routers in the backbone region (area 0), resulting in enormous routing tables.
ii). Multi area OSPF
OSPF is done in a hierarchical order. Multiple locations must link to the backbone. We can divide a large autonomous system into smaller segments to support hierarchical routing.
The Shortest Path First (SPF) is confined to an area resulting in smaller routing tables.
Let’s look at how we can configure and verify OSPF implementation on a local area network.
Consider the network below:
Assign IP addresses to the interfaces on both routers and PCs.
Router>enable Router#configure terminal Router(config) #interface gi0/0 !specifying interface Router(config-if) #ip address 192.168.20.1 255.255.255.0 !assigning IP address to interface Router(config-if) #no shutdown !activating the interface Router(config-if) #interface gi0/1 Router(config-if) #ip address 192.168.10.1 255.255.255.0 Router(config-if) #no shutdown Router(config-if) #do write ! routers configuration saving
Router>enable Router#config terminal Router(config) #interface gi0/0 Router(config-if) #ip address 192.168.20.2 255.255.255.0 Router(config-if) #no shutdown Router(config-if) #interface gi0/1 Router(config-if) #ip address 192.168.30.1 255.255.255.0 Router(config-if) #no shutdown
Create a relationship between the two routers and specify the connected subnet in OSPF.
Router(config) #router ospf 1 !ospf is enabled Router(config-router) #network 192.168.10.0 0.0.0.255 area 0 !specifying the network, wildcard mask and the area Router(config-router) #network 192.168.20.0 0.0.0.255 area 0 Router(config-router) #do write
Router(config-if) #router ospf 1 Router(config-router) #network 192.168.30.0 0.0.0.255 area 0 Router(config-router) #network 192.168.20.0 0.0.0.255 area 0 Router(config-router) #do write
To disable OSPF configurations on the routers, the command
no router ospfis used in the global configuration mode. To view the OSPF information, we can use the
show ip protocolscommand.
To verify that we configured OSPF on the network and its implementation is working, the command
show ip ospf is used.
Router#show ip ospf Routing Process "ospf 1" with ID 192.168.20.1 Supports only single TOS(TOS0) routes Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
To view the OSPF neighbors we use
show ip ospf neighbor.
Router#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 192.168.30.1 1 FULL/BDR 00:00:32 192.168.20.2 GigabitEthernet0/0
On both routers, we can use the
show ip route ospf command to check if the connected subnets are advertised in a different area.
Router#show ip route ospf O 192.168.10.0 [110/2] via 192.168.20.1, 00:34:39, GigabitEthernet0/0
Computers can communicate since they are directly connected to the same area.
As shown above, we can use OSPF in classless routing to determine the fastest available routes for packets. This feature helps to accomodate large network implementations.
You can find more information about classless routing using OSPF here.
Peer Review Contributions by: Eric Gacoki
About the authorAtonya Dennis
Atonya Dennis is a Computer Technology student at Jomo Kenyatta University Of Agriculture and Technology. His interests are web development and networking. Dennis has a great passion for developing web applications and configuring networks.