Open Shortest Path First
OSPF is a classless link state routing protocol. It supports VLSM. OSPF introduces a concept known as areas that group routers together telling them who to share routing updates with. OSPF always has an area 0 and every other area must connect to area 0. The CCNA exam is focused on single area OSPF so we will only be working with area 0.
Topological Database
OSPF collects networking information for all the networks in the same area as it and builds a databae called the Topological database. It then runs the Shortest Path First (SPF) algorithm on the database to determine the best route to each network.
Neighbor Database
OSPF also maintains another table called the Neighbor table. This table is responsible for keeping track of all the neighbors that the router has received hello packets from. This database can be used to obtain information on neighbors.
Designated Router(DR) and Backup Designated Router(BDR)
OSPF uses the concepts of Designated and Backup Designated router as a central point for routers to exchange information. The DR and BDR are elected on multi-access segments. When a network with 3 or more routers connected to a multi-access segment is running OSPF the DR is elected and every other router receives topology information from the DR. The BDR is there to take the place of the DR if it should go down.
DR and BDR Election Process
There are 2 settings that determine which routers will become DR and BDR. These settings are -
Priority # can be set in the routers configuration and we will go over that when we configure OSPF.
Router ID is determined by one of two things -
As you can see we have a few different options to manipulate the outcome of the DR and BDR election, and we'll go over this more when we configure OSPF.
- Priority # - Routers with the highest priority number on the segment will become DR.
- Router ID - If all routers have the same priority then the router with the highest router ID becomes the DR.
Priority # can be set in the routers configuration and we will go over that when we configure OSPF.
Router ID is determined by one of two things -
- Is there any loopback interfaces? If so the highest IP address on a loopback interface is the router ID.
- If there is no loopback interface then the router ID is determined by the highest IP address on any interface.
As you can see we have a few different options to manipulate the outcome of the DR and BDR election, and we'll go over this more when we configure OSPF.
Wildcard Mask
Previously when we configured RIP with routes we simply entered the 'network' command followed by a classful network address. With OSPF the 'network' command requires a wildcard mask and an area number. A wildcard mask is used to indicate the size of a subnet. For example, if we have an network with the IP 192.168.1.0/24 we know that a /24 is a default mask for a class C and isn't subnetted. So there is one network, and it ranges from 192.168.1.0 - 192.168.1.255, we could use a wildcard mask to represent this as 0.0.0.255. This wildcard mask means that every bit in the 4th octet is in the subnet that we want OSPF to route.
Let's take another example, but this time let's use a subnetted network, 192.168.1.0/26. Well we know that we borrowed 2 bits from the 4th octet to subnet with, leaving us with 6 bits left for host addresses. So we need a wildcard mask to tell OSPF that we only want to route for the hosts in this subnet. There are a few ways to come up with this answer, the first I'll show you is to invert the subnet mask. A /26 mask in binary is as follows -
11111111.11111111.11111111.11000000
If we invert the subnet mask we get
00000000.00000000.00000000.00111111
Which converted to decimal is 0.0.0.63. There is an easier way to get the wildcard mask though. If we find the range of addresses that the subnet mask provide, a /26 gives a range of 64, and simply subtract 1 and that gives you the wildcard mask. So a 10.1.1.0/19 network needs a wildcard mask, we simply figure out the range of addresses a /19 provides, which is 32 and subtract 1. Our wildcard mask would be 0.0.31.255, since we're subnetting in the 3rd octet and not the 4th.
Now that we have a basic understanding of OSPF let's go ahead and convert our old network over to OSPF.
Let's take another example, but this time let's use a subnetted network, 192.168.1.0/26. Well we know that we borrowed 2 bits from the 4th octet to subnet with, leaving us with 6 bits left for host addresses. So we need a wildcard mask to tell OSPF that we only want to route for the hosts in this subnet. There are a few ways to come up with this answer, the first I'll show you is to invert the subnet mask. A /26 mask in binary is as follows -
11111111.11111111.11111111.11000000
If we invert the subnet mask we get
00000000.00000000.00000000.00111111
Which converted to decimal is 0.0.0.63. There is an easier way to get the wildcard mask though. If we find the range of addresses that the subnet mask provide, a /26 gives a range of 64, and simply subtract 1 and that gives you the wildcard mask. So a 10.1.1.0/19 network needs a wildcard mask, we simply figure out the range of addresses a /19 provides, which is 32 and subtract 1. Our wildcard mask would be 0.0.31.255, since we're subnetting in the 3rd octet and not the 4th.
Now that we have a basic understanding of OSPF let's go ahead and convert our old network over to OSPF.