How to configure OSPF for CCNA students

What if an OSPF route sat behind a EIGRP network which was the only access out to the internet… in other words… OSPF network had to go through a EIGRP network to exit the internal network and go to the internet (BGP, Static, etc)… would you use the default-information originate command on the Autonomous System Border Router (connecting OSPF to EIGRP) to tell all the OSPF routers – hey…go this way to get out.

Jason, you are exactly right. Suppose your ASBR is 10.0.0.1, and it has a default route in its RIB (it doesn’t matter whether that route came from EIGRP, or is a static route). From the ASBR, under your OSPF process, you would issue
(config-router)#default-information originate

Now, if you went to another OSPF router in the same area as the ASBR, you would see the following in its routing table:

Gateway of last resort is 10.0.0.1 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.0.0.1, 00:00:01, FastEthernet0/0

So the ASBR is advertising an External Type-2 route by default to OSPF (using a Type-5 LSA).

By the way, the ASBR doesn’t have to have a default route in order to do this. If you modified the command just slightly with
(config-router)#default-information originate always
the “always” keyword will have the ASBR advertise a default route to OSPF whether or not the ASBR actually has a default route of its own.

Hi Rene

In the DR election involving the router Hearts and Spade, Hearts and clubs I think that this router will win the DR election in both the cases because it has the highest RID. Can you please check and let me know why this is not the case for Hearts and Spade.

If I am wrong please let me know why between Heart & Spade router, how Spade won the election for the DR

Thanks
Palani

Hi Palani,

As you probably know, the order in which a DR election is decided is:

  1. Highest Priority
  2. Highest Router-ID
  3. Highest Loopback IP
  4. Highest Interface IP (interface must be up/up)

You are right that Heart should win the election should one occur between Spade and Heart, because they are both priority 1, and Heart has the highest router-id.

The reason that Heart is not the DR is because in reality elections happen very rarely. The timing between two routers has to be almost perfect where neither router has gotten past the “Wait” timer while the OSPF process initializes. One important thing to remember about OSPF is that in most circumstances, there is no DR preemption meaning that once a DR is elected, it stays the DR even if another router that would have been the DR otherwise later comes online. For the purposes of CCNA, just think of there being no preemption (it is actually possible, but we won’t get into that here).

When the OSPF process starts up, it sends OSPF Hello messages to 224.0.0.5 and listens for Hellos. During this first startup, the router will wait to hear Hellos back in for the “Wait” timer period (which is equal to the DEAD timer by default). If the router receives Hellos, and those Hellos contain information about an existing DR and BDR, the router will immediately accept these values, and an election will not occur.

All of this means that ultimately who is actually the DR mostly comes down to the order in which you power on the routers! In this lesson, it was probably the case that Spade started up before Hearts.

Hi rene
I did " clear ip ospf process " after adding loopback ip .But my router ID did not change

R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
R1#
R1#show ip protocols
*** IP Routing is NSF aware ***

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
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.23.0 0.0.0.255 area 0
  Routing Information Sources:
    Gateway         Distance      Last Update
  Distance: (default is 110)

Thanks

Sims,
When you add a loopback, OSPF won’t automatically change the router-id even if you clear the process. Since you have already created the OSPF instance, you will have to issue the command
(config-router)#router-id <A.B.C.D>
Where A.B.C.D is what you want the ID to become, and after that, clear the OSPF process.

The other much more difficult option would be (once you already have your loopback created) to remove OSPF and add it back, via:

(config)#no router ospf 1
(config)#router ospf 1

But you would have to re-enter your configuration parameters doing it that way.

Note: There does not have to be a corresponding IP address to match an ID. You can make this ID to 123.123.123.123 if you want, and even if you don’t have any IP like that, OSPF will still work fine. The Router-ID is the node identifier and is independent of any IP space.

1 Like

Hi,

Why both neighbour is BDR

Hearts#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/BDR        00:00:36    192.168.13.3    GigabitEthernet0/1
2.2.2.2           1   FULL/BDR    
00:00:35    192.168.12.2    GigabitEthernet0/0

Thanks

Hi Sims,

The DR/BDR election is done on each multi-access segment, not per area.

Rene

Hi,

I have the same topology as in your document

But Both are showing ‘BDR’

Clubs#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:39    192.168.23.2    GigabitEthernet0/2
192.168.13.1      1   FULL/BDR        00:00:33    192.168.13.1    GigabitEthernet0/1

Thanks

The DR/BDR election is done per multi-access segment. In this topology, our Ethernet interfaces are multi-access.

This means there is an election on the segment between Spade/Clubs, Spade/Hearts and Hearts/Clubs.

The election is also non-preemptive which means that once a DR/BDR has been elected, it remains this role unless you reset the OSPF process. If you add a new loopback interface on a router or change its router ID, you might want to reset all routers on the segment to ensure that the DR/BDR election is done again properly.

Hi,
The DR/BDR election is done per multi-access segment. In this topology, our Ethernet interfaces are multi-access.

Can you explain " our Ethernet interfaces are multi-access."

Thanks

Sims,
Think of multi-access as the opposite of point-to-point. Where Point-to-Point has only one destination at the other end of the line, multi-access could have multiple destinations–like any device plugged into a hub or switch.

19 posts were merged into an existing topic: How to configure OSPF for CCNA students

Hello Rene!
I’m not clear about authentication for entire area:

R3(config-if)#router ospf 1
R3(config-router)#area 0 authentication

This command use for set authentication for entire area but where is the password ? This command seem like just tell router to use authentication to perform neighbor.
Please kindly help !
Thank and best regard
Sovandara

Hi Sovandara,

Authentication can be enabled globally for an area but you still have to configure the password on the interface. You can’t configure the password globally. Here’s a complete example:

R1(config)#router ospf 1
R1(config-router)#area 0 authentication 

R1(config)#interface FastEthernet 0/0
R1(config-if)#ip ospf authentication-key CISCO

Hi Rene
But if i configure twos password different from each other on different interface, When i enable authentication for entire area, Which password it will choose ?

It will always use the password on the interface. For example, if you have something like this:

R1(config)#router ospf 1
R1(config-router)#area 0 authentication 

R1(config)#interface FastEthernet 0/0
R1(config-if)#ip ospf authentication-key CISCO

R1(config)#interface FastEthernet 0/1
R1(config-if)#ip ospf authentication-key NWL

Then it will use password CISCO on the F0/0 interface and NWL on the F0/1 interface.

Hi Rene,
i am trying to doing your LAB one by one…
Based on below mention topic when i am trying to change router id automatically based on highest ip address on interface why its not changing after clear ip ospf process

R2#sh version
Cisco IOS Software, 7200 Software (C7200P-SPSERVICESK9-M), Version 12.4(15)T9, RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Tue 28-Apr-09 20:04 by prod_rel_team

ROM: System Bootstrap, Version 12.4(12.2r)T, RELEASE SOFTWARE (fc1)
BOOTLDR: Cisco IOS Software, 7200 Software (C7200P-KBOOT-M), Version 12.4(15)T9, RELEASE SOFTWARE (fc5)

R2 uptime is 4 days, 22 hours, 58 minutes
System returned to ROM by power-on
System image file is "disk0:c7200p-spservicesk9-mz.124-15.T9.bin"


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Cisco 7201 (c7201) processor (revision B) with 917504K/65536K bytes of memory.
Processor board ID 78009046
MPC7448 CPU at 1666Mhz, Implementation 0, Rev 2.2
1 slot midplane, Version 2.1

Last reset from power-on
1 FastEthernet interface
4 Gigabit Ethernet interfaces
2045K bytes of NVRAM.

254464K bytes of ATA PCMCIA card at slot 0 (Sector size 512 bytes).
65536K bytes of Flash internal SIMM (Sector size 512K).
Configuration register is 0x2102


R2(config)#inter loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#end

R2#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 192.168.23.2
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.12.0 0.0.0.255 area 0
    192.168.23.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.23.3         110      00:03:33
  Distance: (default is 110)

R2#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 192.168.23.2
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.12.0 0.0.0.255 area 0
    192.168.23.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.23.3         110      00:03:54
  Distance: (default is 110)

R2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R2#
*Mar 14 00:32:19.074: OSPF: Interface GigabitEthernet0/3 going Down
*Mar 14 00:32:19.074: OSPF: 192.168.23.2 address 192.168.23.2 on GigabitEthernet0/3 is dead, state DOWN
*Mar 14 00:32:19.074: OSPF: Neighbor change Event on interface GigabitEthernet0/3
*Mar 14 00:32:19.074: OSPF: DR/BDR election on GigabitEthernet0/3
*Mar 14 00:32:19.074: OSPF: Elect BDR 0.0.0.0
*Mar 14 00:32:19.074: OSPF: Elect DR 192.168.23.3
*Mar 14 00:32:19.074: OSPF: Elect BDR 0.0.0.0
*Mar 14 00:32:19.074: OSPF: Elect DR 192.168.23.3
*Mar 14 00:32:19.074:        DR: 192.168.23.3 (Id)   BDR: none
*Mar 14 00:32:19.074: OSPF: 192.168.23.3 address 192.168.23.3 on GigabitEthernet0/3 is dead, state DOWN
*Mar 14 00:32:19.074: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.23.3 on GigabitEthernet0/3 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar 14 00:32:19.074: OSPF: Neighbor change Event on interface GigabitEthernet0/3
*Mar 14 00:32:19.074: OSPF: DR/BDR election on GigabitEthernet0/3
*Mar 14 00:32:19.074: OSPF: Elect BDR 0.0.0.0
*Mar 14 00:32:19.074: OSPF: Elect DR 0.0.0.0
*Mar 14 00:32:19.074:        DR: none    BDR: none
*Mar 14 00:32:19.074: OSPF: Remember old DR 192.168.23.3 (id)
*Mar 14 00:32:19.074: OSPF: Interface GigabitEthernet0/0 going Down
*Mar 14 00:32:19.074: OSPF: 192.168.23.2 address 192.168.12.2 on GigabitEthernet0/0 is dead, state DOWN
*Mar 14 00:32:19.074: OSPF: Neighbor change Event on interface GigabitEthernet0/0
*Mar 14 00:32:19.074: OSPF: DR/BDR election on GigabitEthernet0/0
*Mar 14 00:32:19.074: OSPF: Elect BDR 0.0.0.0
*Mar 14 00:32:19.074: OSPF: Elect DR 0.0.0.0
*Mar 14 00:32:19.074: OSPF: Elect BDR 0.0.0.0
*Mar 14 00:32:19.074: OSPF: Elect DR 0.0.0.0
*Mar 14 00:32:19.074:        DR: none    BDR: none
*Mar 14 00:32:19.074: OSPF: Flush network LSA immediately
*Mar 14 00:32:19.074: OSPF: Remember old DR 192.168.23.2 (id)
*Mar 14 00:32:19.074: OSPF: Interface GigabitEthernet0/3 going Up
*Mar 14 00:32:19.074: OSPF: Interface GigabitEthernet0/0 going Up
*Mar 14 00:32:19.574: OS
R2#PF: Build router LSA for area 0, router ID 192.168.23.2, seq 0x80000001, process 1
*Mar 14 00:32:19.574: OSPF: We are not DR to build Net Lsa for interface GigabitEthernet0/0
*Mar 14 00:32:21.538: OSPF: OSPF: Rcv pkt from GigabitEthernet0/3 src 192.168.23.3 dst 224.0.0.5 id 192.168.23.3 type 5 if_state 2 : ignored due to unknown neighbor
*Mar 14 00:32:21.602: OSPF: 2 Way Communication to 192.168.23.3 on GigabitEthernet0/3, state 2WAY
*Mar 14 00:32:21.602: OSPF: Backup seen Event before WAIT timer on GigabitEthernet0/3
*Mar 14 00:32:21.602: OSPF: DR/BDR election on GigabitEthernet0/3
*Mar 14 00:32:21.602: OSPF: Elect BDR 192.168.23.2
*Mar 14 00:32:21.602: OSPF: Elect DR 192.168.23.3
*Mar 14 00:32:21.602: OSPF: Elect BDR 192.168.23.2
*Mar 14 00:32:21.602: OSPF: Elect DR 192.168.23.3
*Mar 14 00:32:21.602:        DR: 192.168.23.3 (Id)   BDR: 192.168.23.2 (Id)
*Mar 14 00:32:21.602: OSPF: Send DBD to 192.168.23.3 on GigabitEthernet0/3 seq 0x120 opt 0x52 flag 0x7 len 32
*Mar 14 00:32:21.606: OSPF: Rcv DBD from 192.168.23.3 on GigabitEthernet0/3 seq 0x22DD opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Mar 14 00:32:21.606: OSPF: NBR Negotiation Done. We are the SLAVE
*Mar 14 00:32:21.606: OSPF: Send DBD to 192.168.23.3 on GigabitEthernet0/3 seq 0x22DD opt 0x52 flag 0x2 len 52
*Mar 14 00:32:21.606: OSPF: Rcv DBD from 192.168.23.3 on GigabitEthernet0/3 seq 0x22DE opt 0x52 flag 0x3 len 52  mtu 1500 state EXCHANGE
*Mar 14 00:32:21.606: OSPF: Send DBD to 192.168.23.3 on GigabitEthernet0/3 seq 0x22DE opt 0x52 flag 0x0 len 32
*Mar 14 00:32:21.610: OSPF: Rcv DBD from 192.168.23.3 on GigabitEthernet0/3 seq 0x22DF opt 0x52 flag 0x1 len 32  mtu 1500 state EXCHANGE
*Mar 14 00:32:21.610: OSPF: Exchange Done with 192.168.23.3 on GigabitEthernet0/3
*Mar 14 00:32:21.610: OSPF: Send LS REQ to 192.168.23.3 length 12 LSA count 1
*Mar 14 00:32:21.610: OSPF: Send DBD to 192.168.23.3 on GigabitEthernet0/3 seq 0x22DF opt 0x52 flag 0x0 len 32
*Mar 14 00:32:21.610: OSPF: Rcv LS UPD from 192.168.23.3 on GigabitEthernet0/3 length 76 LSA count 1
*Mar 14 00:32:21.610: OSPF: Synchronized with 192.168.23.3 on GigabitEthernet0/3, state FULL
*Mar 14 00:32:21.610: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.23.3 on GigabitEthernet0/3 from LOADING to FULL, Loading Done
*Mar 14 00:32:24.574: OSPF: Rcv LS UPD from 192.168.23.3 on GigabitEthernet0/3 length 76 LSA count 1
*Mar 14 00:32:24.606: OSPF: Rcv LS UPD from 192.168.23.3 on GigabitEthernet0/3 length 60 LSA count 1
*Mar 14 00:32:26.454: OSPF: Rcv LS UPD from 192.168.23.3 on GigabitEthernet0/3 length 76 LSA count 1
*Mar 14 00:32:27.102: OSPF: Build router LSA for area 0, router ID 192.168.23.2, seq 0x80000007, process 1
*Mar 14 00:32:31.610: OSPF: Neighbor change Event on interface GigabitEthernet0/3
*Mar 14 00:32:31.610: OSPF: DR/BDR election on GigabitEthernet0/3
*Mar 14 00:32:31.610: OSPF: Elect BDR 192.168.23.2
*Mar 14 00:32:31.610: OSPF: Elect DR 192.168.23.3
*Mar 14 00:32:31.610:        DR: 192.168.23.3 (Id)   BDR: 192.168.23.2 (Id)
*Mar 14 00:32:59.074: OSPF: end of Wait on interface GigabitEthernet0/0
*Mar 14 00:32:59.074: OSPF: DR/BDR election on GigabitEthernet0/0
*Mar 14 00:32:59.074: OSPF: Elect BDR 192.168.23.2
*Mar 14 00:32:59.074: OSPF: Elect DR 192.168.23.2
*Mar 14 00:32:59.074: OSPF: Elect BDR 0.0.0.0
*Mar 14 00:32:59.074: OSPF: Elect DR 192.168.23.2
*Mar 14 00:32:59.074:        DR: 192.168.23.2 (Id)   BDR: none
*Mar 14 00:32:59.574: OSPF: No full nbrs to build Net Lsa for interface GigabitEthernet0/0
R2#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 192.168.23.2
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.12.0 0.0.0.255 area 0
    192.168.23.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.23.3         110      00:01:26
  Distance: (default is 110)

R2#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 192.168.23.2
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.12.0 0.0.0.255 area 0
    192.168.23.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.23.3         110      00:03:12
  Distance: (default is 110)

R2#sh inter br
R2#sh ip inter br
R2#sh ip inter brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES NVRAM  administratively down down
GigabitEthernet0/0         192.168.12.2    YES manual up                    up
GigabitEthernet0/1         unassigned      YES manual down                  down
GigabitEthernet0/2         unassigned      YES manual down                  down
GigabitEthernet0/3         192.168.23.2    YES manual up                    up
Loopback0                  2.2.2.2         YES manual up                    up
Loopback1                  unassigned      YES manual up                    up
R2#

R2#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.3      1   FULL/DR         00:00:37    192.168.23.3    GigabitEthernet0/3

Thanks & Regards,
Arindom

Hello Arindom

Indeed with the config as you have it set up, the router ID should become 2.2.2.2 since it is the highest loopback ID. However, 192.168.23.2 does remain the router ID even after the clear ip ospf process command.

The only thing i can think of is that you have the router ID explicitly configured in the OSPF process as 192.168.23.2 and this is why it is not changing. Please confirm that you have no configured router ID in the OSPF configuration.

If all else fails, try rebooting the device. Let us know your results.

I hope this has been helpful!

Laz

HI Laz,
sorry for late reply…i went to out side for few days so didn’t reply you sorry for this…

I didn’t configure the router ID manually…i checked multiple times but why i do reboot ?
I think i didn’t any mistake but If you want to see the configuration i can show you…As i mentioned previously that if i reboot the router (which is not valid process)the ID will change or if i remove the OSPF configuration and add again(which is not valid process) then the ID will change so why the command “clear ip opsf process” is not changing the Router ID ?

Waiting for your reply…

Thanks & Regards,
Arindom