When you are new to routing and routing protocols terms like OSPF might seem daunting! Let’s break it down so you get a better understanding of it.
What does OSPF stand for? (Open Shortest Path First)
Compared to something like RIP, OSPF can become quite large and complex thanks to “areas”. OSPF uses “Hello” packets to inform neighboring routers of routes. Unlike RIP it only updates entries the other router is missing.
By default OSPF sends a hello message every 10 seconds. If a router misses one of the OSPF messages for 40 seconds (dead timer), the sending router will think the receiving router is down.
In order for OSPF to function correctly you need to make sure that settings match at both ends:
- Subnet Mask
OSPF’s authentication can be in either clear text or MD5. MD5 provides some extra security.
One of the things that makes OSPF so powerful is it’s ability to put things into different areas. Areas allow OSPF to “summarize networks” allowing the router to small routing table. The benefit of smaller routing table is better performance.
Best practices state that you should run “passive-interface default” for the OSPF instance. For each port that you want to send out hello packets you should run a no passive-interface on. This prevents people from trying black hat techniques on your network.
OSPF is essentially turned on and used with two commands under global config mode.
- router ospf 1
- network 192.168.1.1 0.0.0.0 area 0
I will go over each of those two commands:
1.) router ospf 1
There really isn’t much to get tripped up in this command. The last item “1” is the process ID. The router will run OSPF under what ever process number you tell it to. While you can pick any number, most people just pick “1”.
2.) network 192.168.1.1 0.0.0.0 area 0
This command can trip people up. I will break it up into 4 pieces.
- network is the OSPF command that allows you turn on ospf on a certain port(s) of a router:
- 192.168.1.1 can be a network or a particular ip address. Best practice from Cisco states that you should use the ip address of the router interface.
- 0.0.0.0 is the wild card mask of network or ip address. 0.0.0.0 is VERY precise where as 255.255.255.255 is the exact opposite. In this example the router will only send out hello packets out the port that has the ip address of 192.168.1.1. If you were to use 255.0.0.255 the router would allow any interface that has anything in the first and 4th octet. It requires the router to use “.168.1” for octets 2 and 3.
- The last part is “area 0”. You can specify any area here but the router ports connected to each other must use the same area.
There are going to be 4 main troubleshooting commands that you will use:
- show ip ospf neighbor <—Will show you what neighbors you have.
- show ip route <—The lines that have an “O” in them means they learned it from OSPF.
- show ip protocols <—This will show you if OSPF is running.
- debug ip ospf <—This will allow you to see the “hello” packets mentioned earlier or any other info regarding OSPF in real time on the router.
Hope this helps you understand OSPF a bit better!