Upon startup the router will learn about the directly connected networks, this is done by sending a hello message to each of the neighboring routers. After learning about the directly connected routers, devices form a Link State Packet (LSP - a packet that contains the state of each link) and then flood all neighboring routers with it. Upon receiving the LSP packet, a router builds it's own network topology in which all links are stored. A big advantage of link-state routing protocols is the fast speed of converge. Because these protocols tend to use a big percent of the network resources (CPU, memory, bandwidth, etc.), networks are divided into multiple areas.
In this post we will focus on the OSPF protocol, one of the well known link-state protocols used in today's networks. Like other routing protocols, OSPF uses it's own elements: the 89 port number, the 22.214.171.124 and 126.96.36.199 multicast IP addresses, the 01-00-5E-00-00-05 and 01-00-5E-00-00-06 MAC addresses. Just like EIGRP, OSPF supports authentication and encryption of network messages. The administrative distance of OSPF is 110.
Before exchanging messages, routers must agree on three elements that they will use: the network type, the Hello interval and the dead interval. As an administrator you have the possibility to configure these elements, but by default the hello interval is set to 30 seconds on NBMA networks (non-broadcast multiacces networks) and 10 seconds to multiaccess networks. The dead interval is a value that measures the time a router must wait before setting a link in the "down" state. A link that is in the "down" state will be ignored by other routers and will not participate in the routing mechanism.
As I've told you earlier, OSPF uses specific types of messages that are sent across networks:
Hello - used for discovering neighboring routers
Link-State Request (LSR) - a OSPF request message
Link-State Update (LSU) - OSPF update message. Remember that this type of message has different Link-State Advertisments (LSAs). A LSA is an advertisment that specifies what kind of LSU packet the router has sent/received (a network LSA, a router LSA, a summary LSA, etc.). Read more about LSAs on this article from Wikipedia: http://en.wikipedia.org/wiki/Link-state_advertisement.
Link-State Acknowledgement (LSAck) - confirms that a packet has been received
Database Description (DBD) - used for database syncronization.
I've written earlier that OSPF uses the overall cost of links from source to destination, to determine the best path that packets must follow. This cost is actually the metric element used by all dynamic routing protocols. OSPF will calculate the costs based on two elements: the link's bandwidth and the reference bandwidth. The protocol uses the following formula:
10^8/link's bandiwdth. The 10^8 is the reference bandwidth (the reference bandwidth can be changed unsing the auto-cost reference-bandwidth command). For example, Fast Ethernet will have the cost of 10^8/100000000 bps =1, T1 will have the cost of 10^8/1544000 bps=64, 56 kbps will have the cost of 10^8/56000 bps=1785. As you can see, the better the link's bandwidth, the lower the cost. OSPF will always use the lowest cost on a link.
To enable OSPF on a Cisco router, type router ospf ID. The ID is local significance only, unlike EIGRP, the OSPF id don't have to be the same to all routers in the network. I will use the 123 ID to specify the OSPF process:
As you can see from the image, you will have to configure an interface in order to start the OSPF process. After configuring the OSPF process, add the directly connected networks by using the network command. This command is different from other routing protocols, you will have to use the wildcard mask and the area id:
One unique element of OSPF is the router ID, this is used for identifying all routers that participate in the OSPF process. This is actually an IP address but has nothing to do with the networking protocol, it is simply used for identifying devices in the OSPF mechanism The router ID can be configured by using the router-id command:
To distribute the default route to all routers in the network, use the default-information originate command. First, add a static configured route then enter the desired OSPF process and execute the command:
If the router's ID was not configured with this command, OSPF will choose the highest IP address from the router's loopack interfaces. If there is no loopback interface configured, the highest IP address from the physical interfaces will be chosen. To verify your OSPF configuration, use the same command you are already used with, the show ip protocols command:
Some new commands that are used only by OSPF are: show ip ospf neighbor, show ip ospf, show ip ospf interface. Check each one of these commands to see their output. In OSPF, Administrators can change the hello and dead intervals times by using the following commands:
Router(config-if)#ip ospf hello-interval [seconds] and Router(config-if)#ip ospf dead-interval [seconds]:
Another way to change the link's cost, is to type the ip ospf cost [number] command from the interface configuration mode:
In a multiaccess network, there is a possibility that the LSAs packets will flood the network, increasing the network traffic. To address this issue, two elements were introduces the DR (Designated Router) and the DBR (Backup Designated Router). OSPF will choose the DR and BDR based on the router's priority. To change a router's priority in the OSPF process, type the ip ospf priority [number] command in the interface configuration mode. The priority is a number from 0 to 255:
The router with the highest priority will be chosen as DR and the BDR will be the router with the second highest priority. If routers have the same priority number, OSPF will choose DR and BDR based on the highest ID.
OK folks, I hope I've covered all the important aspects of OSPF. If you think there is something more to add here just leave a comment. Also, remember that I will make a video tutorial on how to configure OSPF. Have a nice day and stay tuned for more articles to come.