Monday, March 19, 2012

OSPF - Router ID & Influencing DR Election

In ospf, every neighbor needs to have a unique router ID. This is crucial, if not you will have an unstable ospf database.Once a unique router ID is selected, routers will decide who becomes the DR/BDR in the broadcast network.

I will explain how ospf selects a router ID and how to influence the DR election process. The purpose of the DR is to form a full adjancy with its nighbors and those neighbors advertise there updates to it and then in turn the DR advertises those updates to its fully adjacent neighhors. Its very efficient since this is all done via multicast address 224.0.0.5 (ALL OSPF ROUTERS) and 224.0.0.6(ALL OSPF DR ROUTERS). The DR and BDR always maintan the same database incase the DR was to go down.

How OSPF chooses the router ID:

1. You can manually configure it under ospf by using the the router-id command.
2. Highest IP address on any loopback interface that is UP/UP.
3. Highest IP address on any UP/UP interface.

DR/BDR election:

The router with highest router ID is DR and next highest ip addresses on the neighboring devices become the BDR. You can influence this via the interface priorty number. We will use Diagram 1 to perform this.

Diagram 1

Currently R2 is the DR because of loopback 2 having the higher IP address. I don't want R2 to be the DR as it’s a 2600 devices and R1 is a 2851 which is more powerful and better device. Your DR should be the better router when possible.

Verifying who the DR/BDR is currently:

R1#show IP ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/DR         00:00:37    192.168.1.2     FastEthernet0/0
R2#show IP ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/BDR        00:00:36    192.168.1.1     FastEthernet0/0

The output from R1 confirms that R2 is the DR. We are going to modify the interface priority on R2 so that it does become the DR.

Verifying interface priorities:

R1#show IP ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.1.1/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
  Enabled by interface config, including secondary IP addresses
  Transmit Delay is 1 sec, State BDR, Priority 1  Designated Router (ID) 2.2.2.2, Interface address 192.168.1.2
  Backup Designated router (ID) 1.1.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:07
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 2.2.2.2  (Designated Router)
  Suppress hello for 0 neighbor(s)
R2#show IP ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.1.2/30, Area 0
  Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
  Enabled by interface config, including secondary IP addresses
  Transmit Delay is 1 sec, State DR, Priority 1  Designated Router (ID) 2.2.2.2, Interface address 192.168.1.2
  Backup Designated router (ID) 1.1.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:02
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 2
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 1.1.1.1  (Backup Designated Router)
  Suppress hello for 0 neighbor(s)

Modifying the interface priority:

We will modify the priority on R2 so that it never becomes the DR again.

R2#config t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#IP ospf priority 0
R2(config-if)#end

Now we need to clear the ospf process for this to take place.

R2#clear IP ospf process
Reset ALL OSPF processes? [no]: y

*Mar  1 00:34:15.799: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
Verifying our changes:


R1#show IP ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   FULL/DROTHER    00:00:37    192.168.1.2     FastEthernet0/0
R1#

R2#show IP ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:30    192.168.1.1     FastEthernet0/0
R2#

R1#show IP ospf int f0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.1.1/30, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
  Enabled by interface config, including secondary IP addresses
  Transmit Delay is 1 sec, State DR, Priority 1  Designated Router (ID) 1.1.1.1, Interface address 192.168.1.1
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:06
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 2, maximum is 3
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 2.2.2.2
  Suppress hello for 0 neighbor(s)
R2#show IP ospf interface fastEthernet 0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 192.168.1.2/30, Area 0
  Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
  Enabled by interface config, including secondary IP addresses
  Transmit Delay is 1 sec, State DROTHER, Priority 0  Designated Router (ID) 1.1.1.1, Interface address 192.168.1.1
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:06
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 2
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 1.1.1.1  (Designated Router)
  Suppress hello for 0 neighbor(s)


This confirms our changes were successful. Now you see how it displays the neighbor as DROTHER, it’s because it can no longer become a DR or BDR.

Recommended Reads:

No comments:

Post a Comment