Link-state routing protocols are a more complex category of dynamic routing protocols. These type of protocols use a different approach when interacting with network resources. Devices that run a link state routing protocol share a network topology end each one plays an important role in selecting the best routes. Routers exchange their directly connected links to all other routers in the network hence the name link state routing protocols. A “link” is actually a router interface that is in the state of “up” (IP address and network mask are assigned and the “no shutdown” command is executed) and is included in the routing process. Each router has it’s own network topology used for updating routing information. There are two main link-state routing protocols, Open Shortest Path First (OSPF) and Intermediate System-to-Intermediate System (IS-IS). Link-state protocols are based on the Dijkstra’s algorithm, this algorithm is also known as the shortest path first (SPF) algorithm. The concept is pretty simple, each link receives a cost and by summing all the costs from source to destination, the best path is chosen. A router connected to a network that runs a link state routing protocol will take the following steps:
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:
Administrators can modify the cost of a link by changing the link’s bandwidth, to do this use the bandwidth [kbps] command, from the interface configuration mode: