marzo 05, 2012

- Cisco Networking: OSPF Designated Router Election

Today we'll look at a few ways to influence the designated router (DR) and backup DR (BDR) elections on a multi-access segment of five OSPF routers. Due tomy IPv6 resolution, we'll be using OSPFv3 in this article, but the election process works pretty much the same for both OSPFv2 and OSPFv3.
DRs_topology.png

Default Configurations

By default, all IOS OSPF routers are assigned a DR priority of 1. Ties among routers with equal DR priorities are broken by router ID, with the highest RID being preferred.
In our topology, R5 (0.0.0.5) will be elected as the DR and R4 (0.0.0.4) the BDR (assuming that all routers come online at roughly the same time).
R1# show ipv6 ospf interface f0/0 
FastEthernet0/0 is up, line protocol is up  
Link Local Address FE80::1, Interface ID 4   
Area 0, Process ID 1, Instance ID 0, Router ID 0.0.0.1   
Network Type BROADCAST, Cost: 10   
Transmit Delay is 1 sec, State DROTHER, Priority 1  
Designated Router (ID) 0.0.0.5, local address FE80::5   
Backup Designated router (ID) 0.0.0.4, local address FE80::4   
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5     
Hello due in 00:00:03   
Index 1/2/2, flood queue length 0   
Next 0x0(0)/0x0(0)/0x0(0)   
Last flood scan length is 0, maximum is 3   Last flood scan time is 0 msec, maximum is 0 msec   Neighbor Count is 4, Adjacent neighbor count is 2      Adjacent with neighbor 0.0.0.5  (Designated Router)     Adjacent with neighbor 0.0.0.4  (Backup Designated Router)   Suppress hello for 0 neighbor(s)      R1# show ipv6 ospf neighbor  Neighbor ID     Pri   State           Dead Time   Interface ID    Interface 0.0.0.2           1   2WAY/DROTHER    00:00:34    4               FastEthernet0/0 0.0.0.5           1   FULL/DR         00:00:38    4               FastEthernet0/0 0.0.0.4           1   FULL/BDR        00:00:37    4               FastEthernet0/0 0.0.0.3           1   2WAY/DROTHER    00:00:36    4               FastEthernet0/0 
DRs1.png

Manual Priority Configurations

We can influence the DR election process by administratively configuring higher priorities for routers we want to win the DR election. Suppose we wanted R1 to become the DR and R2 to become the BDR:
R1(config)# interface f0/0 R1(config-if)# ipv6 ospf priority 100 
R2(config)# interface f0/0 R2(config-if)# ipv6 ospf priority 90 
DRs cannot be preempted by routers with a higher priority once they have been elected, so we'll need to disconnect all routers from the network in order to force a new election. When the interfaces come back online, we see that R1 and R2 have been elected as the DR and BDR, respectively.
R1# show ipv6 ospf neighbor  Neighbor ID     Pri   State           Dead Time   Interface ID    Interface 0.0.0.4           1   FULL/DROTHER    00:00:38    4               FastEthernet0/0 0.0.0.2          90   FULL/BDR        00:00:38    4               FastEthernet0/0 0.0.0.5           1   FULL/DROTHER    00:00:38    4               FastEthernet0/0 0.0.0.3           1   FULL/DROTHER    00:00:38    4               FastEthernet0/0 
Notice that R1 does not report any OSPF neighbor as a DR; this is because R1 itself is the DR. This is akin to the saying, "If you can't spot the sucker at a card game, you are the sucker." This isn't always the case, though, as we'll see shortly. Always verify whether the local router is fulfilling the DR or BDR role withshow ip[v6] ospf interface:
R1# show ipv6 ospf interface f0/0 FastEthernet0/0 is up, line protocol is up    Link Local Address FE80::1, Interface ID 4   Area 0, Process ID 1, Instance ID 0, Router ID 0.0.0.1   Network Type BROADCAST, Cost: 10   Transmit Delay is 1 sec, State DR, Priority 100   Designated Router (ID) 0.0.0.1, local address FE80::1   Backup Designated router (ID) 0.0.0.2, local address FE80::2   Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5     Hello due in 00:00:05   Index 1/2/2, flood queue length 0   Next 0x0(0)/0x0(0)/0x0(0)   Last flood scan length is 2, maximum is 6   Last flood scan time is 0 msec, maximum is 0 msec   Neighbor Count is 4, Adjacent neighbor count is 4      Adjacent with neighbor 0.0.0.4     Adjacent with neighbor 0.0.0.2  (Backup Designated Router)     Adjacent with neighbor 0.0.0.5     Adjacent with neighbor 0.0.0.3   Suppress hello for 0 neighbor(s) 
DRs2.png

No BDR Router

The backup DR is just that: a backup. In some situations, such as a hub-and-spoke topology with a single hub, it doesn't make sense to have a BDR at all. We can prevent routers from ever becoming a DR or BDR by configuring a priority of zero. So long as one router on the network has a non-zero priority, it will become the DR.
R2(config)# interface f0/0 R2(config-if)# ipv6 ospf priority 0 
R3(config)# interface f0/0 R3(config-if)# ipv6 ospf priority 0 
R4(config)# interface f0/0 R4(config-if)# ipv6 ospf priority 0 
R5(config)# interface f0/0 R5(config-if)# ipv6 ospf priority 0 
R1# show ipv6 ospf neighbor  Neighbor ID     Pri   State           Dead Time   Interface ID    Interface 0.0.0.2           0   FULL/DROTHER    00:00:38    4               FastEthernet0/0 0.0.0.4           0   FULL/DROTHER    00:00:38    4               FastEthernet0/0 0.0.0.3           0   FULL/DROTHER    00:00:38    4               FastEthernet0/0 0.0.0.5           0   FULL/DROTHER    00:00:38    4               FastEthernet0/0 
Note that in this case we are not required to disconnect and reconnect the interfaces to force a new election. Although a new DR or BDR cannot be chosen without a new election, a DR or BDR can resign from its current role without an election.
DRs3.png

No DR or BDR

What happens if we set the priority of R1 (the DR) to zero as well?
R1(config)# interface f0/0 R1(config-if)# ipv6 ospf priority 0 R1(config-if)# ^Z R1# show ipv6 ospf neighbor  Neighbor ID     Pri   State           Dead Time   Interface ID    Interface 0.0.0.2           0   2WAY/DROTHER    00:00:33    4               FastEthernet0/0 0.0.0.4           0   2WAY/DROTHER    00:00:36    4               FastEthernet0/0 0.0.0.3           0   2WAY/DROTHER    00:00:36    4               FastEthernet0/0 0.0.0.5           0   2WAY/DROTHER    00:00:35    4               FastEthernet0/0 
There are no longer any established OSPF adjacencies among any of the routers. Interestingly, this does not immediately affect the routing topology:
R1# show ipv6 route ospf IPv6 Routing Table - 8 entries Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP        U - Per-user Static route, M - MIPv6        I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary        O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2        ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2        D - EIGRP, EX - EIGRP external O   2001:DB8:0:1::2/128 [110/10]      via FE80::2, FastEthernet0/0 O   2001:DB8:0:1::3/128 [110/10]      via FE80::3, FastEthernet0/0 O   2001:DB8:0:1::4/128 [110/10]      via FE80::4, FastEthernet0/0 O   2001:DB8:0:1::5/128 [110/10]      via FE80::5, FastEthernet0/0 
However, the LSAs for these routes will eventually expire, and no changes in the routing topology can be advertised. If we were to disconnect and reconnect all router interfaces again, all neighbors would remain in the 2WAY/DROTHER state. None would be elected as the DR on the network and no routes could be advertised among the routers.
DRs4.png

Nessun commento:

Posta un commento