Open Shortest Path First (OSPF protcol) is an open standards protocol that uses a link state algorithm to calculate the best path to a particular network. It was developed in 1988 by the Internet Engineering Task Force (IETF) to meet the needs of modern networks whose purposes could no longer be served by RIP. It is far more robust and flexible than its distance vector predecessors and is ideally suited for use in modern enterprise networks.
OSPF employs the use of areas to simplify network administration and confine network instability to a specific location. It also allows extensive control of routing updates through several methods that we will examine in this chapter. We cover configuring OSPF in our CCNA course and advanced OSPF in our CCNP course.
OSPF is the standard open routing protocol in use on networks today. Open refers to the fact that it is driven by Dijkstra’s Shortest Path First (SPF) algorithm, which isn’t proprietary to any organization or vendor.
OSPF improves on older protocols by adding features such as:
- No hop-count limitation
- Rapid convergence
- Classless (allows the use of VLSM)
- Password authentication
- Advanced path selection capabilities
- Tagging of external routes
- Better use of bandwidth via multicasts and periodic routing updates
- Allows networks to be divided into smaller logical areas for efficiency
- Uses multicast addresses for efficient and reliable routing update process
- Uses equal-cost load balancing over multiple paths for efficient bandwidth usage
- Supports MD5 authentication for secure route exchange
- No split horizon issues
Overview of the OSPF Protocol
OSPF is a classless routing protocol, and it maps to IP protocol 89. It discovers and maintains a relationship with neighbor routers by multicasting Hello packets and Dead timers. Updates take the form of link state advertisements (LSAs). The link state database is OSPF’s topology table. LSAs flood OSPF areas until each router has a consistent map of the network (i.e., the link state databases all match).
Once the map is consistent, the SPF algorithm is run on the database, and a loop-free path to each network destination is built. This is referred to as the SPF tree. These can be seen in the routing table. An arbitrary metric of cost is used by OSPF when determining the shortest path from A to B.
A simplified view of OSPF is as follows:
- Routers configured with OSPF send Hello packets out of all OSPF-configured interfaces. If the router on the shared link agrees on certain values in the Hello packets, they become neighbors.
- Some neighbors form adjacencies. This depends on the type of OSPF router and network, such as point-to-point or broadcast.
- Link state advertisements are sent over every adjacency. These describe the router links, neighbors, and the link state.
- The received LSA is stored in the router’s link state database, and a copy is sent to all neighbors.
- Each router will build an identical map or link state database.
- Once all routers share the same database, they run the SPF algorithm to calculate the best loop-free path to every destination in the network. Each router considers itself to be the SPF root.
- Each router can now build the routing table.
OSPF Terminology
OSPF was traditionally considered to be a CCNP topic, of which only a reasonable working knowledge was expected. For the CCNA exam, you will be expected to have a good working knowledge of OSPF configuration and troubleshooting for IPv4 for a single area.
A few terms you will need to be familiar with in relation to OSPF are listed below:
- Cost – This is the value OSPF assigns to a link to another router. Cost is used as opposed to hops because it offers far more granularity. The cost is based on the bandwidth of the link. (You can see the default bandwidths in Table 15-1 below.) Cisco routers calculate cost at 108/Bandwidth, rounded down. The bandwidth is either the configured or the default bandwidth of the link.
Table 15-1: OSPF costs per interface
Interface | Cost (108/Bandwidth) |
ATM, Fast Ethernet, Gigabit Ethernet, 10/100 Gbps | 1 |
HSSI (45 Mbps) | 2 |
16 Mbps Token Ring | 6 |
10 Mbps Ethernet | 10 |
4 Mbps Token Ring | 25 |
T1 (1.544 Mbps) | 64 |
DS-0 (64 K) | 1562 |
56 K | 1785 |
Here is the output of a show ip ospf interface X command for an Ethernet interface running at 10 Mbps:
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.1.1/24, Area 0
Process ID 1, Router ID 10.0.0.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 1
Here is an interface running at 100 Mbps:
Router#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet address is 192.168.1.1/24, Area 0
Process ID 1, Router ID 10.0.0.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State BDR, Priority 1
You can manually override the cost on the interface with the ip ospf cost [1-65535] interface command. Remember though that the cost is cumulative, so each interface cost is added across the network. The OSPF cost can be seen with the show ip route command. The cost for the route below is 11, while 110 is the administrative distance for OSPF.
R1#show ip route
172.16.1.1 [110/11] via 192.168.1.2, 00:01:21, FastEthernet0/0
You can check each OSPF interface along the path. The output below shows a Loopback interface with a cost of 1 and a Fast Ethernet interface with a cost of 10, resulting in a total cost of 11:
R2#show ip ospf interface
Loopback0 is up, line protocol is up
Internet Address 172.16.1.1/16, Area 0
Process ID 1, Router ID 192.168.1.2, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.1.2/24, Area 0
Process ID 1, Router ID 192.168.1.2, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State BDR, Priority 1
- Area ID – An OSPF area is a group of routers divided into a subdomain based on an area ID. Every router within the same area shares the same link state information. Areas are identified by a 32-bit area ID. They can be represented either as decimal numbers or as dotted decimals (like IP addresses). Area 0 and Area 0.0.0.0 mean the same thing.
- Link – A link is a connection to another router. The OSPF topology table is referred to as the link state database.
- Link state – This is the state of the link to another router. The link state database consists of a list of the status of the links between routers in the same area.
- Link state database (LSDB) – The LSDB is a list of the link states for other routers in the network. The link state database is essentially the network topology. The database is built from the exchange of LSAs.
- Link state advertisement (LSA) – LSAs are OSPF data packets that contain routing and link state information that is shared between OSPF routers.
- Process ID – This is designated by the router ospf [process id] command, such as router ospf 20. The process ID is needed to identify a unique instance of an OSPF database and is locally significant to the router. The process ID can be any number from 1 to 65,535. The process ID does NOT need to match on neighbor routers (it isn’t the same thing as the EIGRP ASN).
- Router ID (RID) – This will be covered in detail shortly.
- Network type – This is the type of network the OSPF interface connects to. This will be discussed in more detail later.
- Neighbors – Two routers that have interfaces on a common network are considered neighbors. The neighbors are discovered and maintained using the Hello protocol.
- Designated router (DR) – The DR is the central point for the exchange of routing information on a broadcast network. The principle here is to reduce the amount of traffic passing across the shared interface (e.g., an Ethernet interface with five routers). The DR is elected via Hello packets being passed across the area. The router with the highest priority wins; If all the routers have the same priority, then the router with the highest router ID (usually the highest IP address) wins. A backup designated router (BDR) can also be elected to take over if the DR fails.
- Internal router – A router with all directly connected networks belonging to the same area (does not have to be area 0).
- Area border router (ABR) – A router with networks in more than one area.
- Backbone router – A router with an interface in the backbone (area 0).
- AS boundary router (ASBR) – A router that exchanges updates with routers in other autonomous systems.
OSPF routing table entries can be either internal to that area, represented by an “O” in the routing table, or from an ABR, represented by an “O IA”. A third type of entry—O E2—represents routes from an ASBR.
OSPF Router ID
Every router running OSPF has to have a separate identity from the other routers. The router will select its own 32-bit unique ID based on the router’s interface. The unique ID is required in order to easily identify duplicate LSAs and endpoints of virtual links and to determine any tie-breakers between the DR and BDR (primary and secondary update sources, respectively, which will be covered later).
The router will choose the router ID (RID) from the highest IP address on the router or the router’s Loopback address if it has one. The Loopback address will be chosen above any other IP address. You can see this in the output below, where the Loopback address is chosen despite the fact that the address is lower than the Serial interface. If multiple Loopback interfaces are present, the one with the highest IP address is chosen.
The interface from which the RID is taken doesn’t have to be running OSPF or taking part in the OSPF process. Network administrators usually assign a Loopback address because they can then assign a predictable RID and, of course, as a virtual interface it can never go down.
Please note that when the router boots, OSPF will only consider an address for the RID if it is active (i.e., up/up). Once the RID is set, it cannot be changed unless the router is reloaded or the OSPF process is reset (with the clear ip ospf process command).
Router#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0 unassigned YES unset administratively down down
Loopback0 172.16.1.1 YES manual up up
Serial0 192.168.1.1 YES manual up up
Serial1 unassigned YES unset administratively down down
Router#show ip ospf 20
Routing Process ospf 20 with ID 172.16.1.1 OSPF router ID
You can set the RID by configuring the router with a high Loopback address (such as 192.168.100.100) or by using the router-id command, which is a best practice.
Router#config t
Router(config)#router ospf 20
Router(config-router)#router-id 192.168.100.100
OSPF Timers
OSPF uses several timers to control broadcasts, link state propagation, and several other operational factors. The default timers are different, depending on the type of network OSPF is configured on—point-to-point and non-broadcast are two examples. The timers must match if a neighbor relationship is to form between routers running OSPF in the same area. On Routers 1 and 2 below, a neighbor relationship will not form due to mismatched timer values. OSPF timers can be seen with the show ip ospf interface x command, where x is the relevant interface:
Router1#show ip ospf interface Serial0/0
Serial0/0 is down, line protocol is down
Internet Address 192.168.1.1/24, Area 0
Process ID 20, Router ID 192.168.1.2, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State DOWN,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Router2#show ip ospf interface Serial0/0
Serial0/0 is down, line protocol is down
Internet Address 192.168.1.2/24, Area 0
Process ID 20, Router ID 192.168.1.2, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State DOWN,
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
- Hello interval – The default parameter for this timer depends entirely on what type of interface OSPF is operating on. For broadcast interfaces (such as Ethernet), the timer value is 10 seconds, and for Non-Broadcast Multi-Access interfaces (such as Frame Relay), it is 30 seconds. OSPF timers need to match on an interface before a neighbor relationship can be established.
RouterA(config-if)#ip ospf Hello-interval 40
The command above will change the Hello timer to 40 seconds. The Dead and Wait timers will automatically be changed when you change this timer.
- Dead interval – The Dead interval is the time it takes to declare the neighbor dead if there is no Hello. The Dead interval is four times the Hello interval.
RouterA(config-if)#ip ospf dead-interval 240
The command above will change the Dead interval to 240 seconds.
- Retransmit interval – This changes the retransmission interval between neighbors. When OSPF sends an update to a neighbor router, it expects to receive an acknowledgment. If no acknowledgment is heard, a retransmit takes place. The default is 5 seconds.
RouterA(config-if)#ip ospf retransmit-interval 10
The Wait timer is the interval that breaks the wait period and causes the designated router to be selected in the network. This timer is always the same as the Dead timer.
If you simply wanted to remove a timer configuration from an interface so it returns to the default setting, you would add the same configuration line but with a no in front:
RouterA(config-if)#no ip ospf hello-interval 40
OSPF Routes
OSPF operates in different ways depending on the type of link it is configured on, including broadcast, non-broadcast, and point-to-point. Depending on the link type, there may not be a DR/BDR election, and Hello packets may be sent using a different multicast address.
When OSPF is configured on a router, it begins to send Hello packets out of all OSPF interfaces using the multicast address of 224.0.0.5, which is known as the AllSPFRouter address in broadcast and point-to-point networks. In NBMA networks such as Frame Relay, the Hello packet is unicast to specific neighbors.
FIG 15.1 – OSPF multicast packet
The Hello packet differs from the EIGRP Hello in that it actually contains data and is used for data exchange, as you can see in the packet capture below. Information includes sending router ID, area ID, address mask of the sender, authentication type, Hello and Dead intervals of the originating interface, DR and BDR, and other information.
FIG 15.2 – OSPF Hello packet fields
Once the packet has been verified, the two routers form a neighbor relationship. This does not mean that the neighbors will form an adjacency (a virtual link between routers used to send routes). In order for an adjacency to form, the neighbors must agree on parameters such as Hello interval, Dead interval, area ID, password (if used), and authentication type.
Each router will send its link state information to its neighbor, which records it and floods it onward to its current neighbors. All routers then build an identical link state database. A loop-free path to every known route is built, and the local router is known as the root.
OSPF Virtual Links
Cisco warns that the use of virtual links indicates a bad OSPF network design. Virtual links are used to extend area 0 across another area and cater to the rule that all non-zero areas should directly connect to area 0 (the backbone). The virtual link is used to tunnel LSAs through a non-zero area. The area used to transit cannot be a stub area (this will be covered later).
FIG 15.3 – OSPF virtual links
Virtual links rely on fixed Router IDs because the RID value is used in the virtual link configuration.
OSPF Load Balancing
If there is more than one equal path (same cost and administrative distance) to reach a route, then, by default, OSPF will load balance traffic over four paths.
R1#show ip protocols
Routing Protocol is “ospf 1”
Router ID 10.0.0.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.0.0.0 0.0.0.255 area 0
192.168.1.0 0.0.0.255 area 0
[output truncated]This value can be increased but doing so requires careful planning.
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router ospf 1
R1(config-router)#maximum-paths ?
<1-16> Number of paths
OSPF Network Types and Neighbors
OSPF treats its neighbors differently depending on the link types that join them. There are five types for OSPF:
- Point-to-point – An example would be a simple T1 link between two routers or a Frame Relay point-to-point connection. Hellos are multicast to 224.0.0.5 (AllSPFRouters). There is no DR/DBR election on this network type.
FIG 15.4 – OSPF point-to-point network
- Broadcast – Ethernet is the only modern example of this network type. It makes more sense to refer to it as a broadcast multi-access network because several devices can be connected so that they can receive the same packet. A DR/BDR election takes place on this network type, and Hellos are multicast on 224.0.0.5, as are all OSPF packets originated by the DR/BDR. All other routers will multicast updates and acknowledgment packets on 224.0.0.6, also known as AllDRouters.
- NBMA – These include Frame Relay natural or multipoint connections. On this network type, multicast packets are not forwarded correctly to neighbors because there is no broadcast capability. OSPF neighbors must be configured by the administrator on this type of network with the neighbor command under Router(config-router)# mode on DR/BDR. A DR/BDR is elected; however, it should be the hub router (i.e., the one with a circuit to all the other routers).
- Point-to-multipoint – This network type must be defined on NBMA networks by the network administrator. There is no DR/BDR, and OSPF packets are multicast. Although it’s probably outside the CCNA syllabus, if you are configuring this network type, you need to map the remote IP address to the layer 2 address (DLCI for Frame Relay) and add the broadcast keyword so that OSPF can multicast their Hello packets. Although it’s a seemingly insignificant tag, OSPF will not work without it on this network type.
interface Serial0/1
ip address 10.0.0.1 255.255.0.0
encapsulation frame-relay
ip ospf network point-to-multipoint
frame-relay map ip 10.0.0.2 20 broadcast
no frame-relay inverse-arp
Don’t worry about the configuration above. I’m just laying the groundwork for those who want to do more advanced Cisco studies after the CCNA exam. But please do bear in mind that Cisco has a reputation for dropping some fairly advanced questions into the CCNA exam without warning!
- Virtual links – These are used to link areas not directly connected to area 0. These were described briefly above.
Figure 15.5 below shows a simplified version of the network types above. Bear in mind though that some of the interface types are defined by configuration commands rather than physical topology.
FIG 15.5 – OSPF network types
Although this is outside the CCNA syllabus, it’s important to note that unlike EIGRP (for example), OSPF will not tolerate an arbitrary network topology. Implementing OSPF on your network requires very careful topology planning and a well thought out hierarchical IP address scheme.
“[A]bout network topology and route summarization, adopting a hierarchical addressing environment and a structured address assignment are the most important factors in determining the scalability of your internetwork” (©Cisco Press).
Mini-lab – Configuring Single Area OSPF
The physical topology for this mini-lab is shown in Figure 15.6 below:
FIG 15.6 – Mini-lab: Configuring single area OSPF
Configuring OSPF can be a fairly complicated process due to issues with the protocol and the type of interface you are configuring the protocol on. Generally, you need to enable the OSPF process on the router, and then specify which interfaces will run OSPF and which areas those interfaces belong to.
The OSPF process ID is locally significant and need not be the same on all routers within an area or entire network. You can even have more than one OSPF process running on a single router. In real-world networks, many times the OSPF process IDs are kept unique to make troubleshooting an easier task.
OSPF can be configured in two steps for a very simple network (usually with only one area):
- Define OSPF on the router:
Router(config)#router ospf [process-id]
The process ID is an internal number used to identify multiple instances of OSPF running on one router. It is only locally significant, so it doesn’t need to match other routers, and it can be reused on other routers.
- Assign networks to the relevant OSPF area:
Router(config-router)#network address wildcard-mask area [area ID]
- Address – the network address
- Wildcard mask – the inverse of a subnet mask (this was discussed in the ACL section.)
- Area/area ID – the OSPF area you want the interface/network to be in; if you are using more than one area, one of them must be area 0.
For the network above, put the two Fast Ethernet interfaces into area 0, as well as the Loopback 0 interface on R2. I’ve used a question mark (?) in some parts so that you can see the options available.
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config)#router ospf ?
[1-65535] Process ID – Note that the process ID can’t be 0
R1(config)#router ospf 1
R1(config-router)#network 192.168.1.0 0.0.0.255 area ?
[0-4294967295] OSPF area ID as a decimal value
A.B.C.D OSPF area ID in IP address format
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
With the commands above, you have put the Fast Ethernet 0/0 interface into area 0. You will need to do the same for R2.
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#router ospf 1
R2(config-router)#net 192.168.1.0 0.0.0.255 area 0
R2(config-router)#end
R2#
*Mar 1 00:04:28.207: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R2(config)#int lo0
R2(config-if)#ip add 172.16.1.1 255.255.0.0
R2(config-if)#router ospf 1
R2(config-router)#net 172.16.0.0 0.0.255.255 area 0
Finally, issue a show ip route command. I’ve truncated the output. You won’t see the O in front of the directly connected network because the route was learned from interface 192.168.1.2.
R1#show ip route
Gateway of last resort is not set
172.16.0.0/32 is subnetted, 1 subnets
O 172.16.1.1 [110/11] via 192.168.1.2, 00:01:21, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
[END OF MINI-LAB]It is important to note that the network command is not used to advertise subnets in OSPF. Instead, it is used to determine which interfaces are participating in OSPF, and the subnet mask on those particular interfaces determines which subnets are advertised. Furthermore, the wildcard mask doesn’t have to be the inverse of the subnet mask configured on a particular interface. Once you have completed the configuration, you should try out some show commands to determine what information is presented to you. We will revisit these commands throughout this guide, but it’s good to start using them now.
show ip route
show ip ospf neighbor
show ip ospf interface brief
show ip ospf interface f0/0
If you wanted to add all router interfaces to area 0, you would use the configuration lines below:
Router(config)#router ospf 1
Router(config-router)#network 0.0.0.0 255.255.255.255 area 0
Router(config-router)#end
Router#show ip prot
Routing Protocol is “ospf 1”
[output truncated]Maximum path: 4
Routing for Networks:
- 255.255.255 area 0
Any IP address on any enabled interface will be added to OSPF area 0.
Mini-lab – Configuring OSPF Interfaces
You can alternatively configure OSPF areas per interface, and you should be familiar with both methods for the exam.
Figure 15.7 below shows a simple topology where you want to connect R1 and R2 via OSPF area 0. Add the IP addresses and router names yourself.
FIG 15.7 – Mini-lab: Configuring OSPF interfaces
R1(config)#int f0/0
R1(config-if)#ip ospf 1 area 0
R1(config-if)#end
*Mar 1 01:19:37.127: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R2(config)#int f0/0
R2(config-if)#ip ospf 2 area 0
R2(config-if)#end
*Mar 1 01:19:35.879: %OSPF-5-ADJCHG: Process 2, Nbr 192.168.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R1#show ip protocols
Routing Protocol is “ospf 1”
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.1.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
Routing on Interfaces Configured Explicitly (Area 0):
FastEthernet0/0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
192.168.1.1 110 00:01:11
Distance: (default is 110)
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.2 1 FULL/DR 00:00:31 192.168.1.2 F0/0
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.1.1/24, Area 0
Process ID 1, Router ID 192.168.1.1, Network Type BROADCAST, Cost:10
Enabled by interface config, including secondary ip addresses
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 192.168.1.2, Interface address 192.168.1.2
Backup Designated Router (ID) 192.168.1.1, Interface address 192.168.1.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:09
[output truncated]
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.1.2 (Designated Router)
Suppress Hello for 0 neighbor(s)
[END OF MINI-LAB]Mini-lab – OSPF Passive Interfaces
We have already covered passive interfaces for routing protocols, as well as the configuration commands, so please review that section. I’ve truncated some of the output below. Bear in mind that you can also use the passive-interface default command. Use any of the labs above or any IP addressing that you want to. After you configure and verify OSPF, you can create the passive interface.
R2#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.1.2/24, Area 0
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:07
R2(config)#router ospf 1
R2(config-router)#passive-interface fast0/0
R2(config-router)#^z
R2#show ip ospf interface f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.1.2/24, Area 0
Process ID 1, Router ID 192.168.1.2, Network Type BROADCAST, Cost: 10
No Hellos (Passive interface)
[END OF MINI-LAB]Link State Problems
When you are deciding on which routing protocol is best for your network, you will have to make a choice based on certain advantages and disadvantages of the protocols you are considering. Link state protocols are no different, as there are pros and cons to using them. Whether you do use a link state protocol will depend on the benefits outweighing the costs for your particular network and requirements.
The two main drawbacks of using OSPF are:
- High CPU utilization
- Bandwidth utilization
CPU and Memory Requirements
In order to run the OSPF protocol, a large number of CPU cycles will be consumed. While this is happening, other processes on the router will slow down because they have limited CPU time available to them. A router running a link state protocol will require more memory and CPU power than a distance vector algorithm.
Link state protocols are extremely popular in modern networks. Although they use more CPU cycles and bandwidth, they can have faster convergence, and they offer more power and granularity when configuring various parameters, so they make a very attractive choice.
You can check on the CPU load on a router with the show processes command. You need to execute it every 60 seconds to get a picture of usage.
RouterA#show processes
CPU utilization for five seconds:4%/0%; one minute: 2%;five minutes: 1%
PID Runtime(ms)Invoked uSecs 5Sec 1Min 5Min TTY Process
1 820 898 913 0.00% 0.03% 0.05% 0 Load Meter
2 16236 1672 9710 4.33% 1.18% 0.61% 0 Exec
There will be many more processes than the shortened example above.
You can also execute the show processes cpu command to get the five-second, one-minute, and five-minute display of CPU utilization for each process running.
The solution to the high-CPU issue is to spend more money on a higher-end router capable of running the protocol. Although low-end routers can run OSPF, this is not recommended in real-world environments. Users should check Cisco documentation to confirm the CPU load and whether the router is suitable to run OSPF.
Bandwidth Utilization
Link state protocols do not require a lot of bandwidth after the network is converged. When the protocol is first enabled, the network is flooded with LSA packets that last until convergence is complete. If you have limited bandwidth, it can be completely consumed for some time, severely impacting your network.
End of Chapter Questions
Please visit https://https://www.howtonetwork.com/ccnasimplified to take the free Chapter 15 exam.
Chapter 15 Labs
Lab 1: Single-area OSPF
The physical topology is shown in Figure 15.8 below:
FIG 15.8 – Single area OSPF lab (all interfaces in area 0)
Lab Exercise
Your task is to configure the network in Figure 15.8 to allow full connectivity using the OSPF routing protocol. Please consider all interfaces in area 0, including Loopback interfaces. Please feel free to try the lab without following the Lab Walk-through section.
Text in Courier New font indicates commands that can be entered on the router.
Purpose
OSPF is a highly robust and scalable protocol, and by far, the most popular in medium to large companies. A good working knowledge of the protocol is vital to your success in the exam and as a Cisco engineer.
Lab Objectives
- Use the IP addressing scheme depicted in Figure 15.8. On Router A, you need to configure a clock rate on interface Serial 0/0: set this to 64000.
- Set Telnet access for the router to use the local login permissions for username banbury and the password ccna.
- Configure the enable password to be cisco.
- Configure the OSPF routing protocol to advertise all networks attached to the router.
- Ensure that the routing information is correct by checking the routing table for entries of the neighbor’s addresses.
- Finally, try to ping all the neighbor Loopback interfaces, and then try to access the neighbor router via Telnet.
Lab Walk-through
- To set the IP addresses on an interface, you will need to do the following:
Router#config t
Router(config)#hostname RouterA
RouterA(config)#
RouterA(config)#interface Serial0/0
RouterA(config-if)#ip address 192.168.1.1 255.255.255.252
RouterA(config-if)#clock rate 64000 – If this is the DCE side
RouterA(config-if)#no shutdown
RouterA(config-if)#interface Loopback0
RouterA(config-if)#ip address 172.16.1.1 255.255.0.0
RouterA(config-if)#interface Loopback1
RouterA(config-if)#ip address 172.20.1.1 255.255.0.0
RouterA(config-if)#^Z
RouterA#
Router B:
Router#config t
Router(config)#hostname RouterB
RouterB(config)#
RouterB(config)#interface Serial0/0
RouterB(config-if)#ip address 192.168.1.2 255.255.255.252
RouterB(config-if)#no shutdown
RouterB(config-if)#interface Loopback0
RouterB(config-if)#ip address 172.30.1.1 255.255.0.0
RouterB(config-if)#interface Loopback1
RouterB(config-if)#ip address 172.31.1.1 255.255.0.0
RouterB(config-if)#^Z
RouterB#
- To set the clock rate on a Serial interface (DCE connection only), you need to use the clock rate # command on the Serial interface, where # indicates the speed:
RouterA(config-if)#clock rate 64000
Ping across the Serial link now.
- To set Telnet access, you need to configure the VTY lines to allow Telnet access. To do this type (in configuration mode):
RouterA(config)#line vty 0 4 – Enters the VTY line configuration
RouterA(config-line)#login local – This will use local usernames and passwords for Telnet access
RouterA(config-line)#exit – Exits the VTY config mode
RouterA(config)#username banbury password ccna – Creates username and password for Telnet access (login local)
Router B:
RouterB(config)#line vty 0 4
RouterB(config-line)#login local
RouterB(config-line)#exit
RouterB(config)#username banbury password ccna
- To set the enable password, do the following:
RouterA(config)#enable secret cisco – Sets the enable password (encrypted)
Router B:
RouterB(config)#enable secret cisco
- To configure OSPF on a router, there are two steps: first, enable the routing protocol; and second, specify the networks to be advertised by OSPF:
RouterA(config)#router ospf 20 – Enables the OSPF routing process
RouterA(config-router)#network 172.20.0.0 0.0.255.255 area 0
RouterA(config-router)#network 192.168.1.0 0.0.0.3 area 0
RouterA(config-router)#network 172.16.0.0 0.0.255.255 area 0 – Specifies the networks for OSPF to advertise; one network statement is needed for every network advertised.
Router B:
RouterB(config)#router ospf 20
RouterB(config-router)#network 192.168.1.0 0.0.0.3 area 0
RouterB(config-router)#network 172.30.0.0 0.0.255.255 area 0
RouterB(config-router)#network 172.31.0.0 0.0.255.255 area 0
You should see a console message telling you that the OSPF adjacencies have been formed. For the command to take, you should exit configuration mode with the ^Z or type exit twice.
RouterB#
02:38:57: %SYS-5-CONFIG_I: Configured from console by console
02:38:59: %OSPF-5-ADJCHG: Process 20, Nbr 172.20.1.1 on Serial0 from LOADING to FULL, Loading Done
Use the show ip route command to determine whether the networks being advertised by the neighbor’s OSPF process are in your routing table.
RouterA#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 interarea,
* – 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, Loopback0
C 172.20.0.0/16 is directly connected, Loopback1
172.31.0.0/32 is subnetted, 1 subnets
O 172.31.1.1 [110/65] via 192.168.1.2, 00:01:33, Serial0/0
172.30.0.0/32 is subnetted, 1 subnets
O 172.30.1.1 [110/65] via 192.168.1.2, 00:01:33, Serial0/0
192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, Serial0
RouterA#
- You can issue a show ip protocols command to check on the OSPF configuration:
RouterA#show ip protocols
Routing Protocol is ospf 20
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 172.20.1.1
Maximum path: 4
Routing for Networks:
172.16.0.0 0.0.255.255 area 0
172.20.0.0 0.0.255.255 area 0
192.168.1.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
172.31.1.1 110 00:05:48
172.20.1.1 110 00:05:48
Distance: (default is 110)
- To test connectivity, you will need to use the ping command, and to log in to the neighbor’s router, you will need to use the telnet command:
RouterA#ping 172.30.1.1 – This will send a ping packet to the address specified; there should be five replies if everything is OK.
RouterA#ping 172.30.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.30.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/31/32 ms
RouterA#
RouterA#telnet 172.31.1.1 – This will open a Telnet connection to the neighbor’s router. If Telnet access has been set up correctly, you will be presented with a login message.
RouterA#telnet 172.31.1.1
Trying 172.31.1.1 … Open
User Access Verification
Username: banbury
Password:
RouterB>exit
[Connection to 172.31.1.1 closed by foreign host]
RouterA#
RouterA#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
172.31.1.1 1 FULL/ – 00:00:29 192.168.1.2 Serial0
Test the following commands also:
show ip ospf database
show ip ospf interface
debug ip ospf packet
Do the same with Router B:
RouterB#ping 172.16.1.1
RouterB#ping 172.20.1.1
RouterB#telnet 172.16.1.1
- Now please enter reload at the Router# prompt, and type yes.
Show Runs
RouterA#show run
Building configuration…
!
version 15.1
!
hostname RouterA
!
enable secret 5 $1$rujI$BJ8GgiK8U9p5cdfXyApPr/
!
username banbury password 0 ccna
!
interface Loopback0
ip address 172.16.1.1 255.255.0.0
!
interface Loopback1
ip address 172.20.1.1 255.255.0.0
!
interface Serial0/0
ip address 192.168.1.1 255.255.255.252
clockrate 64000
!
router ospf 20
log-adjacency-changes
network 172.16.0.0 0.0.255.255 area 0
network 172.20.0.0 0.0.255.255 area 0
network 192.168.1.0 0.0.0.3 area 0
!
ip classless
no ip http server
!
line con 0
password letmein
login
line aux 0
line vty 0 4
login local
!
end
—
RouterB#show run
Building configuration…
Current configuration: 853 bytes
!
version 15.1
!
hostname RouterB
!
enable secret 5 $1$ydeA$MyfRKevOckjm7w/0ornnB1
!
username banbury password 0 ccna
!
interface Loopback0
ip address 172.30.1.1 255.255.0.0
!
interface Loopback1
ip address 172.31.1.1 255.255.0.0
!
interface Serial0/0
ip address 192.168.1.2 255.255.255.252
!
router ospf 20
log-adjacency-changes
network 172.30.0.0 0.0.255.255 area 0
network 172.31.0.0 0.0.255.255 area 0
network 192.168.1.0 0.0.0.3 area 0
!
ip classless
no ip http server
!
line con 0
password letmein
login
line aux 0
line vty 0 4
login local
!
end
You can read the OSPF Cisco notes also.