
CCNA students need to understand how OSPF works but besides how to configure it. If you have no idea what OSPF is or if you are a little fuzzed, I recommend you to read my Introduction to OSPF first before continuing. Having said that, let ’ s configure OSPF ! This is the regional anatomy I will use :

This is the regional anatomy that we ’ ll use. All routers are in OSPF Area 0. note that the link between R2 and R1 is an Ethernet ( 10Mbit ) link. All other links are FastEthernet ( 100Mbit ) interfaces.
Reading: Basic OSPF Configuration
We ’ ll beginning with the configuration between R2 and R3 :
R2(config)#router ospf 1
R2(config-router)#network 192.168.23.0 0.0.0.255 area 0
R3(config)#router ospf 1
R3(config-router)#network 192.168.23.0 0.0.0.255 area 0
I need to use the router ospf control to get into the OSPF configuration. The number “ 1 ” is a process ID and you can choose any number you like. It doesn ’ thymine matter and if you want you can use a different number on each router .
The second gear step is to use the network command. It works similar to RIP but it is slenderly unlike, let me break it down for you :
network 192.168.23.0 0.0.0.255
barely like RIP the net command does two things :
- Advertise the networks that fall within this range in OSPF.
- Activate OSPF on the interface(s) that fall within this range. This means that OSPF will send hello packets on the interface.
Behind 192.168.23.0 you can see it says 0.0.0.255. This is not a subnet masquerade but a wildcard mask. A wildcard mask is a reverse subnet mask. Let me give you an example :
Subnetmask | 255 | 255 | 255 | 0 |
11111111 | 11111111 | 11111111 | 00000000 | |
Wildcardmask | 0 | 0 | 0 | 255 |
00000000 | 00000000 | 00000000 | 11111111 |
When I say rearward subnet mask I mean that the binary star 1s and 0s of the wildcard dissemble are flipped compared to the subnet mask. A subnet mask of 255.255.255.0 is the same as wildcard mask 0.0.0.255. Don ’ thyroxine worry about this excessively much for now as I ’ ll explain wildcard masks to you when we talk about access-lists !
OSPF uses areas so you need to specify the area :
area 0
In our exemplar we have configured individual area OSPF. All routers belong to area 0.
After typing in my network command you ’ ll see this message in the console :
R3# % OSPF-5-ADJCHG : process 1, Nbr 192.168.23.2 on FastEthernet0/0 from LOADING to FULL, Loading done
R2# % OSPF-5-ADJCHG : march 1, Nbr 192.168.23.3 on FastEthernet1/0 from LOADING to FULL, Loading cause
bang-up ! It seems that R3 and R2 have become neighbors. There ’ sulfur another control we can use to verify that we have become neighbors :
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.23.2 1 wax/BDR 00:00:36 192.168.23.2 FastEthernet0/0
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.23.3 1 full moon/DR 00:00:32 192.168.23.3 FastEthernet1/0
Show ip ospf neighbor is a great command to see if your router has OSPF neighbors. When the department of state is full you know that the routers have successfully become neighbors .
Each OSPF router has a router ID and we check it with the show information science protocols command :
R2#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.23.2
R3#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.23.3
Above you see the router ID of R2 and R3. They used their highest active IP address as the router ID. Let ’ s create a loopback on R2 to see if the router ID changes…
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
This is how you create a loopback interface. You can pick any numeral that you like it actually doesn ’ thymine matter .
R2#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.23.2
The router ID still the same. We need to reset the OSPF process before the change will take effect, this is how you do it :
R2#clear ip ospf process
Reset ALL OSPF processes ? [ no ] : yes
Use open information science ospf process to reset OSPF. Let ’ s see if there is a difference :
R2#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 2.2.2.2
We can besides change the router ID manually. Let me demonstrate this on R3 :
R3#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.23.3
right now it ’ second 192.168.23.3…
R3(config-router)#router-id 3.3.3.3
recharge or use `` acquit information science ospf work '' command, for this to take impression
R3#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
The router is friendly enough to warn me to reload or clear the OSPF process. Let ’ s verify our shape :
R3#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 3.3.3.3
As you can see above the router ID is immediately 3.3.3.3 .
Changing the router ID international relations and security network ’ triiodothyronine something you would normally do. IP addresses on your router have to be unique so your OSPF router ID will besides be singular. Understanding how OSPF selects a router ID is something you have to understand for the examination however .
right nowadays we have an OSPF neighbor adjacency between R2 and R3. Let ’ s configure our routers therefore that R2/R1 and R1/R3 besides become OSPF neighbors :
R2(config)#router ospf 1
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R1(config)#router ospf 1
R1(config-router)#network 192.168.12.0 0.0.0.255 area 0
R1(config-router)#network 192.168.13.0 0.0.0.255 area 0
R3(config)#router ospf 1
R3(config-router)#network 192.168.13.0 0.0.0.255 area 0
I ’ ll advertise all networks in OSPF. Before we check the route board it ’ s a good idea to see if our routers have become OSPF neighbors :
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.13.1 1 FULL/BDR 00:00:31 192.168.12.1 Ethernet0/0
3.3.3.3 1 FULL/DR 00:00:38 192.168.23.3 FastEthernet1/0
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/BDR 00:00:33 192.168.13.3 FastEthernet1/0
2.2.2.2 1 FULL/DR 00:00:30 192.168.12.2 Ethernet0/0
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.13.1 1 FULL/DR 00:00:37 192.168.13.1 FastEthernet1/0
2.2.2.2 1 FULL/BDR 00:00:30 192.168.23.2 FastEthernet0/0
excellent our routers have become OSPF neighbors and the state is entire which means they are done exchanging data. Let ’ s check the route tables :
R2#show ip route ospf
O 192.168.13.0/24 [ 110/2 ] via 192.168.23.3, 00:09:45, FastEthernet1/0
R2 has one entrance, it ’ mho for network 192.168.13.0 /24. What precisely do we see here ?