Open Shortest Path First (OSPF) is widely deployed in networks throughout the world, and its successor OSPFv3 is taking over the same segment with IPv6. Given that, OSPF will be around for some time. The concepts behind both versions of OSPF are very similar. Because of this, only OSPFv2 (IPv4) will be used for examples in this article, in which I’ll go over the basics of OSPF configuration.
There are a couple of things that need to be known by every entry level network engineer about OSPF, as it is implemented on Cisco equipment, these include:
- OSPF (both v2 and v3) has an administrative distance of 110. (This is trusted more than RIP but less than EIGRP).
- OSPF can be configured into different administrative areas that are used to maintain routing efficiency.
- A central area 0 (Backbone) must exist in the center of the OSPF network with every other area having a direct connection to this area (either physically or logically [virtual link]).
- OSPF is a classless protocol and fully supports Virtual Length Subnet Masking [VLSM – with IPv4]).
- OSPF is standards based (IPv4 – RFC 2328, 5709; IPv6 – RFC5340, 6845, 6860).
- OSPF advertises routing information via Link State Advertisements (LSA).
- OSPF Hello and Dead intervals must match.
- OSPF Router-ID (RID) must be unique.
- OSPF Areas must match.
- OSPF Authentication parameters must match.
For IPv4 Neighborships
- OSPF neighbors must be in the same IPv4 subnet
For IPv6 Neighborships
- OSPF Neighbors DON’T have to be in the same IPv6 prefix range (OSPFv3 uses the link local addresses to communicate).
Configuring OSPFv2 (IPv4)
The typical configuration of OSPF on a Cisco device is rather simple, assuming that the IPv4 addressing has been configured correctly (connecting interface subnet’s match). For the purposes of this example, the topology shown in Figure 1 will be used.
To be thorough for this section, both the IP address configuration and the OSPF configuration steps will be shown. The configuration of R2 is assumed complete for the purposes of this section with a single area of 0 being used.
The first step involves the configuration of the IPv4 addresses on the appropriate interfaces; these are shown below in Table 1.
|1||Enter global configuration mode||R1#configure terminal|
|2||Enter interface configuration more for the FastEthernet0/0 interface||R1(config)#interface fastetherent0/0|
|3||Configure the IPv4 Address as specified in Figure 1||R1(config-if)#ip address 220.127.116.11 255.255.255.0|
|4||Enable the interface||R1(config-if)#no shutdown|
|5||Enter interface configuration more for the FastEthernet0/1 interface||R1(config)#interface fastetherent0/1|
|6||Configure the IPv4 Address as specified in Figure 1||R1(config-if)#ip address 10.10.10.1 255.255.255.0|
|7||Enable the interface||R1(config-if)#no shutdown|
The second step involves the configuration of the OSPF process on the router and the configuration of the interfaces that will be included in the OSPF process. With OSPFv2 this is typically done by specifying a specific range of IP network addresses using a wildcard mask.
|8||Enter OSPF router configuration modeNote: For this example a process-id of ‘10’ is used||R1(config-if)#router ospf 10|
|9||Configure a network range that will specify the interfaces to be included within the OSPF process.Note: This matches all interfaces that would have an IP address assigned between 10.10.10.0 and 10.10.10.255.||R1(config-router)#network 10.10.10.0 0.0.0.255 area 0|
|10||Configure a network range that will specify the interfaces to be included within the OSPF processNote: This matches all interfaces that would have an IP Address assigned between 18.104.22.168 and 22.214.171.124||R1(config-router)#network 126.96.36.199 0.0.0.255 area 0|
This completes the configuration that would be required on R1 to have the neighborship between R1 and R2 established. Often the biggest hurdle for those new to networking (and Cisco networking specifically) is the logic behind a wildcard netmask. A wildcard netmask basically works in the opposite way that a common subnet mask does. A common subnet mask is used to mask the network and subnetwork bits from the host bits, e.g. 10.10.10.0 255.255.255.0. The first 24 bits are masked off for network and subnetwork bits while the eight remaining are used for host address space. In this case, the network and subnetwork bits do not change for any of the hosts within the same network (broadcast domain). A wildcard mask is used to mask the part of the address that is permitted to change (basically the opposite of what was just described) – e.g., 10.10.10.0 0.0.0.255 will match all addresses that start with 10.10.10 and the fourth octet (the last eight bits) can be any value.
It is very common for many people getting into Cisco networking (especially those new to networking) to wonder why engineers don’t just implement Cisco’s Enhanced Interior Gateway Routing Protocol (EIGRP), as it can be considerably easier to configure. The basic answer to this is that EIGRP is Cisco proprietary, and it is not supported across vendors. This isn’t a problem if the company is small enough or has committed to a complete Cisco solution, but if the company is very large and is not Cisco-centric, a standard basic solution like OSPF works across various vendors products.