One of the most important topics of the CCNA exam is Interior Gateway Protocol. To successfully pass this exam, you will need to have a good understanding of RIP, OSPF and EIGRP protocols. Among these, OSPF has the advantage of being highly scalable, as it’s not constrained by network size like RIP and is not vendor dependent like EIGRP.

This two-part article describes the functionality and configuration of a multi-area OSPF network, along with configuration of some parameters.

CCNA Training – Resources (Intense)

After reading both parts of the article, you will:

know what are the features of OSPF know how the Hello protocol works know what is the Router ID and Designated Router know how to configure a multi-area OSPF network know how to verify the OSPF operation know how to configure the Router ID know how to change the hello timers and OSPF cost on interfaces. know how to configure OSPF authentication

In the first part of the article, we will discuss theoretical notions about OSPF and how to configure a multi-area OSPF network.

All current IP routing protocols belong to one of two classes: distance-vector or link state protocols. RIP, RIPv2, IGRP, EIGRP are distance vector protocols, whereas OSPF, OSPFv3 and IS-IS are link state protocols.

The purpose of a routing protocol is to build a list of reachable destination addresses, in every router from the network, to be able to forward packets.

OSPF is one of the most popular IP routing protocols used in enterprise networks. This is because it is an open standard and mature protocol, making it the preferred routing protocol in multivendor networks. The protocol operates at the IP layer using IP protocol number 89.

OSPF routers start exchanging routing information only after there is a neighbour relationship between them. OSPF routers exchange LSA (Link State Advertisements), which describe the state of the network links. After the exchange is done, every router from a particular area has the same LSA information. All LSA data are stored in a database which is used to build the routing table.

Router ID



A requirement for a link state protocol is that each router must be able to uniquely identify itself within the routing domain. This is the purpose of the OSPF router ID (RID).

OSPF uses a 32-bit number for its RID, represented in the same dotted-decimal format as an IP address. The RID can be administratively specified in the configuration, or it can be one of the IP addresses configured on one of the router’s interfaces.

Cisco has a prioritized RID selection algorithm:

If the RID is administratively configured, then that value is used. If the RID is not configured, then the IP address found on the loopback interface is used. If there is no IP address configured on the loopback interface, then the value chosen is taken from a physical interface. If the RID is not administratively configured and there is no IP address configured on any interface, then OSPF cannot start.

Hello Protocol



When the OSPF protocol process starts on a router, neighbours must be discovered and adjacencies established. OSPF sends and listens for Hello messages to discover neighbours. The Hello protocol performs several functions:

Discovers neighbouring routers. Ensures bi-directional communication between neighbours. Communicates the information needed to form an adjacency with a neighbour router. Serves as a keep-alive to detect failed neighbours and adjacencies.

Hello packets are sent to multicast IP address 224.0.0.5, which is a multicast address turned on for all OSPF speaking routers. OSPF routers are listening to this IP address to learn about new neighbours.

Routers learn the following information in a hello packet:

Network Mask – the prefix length of the subnet on which the message is sent. Hello Interval – specifies in seconds how often the originating router will send Hellos. Options – any optional capabilities that the originating OSPF router may have. Router Priority – priority used to elect the Designated Router. Router Dead Interval – specifies how long the originating router’s neighbours should wait before declaring it dead. Designated Router and Backup Designated Router –used in Designated Router election. Neighbour – the RIDs of the OSPF neighbours that the originating router has received Hellos from on the subnet.

In order for two OSPF routers to become neighbours, the following information must match:

Subnet mask used on the subnet Hello interval Dead interval OSPF area ID Authentication keys (if used) Area type

Point 6 refers to stub area flags and might be beyond the scope of the intended audience of this article. However, keep in mind that area type must be identical for routers to become neighbours.

Designated Router



Based on the interface type, OSPF decides if a DR should be used or not. Even though there are many more interface types, the most important ones are point-to-point and broadcast.

DR is needed only on broadcast interface-type, not on point-to-point.

OSPF elects a designated router (DR) on all multi-access links like broadcast. The DR forms an adjacency with all other OSPF routers on the network. The DR represents the network to the rest of the OSPF area.

To prevent a DR from sending duplicate updates for every adjacency, multicast IP addresses are used. The DR sends packets to the other routers on the network using a destination address of 224.0.0.5 called AllSPFRouters. The other routers communicate with the DR by sending packets to the multicast address 224.0.0.6 called AllDRouters.

For redundancy, OSPF elects a backup designated router (BDR). Routers that are not designated routers form adjacencies with both the DR and the BDR. The DR and BDR are also adjacent, and the BDR synchronizes with the DR just like the DROthers.

When a DR is required, an election takes place between neighbour routers. All the information needed to elect the DR is contained in the Hello packets and is based on these criteria:

The router with the highest OSPF priority becomes the DR. In case of a tie, the router with the highest RID becomes the DR.

A few things to consider about DR election:

A priority of 0 means that the router will not participate in DR election. Priority values are within the range of 0 – 255. If a better candidate joins the broadcast segment after the DR/BDR election occurred, then the new candidate will not pre-empt any of the existing DR/BDR.

OSPF Areas and Router Types



An area is a set of routers that have the same link state database information and is different than the information that routers from different areas have.

Areas split the network so that routers in one area will know less information about networks in other areas. This means that with less information, the routers will consume less memory and the SPF algorithm will run faster.

The backbone area is the area in which all areas must connect. It is always area 0.

There are multiple router types in an OSPF network:

Area Border Router(ABR) – a router that has at least one interface in the backbone area and at least one more in another area. Autonomous System Border Router(ASBR) – a router that connects to routers that do not run OSPF in order to exchange external routes in and out of OSPF domain. Backbone router – a router that has all of its interfaces in the backbone area. Internal router – a router that has all of its interfaces in an area other than the backbone area.

OSPF Configuration



The case study will use the following topology:

Each router has a loopback interface and is following this addressing: Rx = x.x.x.x/32. For instance, R1 has a loopback interface configured with 1.1.1.1/32. All the other IP addressing can be seen on the topology.

As previously discussed, R3 is an ABR because it has at least one interface in Area 0.

A working OSPF configuration on R3 to make it an ABR is this one:

When the OSPF protocol is started on a router, a process-id is required as a parameter. This number has a value only locally and doesn’t have to match on any other neighbour router.

The network command instructs the router to start OSPF on each matched interface, assigns that interface to the configured area and advertises the connected subnets. The statement matches the interfaces using an address and a wildcard mask. This wildcard mask works in the same way as an ACL wildcard mask.

With this configuration, using an address and a wildcard mask of 0.0.0.0, all 32 bits must be compared. The IP address from that interface will then appear in the network statement.

As you can see, the interfaces Loopback0, FastEthernet1/0 and Serial2/0 were placed in Area 0. The interface FastEthernet0/0 was placed in Area 1.

In case of an internal router or a backbone router (any of these two types has all the interfaces in the same area), you can use this configuration:

The network statement instructs the router to start OSPF on any interface that is up. The drawback of this approach is that if another interface will be configured and brought up in the future, that interface will be part of the OSPF routing protocol whether or not the operator wants it to be.

The first approach removes any ambiguity about which interfaces are running OSPF.

OSPF has been configured properly on all the routers from the topology and the network is converged.

Let’s check the neighbour relationship on R3:

The command ‘show ip ospf interface brief’ shows on which interface OSPF is running and in which areas they are assigned. Also, you can find the cost of each link, the state of the router on that link, the local IP address on that interface and the numbers of neighbours on that link.

For instance, interface FastEthernet1/0 is on area 0, has a cost of 1, and is acting as BDR on that broadcast segment. The number of neighbours on that link is 2.

The following describes the ‘show ip ospf neighbor’ command:

Neighbor ID – the router ID of the neighbour router.

Priority –indicates the priority of the neighbour.

State – indicates the functional state of the neighbour router. FULL means the router is fully adjacent with this neighbour and DR means that the neighbour is the DR of the broadcast segment.

Dead Time – the interval the router waits to receive an OSPF Hello before declaring the neighbour dead.

Address – indicates the IP address of the interface to which this neighbour is directly connected.

Interface – indicates the interface over which the OSPF neighbour relationship formed.

Let’s check the routing table of R4 and see what OSPF routes have been learned:

R4#show ip route ospf

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/67] via 10.10.0.3, 00:35:05, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/3] via 10.10.0.3, 00:35:05, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O 3.3.3.3 [110/2] via 10.10.0.3, 00:35:05, FastEthernet0/0

5.0.0.0/32 is subnetted, 1 subnets

O 5.5.5.5 [110/2] via 10.10.0.5, 00:35:05, FastEthernet0/0

10.0.0.0/24 is subnetted, 5 subnets

O IA 10.10.12.0 [110/66] via 10.10.0.3, 00:35:05, FastEthernet0/0

O IA 10.10.21.0 [110/66] via 10.10.0.3, 00:35:05, FastEthernet0/0

O IA 10.10.23.0 [110/2] via 10.10.0.3, 00:35:05, FastEthernet0/0

O 10.10.35.0 [110/65] via 10.10.0.5, 00:35:05, FastEthernet0/0

[110/65] via 10.10.0.3, 00:35:05, FastEthernet0/0

R4#

Looking at the topology, R4, which is a backbone router, has different types of routes in the routing table. The ones that start with O are intra area routes, like for instance, the loopback address of R5 (5.5.5.5). The others that start with O IA are inter-area routes and they belong to an area other than R4, for instance, the loopback address of R1 (1.1.1.1).You won’t find any inter-area routes on R3 because it’s an ABR; that is, it belongs to both Area 0 and Area 1.

The following is a summary of what we discussed:

OSPF is a link-state protocol that use area hierarchy to reduce the memory usage and CPU processing to achieve faster convergence. OSPF exchanges hello packets to discover, establish and maintain neighbor adjacencies between routers. Each OSPF enabled router must be uniquely identified in the network based on its Router ID(RID). Use administrative configuration to set this parameter or use a loopback interface to keep the Router ID unaffected by physical interfaces flaps. The ‘show ip ospf neighbor’ command display information about OSPF neighbors.

In the second part of the article we will see the detailed configuration of how:

Router ID can be configured To change hello and dead intervals timers To configure authentication To change cost of the links To configure load-balancing

References:

