- Objectives
- Key Terms
- Introduction (3.0.1.1)
- Dynamic Routing Protocols (3.1)
- Dynamic versus Static Routing (3.1.2)
- Routing Protocol Operating Fundamentals (3.1.3)
- Types of Routing Protocols (3.1.4)
- Distance Vector Dynamic Routing (3.2)
- Types of Distance Vector Routing Protocols (3.2.2)
- RIP and RIPng Routing (3.3)
- Link-State Dynamic Routing (3.4)
- The Routing Table (3.5)
- Summary (3.6)
- Practice
- Check Your Understanding Questions
Link-State Dynamic Routing (3.4)
Distance vector routing protocols are thought to be simple to understand, whereas link-state routing protocols have the reputation of being very complex, even intimidating. However, link-state routing protocols and concepts are not difficult to understand. In many ways, the link-state process is simpler to understand than distance vector concepts.
Link-State Routing Protocol Operation (3.4.1)
This section describes the characteristics, operations, and functionality of link-state routing protocols. Understanding the operation of link-state routing is critical to enabling, verifying, and troubleshooting these protocols.
Shortest Path First Protocols (3.4.1.1)
Link-state routing protocols are also known as shortest path first protocols and are built around Edsger Dijkstra’s shortest path first (SPF) algorithm. The SPF algorithm is discussed in more detail in a later section.
The IPv4 link-state routing protocols are shown Figure 3-35:
- Open Shortest Path First (OSPF)
Intermediate System-to-Intermediate System (IS-IS)
Figure 3-35 Link-State Routing Protocols
Link-state routing protocols have the reputation of being much more complex than their distance vector counterparts. However, the basic functionality and configuration of link-state routing protocols is equally straightforward.
Just like RIP and EIGRP, basic OSPF operations can be configured using the:
- router ospf process-id global configuration command
- network command to advertise networks
Dijkstra’s Algorithm (3.4.1.2)
All link-state routing protocols apply Dijkstra’s algorithm to calculate the best path route. The algorithm is commonly referred to as the shortest path first (SPF) algorithm. This algorithm uses accumulated costs along each path, from source to destination, to determine the total cost of a route.
In Figure 3-36, each path is labeled with an arbitrary value for cost.
Figure 3-36 Dijkstra’s Shortest Path First Algorithm
The cost of the shortest path for R2 to send packets to the LAN attached to R3 is 27. Specifically, the cost is R2 to R1 (20) plus R1 to R3 (5) plus R3 to LAN (2). Each router determines its own cost to each destination in the topology. In other words, each router calculates the SPF algorithm and determines the cost from its own perspective.
SPF Example (3.4.1.3)
The table in Figure 3-37 displays the shortest path and the accumulated cost to reach the identified destination networks from the perspective of R1.
Figure 3-37 R1 SPF Tree
The shortest path is not necessarily the path with the least number of hops. For example, look at the path to the R5 LAN. It might be assumed that R1 would send directly to R4 instead of to R3. However, the cost to reach R4 directly (22) is higher than the cost to reach R4 through R3 (17).
Observe the shortest path for each router to reach each of the LANs, as shown in Tables 3-8 through 3-11.
Table 3-8 R2 SPF Tree
Destination |
Shortest Path |
Cost |
R1 LAN |
R2 to R1 |
22 |
R3 LAN |
R2 to R1 to R3 |
27 |
R4 LAN |
R2 to R5 to R4 |
22 |
R5 LAN |
R2 to R5 |
12 |
Table 3-9 R3 SPF Tree
Destination |
Shortest Path |
Cost |
R1 LAN |
R3 to R1 |
7 |
R2 LAN |
R3 to R1 to R2 |
27 |
R4 LAN |
R3 to R4 |
12 |
R5 LAN |
R3 to R4 to R5 |
22 |
Table 3-10 R4 SPF Tree
Destination |
Shortest Path |
Cost |
R1 LAN |
R4 to R3 to R1 |
17 |
R2 LAN |
R4 to R5 to R2 |
22 |
R3 LAN |
RR4 to R3 |
12 |
R5 LAN |
R4 to R5 |
12 |
Table 3-11 R5 SPF Tree
Destination |
Shortest Path |
Cost |
R1 LAN |
R5 to R4 to R3 to R1 |
27 |
R2 LAN |
R5 to R2 |
12 |
R3 LAN |
R5 to R4 to R3 |
22 |
R4 LAN |
R5 to R4 |
12 |
Link-State Updates (3.4.2)
Link-state updates (LSUs) are the packets used for OSPF routing updates. This section discusses how OSPF exchanges LSUs to discover the best routes.
Link-State Routing Process (3.4.2.1)
So exactly how does a link-state routing protocol work? With link-state routing protocols, a link is an interface on a router. Information about the state of those links is known as link-states.
All routers in an OSPF area will complete the following generic link-state routing process to reach a state of convergence:
- Each router learns about its own links and its own directly connected networks. This is done by detecting that an interface is in the up state.
- Each router is responsible for meeting its neighbors on directly connected networks. Link-state routers do this by exchanging Hello packets with other link-state routers on directly connected networks.
- Each router builds a link-state packet (LSP)containing the state of each directly connected link. This is done by recording all the pertinent information about each neighbor, including neighbor ID, link type, and bandwidth.
- Each router floods the LSP to all neighbors. Those neighbors store all LSPs received in a database. They then flood the LSPs to their neighbors until all routers in the area have received the LSPs. Each router stores a copy of each LSP received from its neighbors in a local database.
- Each router uses the database to construct a complete map of the topology and computes the best path to each destination network. Like having a road map, the router now has a complete map of all destinations in the topology and the routes to reach them. The SPF algorithm is used to construct the map of the topology and to determine the best path to each network.
Link and Link-State (3.4.2.2)
The first step in the link-state routing process is that each router learns about its own links, its own directly connected networks. When a router interface is configured with an IP address and subnet mask, the interface becomes part of that network.
Refer to the topology in Figure 3-38. For purposes of this discussion, assume that R1 was previously configured and had full connectivity to all neighbors. However, R1 lost power briefly and had to restart.
Figure 3-38 R1 Links
During boot up R1 loads the saved startup configuration file. As the previously configured interfaces become active, R1 learns about its own directly connected networks. Regardless of the routing protocols used, these directly connected networks are now entries in the routing table.
As with distance vector protocols and static routes, the interface must be properly configured with an IPv4 address and subnet mask, and the link must be in the up state before the link-state routing protocol can learn about a link. Also, like distance vector protocols, the interface must be included in one of the network router configuration statements before it can participate in the link-state routing process.
Figure 3-38 shows R1 linked to four directly connected networks:
- FastEthernet 0/0: 10.1.0.0/16
- Serial 0/0/0: 10.2.0.0/16
- Serial 0/0/1: 10.3.0.0/16
- Serial 0/1/0: 10.4.0.0/16
As shown in Figures 3-39 through 3-42, the link-state information includes:
- The interface’s IPv4 address and subnet mask
- The type of network, such as Ethernet (broadcast) or Serial point-to-point link
- The cost of that link
Any neighbor routers on that link
Figure 3-39 Link-State of Interface Fa0/0
Figure 3-40 Link-State of Interface S0/0/0
Figure 3-41 Link-State of Interface S0/0/1
Figure 3-42 Link-State of Interface S0/1/0
Say Hello (3.4.2.3)
The second step in the link-state routing process is that each router is responsible for meeting its neighbors on directly connected networks.
Routers with link-state routing protocols use a Hello protocol to discover any neighbors on their links. A neighbor is any other router that is enabled with the same link-state routing protocol.
In Figure 3-43, R1 sends Hello packets out its links (interfaces) to discover if there are any neighbors.
Figure 3-43 R1 Sends Hello Packets
In Figure 3-44, R2, R3, and R4 reply to the Hello packet with their own Hello packets because these routers are configured with the same link-state routing protocol. There are no neighbors out the FastEthernet 0/0 interface. Because R1 does not receive a Hello on this interface, it does not continue with the link-state routing process steps for the FastEthernet 0/0 link.
Figure 3-44 R2, R3, and R4 Reply with Hello Packets
When two link-state routers learn that they are neighbors, they form an adjacency. These small Hello packets continue to be exchanged between two adjacent neighbors and serve as a keepalive function to monitor the state of the neighbor. If a router stops receiving Hello packets from a neighbor, that neighbor is considered unreachable and the adjacency is broken.
Building the Link-State Packet (3.4.2.4)
The third step in the link-state routing process is that each router builds an LSP containing the state of each directly connected link.
After a router has established its adjacencies, it can build its LSPs that contain the link-state information about its links. A simplified version of the LSP from R1 displayed in Figure 3-45 would contain the following:
- R1; Ethernet network 10.1.0.0/16; Cost 2
- R1 -> R2; Serial point-to-point network; 10.2.0.0/16; Cost 20
- R1 -> R3; Serial point-to-point network; 10.3.0.0/16; Cost 5
R1 -> R4; Serial point-to-point network; 10.4.0.0/16; Cost 20
Figure 3-45 Building the LSP
Flooding the LSP (3.4.2.5)
The fourth step in the link-state routing process is that each router floods the LSP to all neighbors, who then store all LSPs received in a database.
Each router floods its link-state information to all other link-state routers in the routing area as shown in Figure 3-46.
Figure 3-46 R1 Floods Its LSP
Whenever a router receives an LSP from a neighboring router, it immediately sends that LSP out all other interfaces except the interface that received the LSP. This process creates a flooding effect of LSPs from all routers throughout the routing area.
In the animation, the LSPs are flooded almost immediately after being received without any intermediate calculations. Link-state routing protocols calculate the SPF algorithm after the flooding is complete. As a result, link-state routing protocols reach convergence very quickly.
Remember that LSPs do not need to be sent periodically. An LSP only needs to be sent:
- During initial startup of the routing protocol process on that router (e.g., router restart)
- Whenever there is a change in the topology (e.g., a link going down or coming up, a neighbor adjacency being established or broken)
In addition to the link-state information, other information is included in the LSP, such as sequence numbers and aging information, to help manage the flooding process. This information is used by each router to determine if it has already received the LSP from another router or if the LSP has newer information than what is already contained in the link-state database. This process allows a router to keep only the most current information in its link-state database.
Building the Link-State Database (3.4.2.6)
The final step in the link-state routing process is that each router uses the database to construct a complete map of the topology and computes the best path to each destination network.
Eventually, all routers receive an LSP from every other link-state router in the routing area. These LSPs are stored in the link-state database.
Table 3-12 displays the link-state database content of R1.
Table 3-12 Link-State Database
R1 Link-states: Connected to network 10.1.0.0/16, cost = 2 Connected to R2 on network 10.2.0.0/16, cost = 20 Connected to R3 on network 10.2.0.0/16, cost = 5 Connected to R4 on network 10.3.0.0/16, cost = 20 |
R2 Link-states: Connected to network 10.5.0.0/16, cost = 2 Connected to R1 on network 10.2.0.0/16, cost = 20 Connected to R5 on network 10.9.0.0/16, cost = 10 |
R3 Link-states: Connected to network 10.6.0.0/16, cost = 2 Connected to R1 on network 10.3.0.0/16, cost = 5 Connected to R4 on network 10.7.0.0/16, cost = 10 |
R4 Link-states: Connected to network 10.8.0.0/16, cost = 2 Connected to R1 on network 10.4.0.0/16, cost = 20 Connected to R3 on network 10.7.0.0/16, cost = 10 Connected to R5 on network 10.10.0.0/16, cost = 10 |
R5 Link-states: Connected to network 10.11.0.0/16, cost = 2 Connected to R2 on network 10.9.0.0/16, cost = 10 Connected to R4 on network 10.10.0.0/16, cost = 10 |
As a result of the flooding process, R1 has learned the link-state information for each router in its routing area. Notice that R1 also includes its own link-state information in the link-state database.
With a complete link-state database, R1 can now use the database and the shortest path first (SPF) algorithm to calculate the preferred path or shortest path to each network, resulting in the SPF tree.
Building the SPF Tree (3.4.2.7)
Each router in the routing area uses the link-state database and SPF algorithm to construct the SPF tree.
For example, using the link-state information from all other routers, R1 can now begin to construct an SPF tree of the network. To begin, the SPF algorithm interprets each router’s LSP to identify networks and associated costs.
The SPF algorithm then calculates the shortest paths to reach each individual network, resulting in the SPF tree as shown in Figure 3-47. R1 now has a complete topology view of the link-state area.
Figure 3-47 Resulting SPF Tree of R1
Each router constructs its own SPF tree independently from all other routers. To ensure proper routing, the link-state databases used to construct those trees must be identical on all routers.
Adding OSPF Routes to the Routing Table (3.4.2.8)
Using the shortest path information determined by the SPF algorithm, these paths can now be added to the routing table. Figure 3-48 shows the routes that have now been added to R1’s IPv4 routing table.
Figure 3-48 Populate the Routing Table
The routing table also includes all directly connected networks and routes from any other sources, such as static routes. Packets are now forwarded according to these entries in the routing table.
Why Use Link-State Routing Protocols? (3.4.3)
This section discusses the advantages of using link-state routing protocols and compares the two types of link-state routing protocols.
Why Use Link-State Protocols? (3.4.3.1)
There are several advantages of link-state routing protocols compared to distance vector routing protocols.
- Builds a topological map: Link-state routing protocols create a topological map, or SPF tree of the network topology. Because link-state routing protocols exchange link-states, the SPF algorithm can build an SPF tree of the network. Using the SPF tree, each router can independently determine the shortest path to every network.
- Fast convergence: When receiving an LSP, link-state routing protocols immediately flood the LSP out all interfaces except for the interface from which the LSP was received. In contrast, RIP needs to process each routing update and update its routing table before flooding the routing update out other interfaces.
- Event-driven updates: After the initial flooding of LSPs, link-state routing protocols only send out an LSP when there is a change in the topology. The LSP contains only the information regarding the affected link. Unlike some distance vector routing protocols, link-state routing protocols do not send periodic updates.
- Hierarchical design: Link-state routing protocols use the concept of areas. Multiple areas create a hierarchical design to networks, allowing for better route aggregation (summarization) and the isolation of routing issues within an area.
Link-state protocols also have a few disadvantages compared to distance vector routing protocols:
- Memory requirements: Link-state protocols require additional memory to create and maintain the link-state database and SPF tree.
- Processing requirements: Link-state protocols can also require more CPU processing than distance vector routing protocols. The SPF algorithm requires more CPU time than distance vector algorithms such as Bellman-Ford, because link-state protocols build a complete map of the topology.
- Bandwidth requirements: The flooding of link-state packets can adversely affect the available bandwidth on a network. This should only occur during initial startup of routers, but can also be an issue on unstable networks.
Link-State Protocols Support Multiple Areas (3.4.3.2)
Modern link-state routing protocols are designed to minimize the effects on memory, CPU, and bandwidth. The use and configuration of multiple areas can reduce the size of the link-state databases. Multiple areas can also limit the amount of link-state information flooding in a routing domain and send LSPs only to those routers that need them. When there is a change in the topology, only those routers in the affected area receive the LSP and run the SPF algorithm. This can help isolate an unstable link to a specific area in the routing domain.
For example, in Figure 3-49, there are three separate routing domains: area 1, area 0, and area 51.
Figure 3-49 Create Areas to Minimize Router Resource Usage
If a network in area 51 goes down, the LSP with the information about this downed link is only flooded to other routers in that area. Only those routers in area 51 need to update their link-state databases, rerun the SPF algorithm, create a new SPF tree, and update their routing tables. Routers in other areas learn that this route is down, but this is done with a type of LSP that does not cause them to rerun their SPF algorithm. Routers in other areas can update their routing tables directly.
Protocols that Use Link-State (3.4.3.3)
There are only two link-state routing protocols, OSPF and IS-IS.
Open Shortest Path First (OSPF) is the most popular implementation. It was designed by the Internet Engineering Task Force (IETF) OSPF Working Group. The development of OSPF began in 1987 and there are two current versions in use:
- OSPFv2: OSPF for IPv4 networks (RFC 1247 and RFC 2328)
- OSPFv3: OSPF for IPv6 networks (RFC 2740)
IS-IS was designed by International Organization for Standardization (ISO) and is described in ISO 10589. The first incarnation of this routing protocol was developed at Digital Equipment Corporation (DEC) and is known as DECnet Phase V. Radia Perlman was the chief designer of the IS-IS routing protocol.
IS-IS was originally designed for the OSI protocol suite and not the TCP/IP protocol suite. Later, Integrated IS-IS, or Dual IS-IS, included support for IP networks. Although IS-IS has been known as the routing protocol used mainly by ISPs and carriers, more enterprise networks are beginning to use IS-IS.
OSPF and IS-IS share many similarities and also have many differences. There are many pro-OSPF and pro-IS-IS factions who discuss and debate the advantages of one routing protocol over the other. Both routing protocols provide the necessary routing functionality.