You are on page 1of 13

Introduction to Link State Routing Protocols | What is Link

State Routing Protocols


Link state routing protocols maintain complete road map of the network in each router running
a link state routing protocol. Each router running a link state routing protocol originates
information about the router, its directly connected links, and the state of those links. This
information is sent to all the routers in the network as multicast messages. Link-state routing
always try to maintain full networks topology by updating itself incrementally whenever a
change happen in network.

Each router in the network keeps a copy of it, without changing it. After obtaining the
complete picture of network topology, each router will independently calculate its own best
paths to reach the destination networks.

Link state protocols are based on Shortest Path First (SPF) algorithm to find the best path to a
destination. Shortest Path First (SPF) algorithm is also known as Dijkstra algorithm, since it is
conceptualized by Dijkstra. In Shortest Path First (SPF) algorithm, whenever a link's state
changes, a routing update called a Link-State Advertisement (LSA) is exchanged between
routers. When a router receives an LSA routing update, the link-state algorithm is used to
recalculate the shortest path to affected destinations. Each router constructs a map of the
complete network. An example of Link State protocol is OSPF (Open Shortest Path First).

Some important terms related with Link State Routing Protocols

• Link-state advertisements (LSAs) – A link-state advertisement (LSA) is a small packet of


routing information that is sent between routers.

• Topological database – A topological database is a collection of information gathered from


LSAs.

• SPF algorithm (Dijkstra algorithm) – The shortest path first (SPF) algorithm is a calculation
performed on the database resulting in the SPF tree.

• Routing tables – A list of the known paths and interfaces.

Link State Routing Protocols converge more quickly and they are less prone to Routing Loops
than Distance Vector Routing Protocols. On the other hand, Link State Routing Protocols
require more CPU power and memory than Distance Vector Routing Protocol algorithms. Link
State Protocols use a hierarchical structure that limits the distance that a Link-State
Advertisement (LSA) need to travel. Link State Protocols use multicasts to share the routing
information. Only the routers which run Link State protocol only process the updates. Link
State routers send updates only when there is a change in the state of the network (incremental
updates).

Link-state algorithms can be more complex and expensive to implement and support.
Introduction to Open Shortest Path First (OSPF) Protocol

The Open Shortest Path First (OSPF) protocol is a link state protocol that handles routing for
IP traffic. Its newest implementation, version 2, which is explained in RFC 2328, is an open
standard. Open Shortest Path First (OSPF) is an open standard (not proprietary) and it will run
on most routers independent of make. Open Shortest Path First (OSPF) uses the Shortest Path
First (SPF) algorithm, developed by Dijkstra, to provide a loop-free topology. Open Shortest
Path First (OSPF) provides fast convergence with triggered, incremental updates via Link State
Advertisements (LSAs). Open Shortest Path First (OSPF) is a classless protocol and allows for
a hierarchical design with VLSM and route summarization.

The main disadvantages of Open Shortest Path First (OSPF) are Open Shortest Path First
(OSPF) requires more memory to hold the adjacency (list of OSPF neighbors), topology (a link
state database containing all of the routers and their routes), and routing tables, Open Shortest
Path First (OSPF) requires extra CPU processing to run the SPF algorithm and Open Shortest
Path First (OSPF) is a complex routing protocol.

The two important concepts in case of OSPF are Autonomous Systems and Areas. Areas are
used to provide hierarchical routing, within an Autonomous System. Areas are used to control
when and how much routing information is shared across your network.

OSPF implements a two-layer hierarchy: the backbone (Area 0) and areas off of the backbone
(Areas 1–65,535). Here the two different areas can summarize routing information between
them. Route summerization helps to compact the routing tables. All areas should connect to
Area 0 and all routers in an Area will have the same topology table.

Important Terms related with Open Shortest Path First (OSPF)

Router ID

Every Router in an OSPF network needs a unique OSPF Router ID. The OSPF Router ID is
used to provide a unique identity to the OSPF Router.

What is a Loopback Interface

A loopback interface is a logical, virtual interface on a router. By default, the router doesn’t
have any loopback interfaces, but they can easily be created. These interfaces are treated as
physical interfaces on a router and we can assign ip addresses to them.

Router(Config)#int loopback 2
Router(Config-if)#ip address 200.0.0.10 255.255.255.0

Area border router (ABR)

An Area border router (ABR) is a router that connects one or more OSPF areas to the main
backbone network. It is considered a member of all areas it is connected to.

Internal router

An Internal Router is a router that has only OSPF neighbour relationships with routers in the
same area.

Backbone router

Backbone Routers are part of the OSPF backbone. This includes all area border routers and
also routers connecting different areas.

Designated Router (DR) and Backup Designated Router (BDR)

A Designated Router (DR) is the router interface elected among all routers on a network
segment, and Backup designated (BDR) is a backup for the Designated Router (DR).
Designated Routers (DRs) are used for reducing network traffic by providing a source for
routing updates. The Designated Router (DR) maintains a complete topology table of the
network and sends the updates to the other routers via multicast. All routers in an area will
form a slave/master relationship with the Designated Router (DR).

How to configure Open Shortest Path First (OSPF) Protocol


If you are not familair with Open Shortest Path First (OSPF) Protocol click the following link
to view an introduction to Open Shortest Path First (OSPF) Protocol.

Open Shortest Path First (OSPF) Protocol Configuration

Router(config)# router ospf process_ID


Router(config-router)# network network_id wildcard_mask area area_#

Note:

Process id: A value in the range 1–65,535 identifies the OSPF Process ID. OSPF Process ID is
a unique number on this router that groups a series of OSPF configuration commands under a
specific running process.
Wildcard Mask: The wildcard mask (wildcard_mask) given above is the inverse mask of the
subnet mask. A 0 octet in the wildcard mask indicates that the corresponding octet in the
network must match exactly. On the other hand, a 255 indicates that you don’t care what the
corresponding octet is in the network number. A network and wildcard mask combination of
192.168.10.0 0.0.0.0 would match 192.168.10.0 only, and nothing else.

Area Number: The area_# given above is the Area Number. Area Number can always be zero
(0) for small networks, but for larger networks, the Area Number need to be properly planned
as all routing updates must traverse Area 0.

Open Shortest Path First (OSPF) Protocol - Lab Practice

The following diagram shows our lab setup. We have three routers, three switches and three
hosts connected as below. The host names, IP addresses and the interfaces of the routers are
shown in diagram. The IP addresses of the hosts are also shown in the diagram.

If you are not familiar with a router console connection, click the following link to learn how
to connect the serial port of your computer to router console port.

Click the following link to learn how to connect to the console port of the router if there is no
serial port in your computer.

Click the following links to learn how to use HyperTerminal terminal emulator and PuTTY
terminal emulator to configure router.
Hostname and IP address configuration in Router01

Connect to Router01 console and use the following IOS commands to configure host name as
Router01.

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router01
Router01(config)#

Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode
on Router01 and configure IP address as 172.16.0.1/16.

Router01>enable
Router01#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router01(config)#interface fa0/0
Router01(config-if)#ip address 172.16.0.1 255.255.0.0
Router01(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/0 configuration mode on
Router01 and configure IP address as 172.17.0.1/16. You have to set a clock rate also using the
"clock rate" command on S0/0 interface, since this is the DCE side.

Router01>enable
Router01#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router01(config)#interface s0/0
Router01(config-if)#clock rate 64000
Router01(config-if)#ip address 172.17.0.1 255.255.0.0
Router01(config-if)#no shutdown

Do remember to run the "copy running-config startup-config" command from enable mode, if
you want to save the changes you have made in the router.

Hostname and IP address configuration in Router02

Connect to Router02 console and use the following IOS commands to configure host name as
Router02.

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router02
Router02(config)#

Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode
on Router02 and configure IP address as 172.18.0.1/16.

Router02>enable
Router02#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router02(config)#interface fa0/0
Router02(config-if)#ip address 172.18.0.1 255.255.0.0
Router02(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/0 configuration mode on
Router02 and configure IP address as 172.17.0.2/16.

Router02>enable
Router02#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router02(config)#interface s0/0
Router02(config-if)#ip address 172.17.0.2 255.255.0.0
Router02(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/1 configuration mode on
Router02 and configure IP address as 172.19.0.1/16. You have to set a clock rate also using the
"clock rate" command on S0/1 interface, since this is the DCE side.

Router02>enable
Router02#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router02(config)#interface s0/1
Router02(config-if)#clock rate 64000
Router02(config-if)#ip address 172.19.0.1 255.255.0.0
Router02(config-if)#no shutdown

Do remember to run the "copy running-config startup-config" command from enable mode, if
you want to save the changes you have made in the router.

Hostname and IP address configuration in Router03

Connect to Router03 console and use the following IOS commands to configure host name as
Router03.

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router03
Router03(config)#

Use the following IOS commands to open the fast ethernet interface Fa0/0 configuration mode
on Router03 and configure IP address as 172.20.0.1/16.

Router03>enable
Router03#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router03(config)#interface fa0/0
Router03(config-if)#ip address 172.20.0.1 255.255.0.0
Router03(config-if)#no shutdown

Use the following IOS commands to open the serial interface S0/1 configuration mode on
Router03 and configure IP address as 172.19.0.2/16.

Router03>enable
Router03#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router03(config)#interface s0/1
Router03(config-if)#ip address 172.19.0.2 255.255.0.0
Router03(config-if)#no shutdown

Do remember to run the "copy running-config startup-config" command from enable mode, if
you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router01

Connect to Router01 console and use the following IOS commands to configure Open Shortest
Path First (OSPF) Protocol in Router01. Please refer the beginning of this lesson to view the
Open Shortest Path First (OSPF) Protocol configuration IOS commands.

Using the IOS "network" command, as shown below, we specify only the directly connected
networks of this router.

Router01>enable
Router01#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router01(config)#router ospf 1
Router01(config-router)#network 172.16.0.0 0.0.255.255 area 0
Router01(config-router)#network 172.17.0.0 0.0.255.255 area 0
Router01(config-router)#exit
Router01(config)#exit
Router01#

Do remember to run the "copy running-config startup-config" command from enable mode, if
you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router02

Connect to Router02 console and use the following IOS commands to configure Open Shortest
Path First (OSPF) Protocol in Router02. Please refer the beginning of this lesson to view the
Open Shortest Path First (OSPF) Protocol configuration IOS commands.

Using the IOS "network" command, as shown below, we specify only the directly connected
networks of this router.
Router02>
Router02>enable
Router02#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router02(config)#router ospf 1
Router02(config-router)#network 172.17.0.0 0.0.255.255 area 0
Router02(config-router)#network 172.18.0.0 0.0.255.255 area 0
Router02(config-router)#network 172.19.0.0 0.0.255.255 area 0
Router02(config-router)#exit
Router02(config)#exit

Do remember to run the "copy running-config startup-config" command from enable mode, if
you want to save the changes you have made in the router.

Open Shortest Path First (OSPF) Protocol configuration in Router03

Connect to Router03 console and use the following IOS commands to configure Open Shortest
Path First (OSPF) Protocol in Router03. Please refer the beginning of this lesson to view the
Open Shortest Path First (OSPF) Protocol configuration IOS commands.

Using the IOS "network" command, as shown below, we specify only the directly connected
networks of this router.

Router03>enable
Router03#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router03(config)#router ospf 1
Router03(config-router)#network 172.19.0.0 0.0.255.255 area 0
Router03(config-router)#network 172.20.0.0 0.0.255.255 area 0
Router03(config-router)#exit
Router03(config)#exit
Router03#

Do remember to run the "copy running-config startup-config" command from enable mode, if
you want to save the changes you have made in the router.

How to view the routing table in Router01

After the initial configuration and Open Shortest Path First (OSPF) Protocol configuration in
all routers, we can use the "show ip route" to view the routing table in Router01, as shown
below.

Router01>enable
Router01#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 172.16.0.0/16 is directly connected, FastEthernet0/0
C 172.17.0.0/16 is directly connected, Serial0/0
O 172.18.0.0/16 [110/65] via 172.17.0.2, 00:26:31, Serial0/0
O 172.19.0.0/16 [110/128] via 172.17.0.2, 00:26:21, Serial0/0
O 172.20.0.0/16 [110/129] via 172.17.0.2, 00:24:54, Serial0/0

The "O" character at the beginning of a line in routing table shows that it is a route discovered
by Open Shortest Path First (OSPF) Protocol and "C" character shows that it is a directly
connected network.

How to view the routing table in Router02

After the initial configuration and Open Shortest Path First (OSPF) Protocol configuration in
all routers, we can use the "show ip route" to view the routing table in Router02, as shown
below.

Router02>enable
Router02#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
O 172.16.0.0/16 [110/65] via 172.17.0.1, 00:30:20, Serial0/0
C 172.17.0.0/16 is directly connected, Serial0/0
C 172.18.0.0/16 is directly connected, FastEthernet0/0
C 172.19.0.0/16 is directly connected, Serial0/1
O 172.20.0.0/16 [110/65] via 172.19.0.2, 00:28:08, Serial0/1

The "O" character at the beginning of a line in routing table shows that it is a route discovered
by Open Shortest Path First (OSPF) Protocol and "C" character shows that it is a directly
connected network.

How to view the routing table in Router03

After the initial configuration and Open Shortest Path First (OSPF) Protocol configuration in
all routers, we can use the "show ip route" to view the routing table in Router03, as shown
below.

Router03>enable
Router03#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
O 172.16.0.0/16 [110/129] via 172.19.0.1, 00:29:43, Serial0/1
O 172.17.0.0/16 [110/128] via 172.19.0.1, 00:29:43, Serial0/1
O 172.18.0.0/16 [110/65] via 172.19.0.1, 00:29:43, Serial0/1
C 172.19.0.0/16 is directly connected, Serial0/1
C 172.20.0.0/16 is directly connected, FastEthernet0/0

The "O" character at the beginning of a line in routing table shows that it is a route discovered
by Open Shortest Path First (OSPF) Protocol and "C" character shows that it is a directly
connected network.

Verify the connectivity between networks using the ping command

To verify the Open Shortest Path First (OSPF) Protocol routes and the connectivity between
networks, run the ping command from Host01 (IP address: 172.16.0.10/16) to Host03 (IP
address: 172.20.0.10/16).

C:\>ping 172.20.0.10

Pinging 172.20.0.10 with 32 bytes of data:

Reply from 172.20.0.10: bytes=32 time=172ms TTL=125


Reply from 172.20.0.10: bytes=32 time=188ms TTL=125
Reply from 172.20.0.10: bytes=32 time=157ms TTL=125
Reply from 172.20.0.10: bytes=32 time=188ms TTL=125

Ping statistics for 172.20.0.10:


Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 157ms, Maximum = 188ms, Average = 176ms

The ping reply from Host03 (IP address: 172.20.0.10/16) shows that the Open Shortest Path
First (OSPF) Protocol is configured well in three routers and there is network connectivity
between different networks.

What is OSPF Metric value Cost and OSPF default Cost


Reference Bandwidth
Open Shortest Path First (OSPF) uses "Cost" as the value of metric and uses a Reference
Bandwidth of 100 Mbps for cost calculation.

The formula to calculate the cost is Reference Bandwidth divided by interface bandwidth. For
example, in the case of 10 Mbps Ethernet , OSPF Metric Cost value is 100 Mbps / 10 Mbps =
10.

The default Reference Bandwidth of OSPF is 100 Mbps and the default OSPF cost formula
doesn’t differentiate between interfaces with bandwidth faster than 100 Mbps. These days, 1
Gbps and 10 Gbps links are also common.

The according to the default OSPF metric Cost value calculation, the default OSPF Cost for
Fast Ethernet interface (100 Mbps) and a Gigabit Ethernet interface (1 Gbps) are same.

If you want to change the default behavior, the cost formula can be adjusted using the "auto-
cost" command under the OSPF routing process. If you are changing the default OSPF
Reference Bandwidth, make sure that you have changed the OSPF Reference Bandwidth in all
your OSPF Routers.

Following table lists OSPF default Cost values for different interface bandwidths.

Bandwidth OSPF Cost


100 Gbps 1
40 Gbps 1
10 Gbps 1
1 Gbps 1
100 Mbps 1
10 Mbps 10
1.544 Mbps 64
768 Kbps 133
384 Kbps 266
128 Kbps 781

What is OSPF Router ID, OSPF Router ID Selection


Algorithm and How to Configure OSPF Router ID
Each Router in an OSPF network needs a unique OSPF Router ID. The OSPF Router ID is
used to provide a unique identity to the OSPF Router.

OSPF Router ID is an IPv4 address (32-bit binary number) assigned to each router running the
OSPF protocol.

OSPF Router ID should not be changed after the OSPF process has been started and the ospf
neighborships are established. If you change the OSPF router ID, we need to either reload the
IOS or use "clear ip ospf process" command, for OSPF Router ID change to take effect.
Reloading the IOS or using "clear ip ospf process" commad can cause temporary network
outage.

OSPF Router ID selection algorithm works as below.

• Any manually configured OSPF Router ID in OSPF Process is selected as the OSPF Router
ID.

• If there is no OSPF Router ID configured, the highest IP address on any of the Routers
Loopback Interfaces is selected as the OSPF Router ID.

• If there is no Loopback Interfaces configured, the highest IP address on its active interfaces is
selected as the OSPF Router ID.

To configure OSPF Route ID in OSPF Process, follow these steps.

omnisecu.com.R1>enable
omnisecu.com.R1#configure terminal
omnisecu.com.R1(config)#router ospf 100
omnisecu.com.R1(config-router)#router-id 1.1.1.1
omnisecu.com.R1(config-router)#exit
omnisecu.com.R1(config)#exit
omnisecu.com.R1#

What is OSPF Area, OSPF Hierarchical Network Design,


and advantages of OSPF Areas
Open Shortest Path First (OSPF) is the recommended IGP for very large enterprise networks.
Entire Open Shortest Path First (OSPF) network can be be divided up into small networks called
OSPF Areas. Open Shortest Path First (OSPF) supports hierarchical network design. Open
Shortest Path First (OSPF) allows the network to be designed in two layer hierarchies. Area 0 at
one layer and all other Areas at other layer.

An Open Shortest Path First (OSPF) Area must be configured as a group of contiguous IP
networks. This allows Route Summerization at Area level.
An OSPF Area is a collection of OSPF routers and networks that share the same Link State
Database. A Router in one OSPF Area doesn't have detailed information about network topology
outside of its area.

Advantages of designing Multi-Area OSPF networks are listed below.

The Routers in same OSPF Area share the same Link State Database (LSDB). The memory and
processor requirement for Link State Database (LSDB) in Routers are less.

Whenever a network topology change happens in a network, the Routers need to re-run the SPF
algorithm to calculate best routes. The SPF algorithm is required to run when the topology
change happens in the same area. Hence OSPF Routers within Area have to run SPF less often.

Manual Route summarization can configured only on ABR and ASBR, which allows the Areas
to exchange summerized routing tables between each other.

You might also like