Академический Документы
Профессиональный Документы
Культура Документы
14 min read
The OSPF interior routing protocol is a very popular protocol in enterprise networks. OSPF does a very good job in calculating cost values
to choose the Shortest Path First to its destinations. OSPF operations can be separated into three categories:
This article is an excerpt taken from the book CCNA Routing and Switching 200-125 Certification Guide by Lazaro (Laz) Diaz. This book
covers the understanding of networking using routers and switches, layer 2 technology and its various configurations and
connections, VLANS and inter-VLAN routing and more. In this article, we will cover the basics of OSPF, its features and configuration, and
much more.
Remember this would be considered a broadcast in between the routers so the election needs to run to choose DR and BDR.
00:03:06: OSPF: DR/BDR election on FastEthernet0/0
00:03:06: OSPF: Elect BDR 10.1.1.5
00:03:06: OSPF: Elect DR 10.1.1.6
00:03:06: OSPF: Elect BDR 10.1.1.5
00:03:06: OSPF: Elect DR 10.1.1.6
00:03:06: DR: 10.1.1.6 (Id) BDR: 10.1.1.5 (Id)
One thing to keep in mind is that if you are using Ethernet, as we are, the hello packet timer is set to 10 seconds. If it is not an Ethernet
connection, the hello packet timer will be set to 30 seconds. Why is this so important to know? Because the hello packet timer must be
identical to its adjacent router or they will never become neighbors.
There is not just one type of LSA either. Let’s have a look at the following table:
By no means are these the only LSAs that exist. There are 11 LSAs, but for the CCNA, you must know about the ones that I highlighted,
do not dismiss the rest.
LSA updates are sent via multicast addresses. Depending on the type of network topology you have, that multicast address is used.
For the point-to-point networks, the multicast address is 224.0.0.5. In a broadcast environment, 224.0.0.6 is used. But as we get further
into OSPF and start discussing DR/BDR routers in a broadcast environment, the DR uses 224.0.0.5 and the BDR uses 224.0.0.6. In any
case, remember that these two multicast addresses are used within OSPF.
The network topology is created via LSAs updates, for which the information is acquired through LSUs or link state updates. So, OSPF
routers, after they have converged, send hellos via LSAs. If any new change happens, it is the job of the LSU to update the LSA of the
routers in order to keep routing tables current.
Configuration of R1:
Configuration of R2:
Configuration of R3:
So, what did we do? We put the IP addresses on each interface and since we are using serial cables, on the DCE side of the cable, we
must use the clock rate command and assign the clock rate for synchronization and encapsulation.
Then we configured OSPF with basic configuration, which means that all we did was advertise the networks we are attached to using the
process ID number, which is local to the router. The complete network ID address we are partly using is a wildcard mask and since this is
the first area, we must use area 0.
We can verify several ways to use the ping command. Use the sh ip protocols or sh ip route, but let’s look at how this would look.
There are three simple commands that we could use to verify that our configuration of OSPF is correct. One thing you need to know very
well is wild card masking, so let me show you a couple of examples:
Before we begin, let me you present a very simple way of doing wildcard masking. All you must do is use the constant
number 255.255.255.255 and subtract your subnet mask from it:
So, as you can plainly see, your mask will determine the wildcard mask. The network ID may look the same but you will have three
different wildcard masks. That would be a lot of different hosts pointing to a specific interface.
So, that was a basic configuration of OSPF, but you can configure OSPF in many ways. I just explained wildcard masking, but remember
that zeros need to match exactly, so what can you tell me about the following configuration, using a different topology?
R1(config)#router ospf 1
R1(config-router)#net 0.0.0.0 0.0.0.0 area 0
R2(config)#router ospf 2
R2(config-router)#net 10.1.1.6 0.0.0.0 area 0
R2(config-router)#net 10.1.1.9 0.0.0.0 area 0
R2(config-router)#net 2.2.2.2 0.0.0.0 area 0
R3(config)#router ospf 3
R3(config-router)#net 10.1.1.0 0.0.0.255 area 0
R3(config-router)#net 3.3.3.0 0.0.0.255 area 0
We configured OSPF in three different ways, so let’s explain each one.
In this new topology, we are playing around with the wildcard mask. You can see in the first configuration that when we create the
network statement, we use all zeros, 0.0.0.0 0.0.0.0, and then we put in the area number.
Using all zeros means matching all interfaces, so any IP address that exists on the router will be matched by OSPF, placed in area 0, and
advertised to the neighbor routers.
In the second example, when we create our network statement, we put the actual IP address of the interface and then use a wildcard
mask of all zeros, 192.168.1.254 0.0.0.0. In this case, OSPF will know exactly what interface is going to participate in the OSPF process,
because we are matching exactly each octet.
In the last example, the network state created was using the network ID and then we only matched the first three octets and we used
255 on the last octet, which states whatever number.
So, OSPF has tremendous flexibility in its configurations, to meet your needs on the network. You just need to know what those needs
are.
By the way, I hope you spotted that I used a different process ID number on each router. Keep in mind for the CCNA and even most
“real-world” networks that the process ID number is only locally significant. The other routers do not care, so this number can be
whatever you want it to be.
To further prove that the three new ways of configuring OSPF work, here are the routers’ output:
R1#sh ip route
R1#sh 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 1.1.1.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
0.0.0.0 255.255.255.255 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
3.3.3.3 110 18:41:42
2.2.2.2 110 18:41:42
Distance: (default is 110)
R1#ping 2.2.2.2
R2#sh ip protocols
Routing Protocol is "ospf 2"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 2.2.2.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
2.2.2.2 0.0.0.0 area 0
10.1.1.6 0.0.0.0 area 0
10.1.1.9 0.0.0.0 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
3.3.3.3 110 18:31:18
1.1.1.1 110 18:31:18
Distance: (default is 110)
R3#sh ip protocols
Routing Protocol is "ospf 3"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 3.3.3.3
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
3.3.3.0 0.0.0.255 area 0
10.1.1.0 0.0.0.255 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
2.2.2.2 110 18:47:13
1.1.1.1 110 18:47:13
Distance: (default is 110)
To look at other features that OSPF uses, we are going to explore the passive-interface command. This is very useful in preventing
updates being sent out. But be warned, this command works differently with other routing protocols. For example, if you were to
configure it on EIGRP, it will not send or receive updates. In OSPF, it simply prevents updates from being sent out, but will receive
updates for neighbor routers. It will not update its routing table, so essentially that interface is down.
R2(config-router)#passive-interface f1/0
*Oct 3 04:47:01.763: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet1/0 from FULL to DOWN, Neighbor Down: Interface down or
Almost immediately, it took the F1/0 interface down. What’s happening is that the router is not sending any hellos. Let’s further
investigate by using the debug ip ospf hello command:
R2#sh ip route
R2#ping 2.2.2.2
R2(config)#router ospf 2
R2(config-router)#no passive-interface f1/0
R2(config-router)#
*Oct 3 04:57:34.343: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet1/0 from LOADING to FULL, Loading Done
We have now recreated our neighbor relationship with R1 once more. Let’s debug again:
R2#ping 1.1.1.1
Now let’s explore another feature, which is the default-information originate. This is used in conjunction with a static-default route to
create an OSPF default static route. It is like advertising a static default route. To let all the routers know if you want to get to a
destination network, this is the way to go.
So, how would you configure something like that? Let’s take a look.
R1(config)#router ospf 1
R1(config-router)#default-information originate
Now that we have created a static route to an external network and we did the default-information originate command, what would the
routing tables of the other routers look like?
R2#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
R3#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
R4#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
Obviously, you must configure EIGRP on R1 and R4 and do some redistribution. That is why all the routes are external, but you are
advertising a way out using a static default route.
To summarize, this article covered OSPF configurations, features of OSPF, and different ways of advertising the networks. To know more
about Multi-area OSPF configuration, check out the book CCNA Routing and Switching 200-125 Certification Guide.