In the previous article I’ve discuss about Router ID Concept. And in this article I’ll discuss about how to configure OSPF Router ID on Cisco.
The Following is the topology are used :
Based on the topology above, we want to configure step by step to find out the router-id changes.
Configure interface G0/0 and G0/1 on each routers first, Then Configure OSPF. We’ll Configure Loopback interface later.
Configure IP Address R1 :
R1(config)#int g0/0 R1(config-if)#ip add 12.12.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#int g0/1 R1(config-if)#ip add 192.168.100.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit
Configure IP Address R2 :
R2(config)#int g0/0 R2(config-if)#ip add 12.12.12.2 255.255.255.0 R2(config-if)#no shut R2(config-if)#exit R2(config)#int g0/1 R2(config-if)#ip add 192.168.200.1 255.255.255.0 R2(config-if)#no shut R2(config-if)#exit R2(config)#
Configure OSPF on R1 :
R1(config)#router ospf 1 R1(config-router)#network 12.12.12.0 0.0.0.255 area 0 R1(config-router)#network 192.168.100.0 0.0.0.255 area 0 R1(config-router)#exit
Configure OSPF on R2 :
R2(config)#router ospf 1 R2(config-router)#network 12.12.12.0 0.0.0.255 area 0 R2(config-router)#network 192.168.200.0 0.0.0.255 area 0 R2(config-router)#exit
After adjacency between R1 and R2 are successfull, then show the neighbor to see the router id
R1 OSPF neighbor. As you can see the neighbor on R1 bellow, R1 detect the Neighbor of R2 with N-ID 192.168.200.1. Address 12.12.12.2 is ip address R2 interface that directly connect to R1 and 192.168.200.1 is also R2 ip address on active interface with highest value.
R1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 192.168.200.1 1 FULL/BDR 00:00:35 12.12.12.2 GigabitEthernet0/0 R1#
R2 OSPF neigbor. Also on R2, you can see the neighbor of R1
R2#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 192.168.100.1 1 FULL/DR 00:00:39 12.12.12.1 GigabitEthernet0/0 R2#
Show the interface brief on R1 & R2 :
R1#show ip int brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0/0 12.12.12.1 YES manual up up GigabitEthernet0/1 192.168.100.1 YES manual up up R1#R2#show ip int brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0/0 12.12.12.2 YES manual up up GigabitEthernet0/1 192.168.200.1 YES manual up up R2#
Look at the interface brief above, both routers that use the highest active ip address because those routers area not configure the static router-id.
Now we want to test to add loopback interface with highest ip address as you can see to topology for each routers.
Configure Loopback ip on R1:
R1(config)#int lo0 R1(config-if)# R1(config-if)#ip add 192.168.110.1 255.255.255.0 R1(config-if)#exit
Configure Loopback ip on R2:
R2(config)#int lo0 R2(config-if)# R2(config-if)#ip add 192.168.210.1 255.255.255.0 R2(config-if)#exit
Add loopback ip of R1 and R2 to OSPF network
R1(config)#router ospf 1 R1(config-router)#network 192.168.110.0 0.0.0.255 area 0 R1(config-router)#exit
R2(config)#router ospf 1 R2(config-router)#network 192.168.210.0 0.0.0.255 area 0 R2(config-router)#exit
You can reset and do a re-adjacency ospf with clear ip ospf process command on each routers :
R1#clear ip ospf process Reset ALL OSPF processes? [no]: yes R1#
R2#clear ip ospf process Reset ALL OSPF processes? [no]: yes R2#
But for this tutorial, reload both routers to see the changes of ospf process. Don’t forget to save the configuration first before reload.
R1#write Building configuration... [OK] R1#reload Proceed with reload? [confirm] y
R2#write Building configuration... [OK] R2#reload Proceed with reload? [confirm] y
After reload, check each router neighbor.
R1#show ip ospf nei Neighbor ID Pri State Dead Time Address Interface 192.168.210.1 1 FULL/BDR 00:00:36 12.12.12.2 GigabitEthernet0/0 R1#
R2#show ip ospf nei Neighbor ID Pri State Dead Time Address Interface 192.168.110.1 1 FULL/DR 00:00:33 12.12.12.1 GigabitEthernet0/0 R2#
As the output above, you can see the router-id on each routers are changes. Each routers are use the loopback ip address with highest value as Neighbor ID.
And Now let’s configure each routers with static router-id.
Configure Router-id on R1. Once configured the router-id, router will tell you to reload the ip ospf process to take the effect. Then reload the process with clear ip ospf process command.
R1(config)#router ospf 1 R1(config-router)#router id R1(config-router)#router R1(config-router)#router-id 1.1.1.1 % OSPF: Reload or use "clear ip ospf process" command, for this to take effect R1(config-router)#exit R1(config)#end R1#clear ip ospf process Reset ALL OSPF processes? [no]: yes R1#
Configure Router-id on R2.
R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 % OSPF: Reload or use "clear ip ospf process" command, for this to take effect R2(config-router)#exit R2(config)#end R2#clear ip ospf process Reset ALL OSPF processes? [no]: yes R2#
Show the neighbor on each routers and see the router-id has changes.
R1#show ip ospf nei Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/BDR 00:00:31 12.12.12.2 GigabitEthernet0/0 R1#
R2#show ip ospf nei Neighbor ID Pri State Dead Time Address Interface 1.1.1.1 1 FULL/DR 00:00:35 12.12.12.1 GigabitEthernet0/0 R2#