Objectifs de certification

CCNA 200-301

  • 3.4 Configurer et vérifier single area OSPFv2

    • 3.4.a Neighbor adjacencies
    • 3.4.b Point-to-point
    • 3.4.c Broadcast (DR/BDR selection)
    • 3.4.d Router ID

Lab OSPF élection DR-BDR

Cet exercice est l’occasion d’observer les relations de voisinages de voisins OSPF, de comprendre et de prédire le comportement des routeurs OSPF dans une élection DR/BDR.

1. Enoncé

Sur une technologie Broadcast Multi-Access comme Ethernet, on trouvera une terminologie dans les relations de voisinage OSPF :

  • DR : Designated Router, concentre les relations de voisinage “Full”.
  • BDR : Backup Designated Router, concentre les relations de voisinage “Full” comme sauvegarde du DR (redondance).
  • DRO : DROther : autre qu’un DR ou BDR, entretiennent une relation de voisinage “Two Way” entre eux : ils se voient comme voisins OSPF mais dans une relation qui n’autorise pas l’échange d’états de lien.

Dans cet exercice, il y a un double challenge :

  1. déployer le plus efficacement la configuration et prédire l’élection DR/BDR après redémarrage,
  2. atteindre le résultat escompté avec R3 comme DR et R2 comme BDR.

Phase 1 : Mise en place

Topologie physique

Phase 2 : Résultat attendu

Topologie de voisinage OSPF attendue

2. Solution

Phase 1 : Mise place de la situation initiale.

On peut générer les configuration avec une station de travail Linux :

#!/bin/bash

for x in {1..5} ; do
cat << TAG > R${x}.cfg
configure terminal
hostname R${x}
interface lo 0
 ip address ${x}0.${x}0.${x}0.${x}0 255.255.255.255
 ip ospf 1 area 0
interface g0/0
 ip address 192.168.1.${x} 255.255.255.0
 ip ospf 1 area 0
 no shutdown
router ospf 1
 router-id ${x}.${x}.${x}.${x}
end
wr

TAG
done

Vérification de la table de voisinage OSPF

Après redémarrage de la topologie, voici la table de voisinage de R3 :

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   2WAY/DROTHER    00:00:32    192.168.1.1     GigabitEthernet0/0
2.2.2.2           1   2WAY/DROTHER    00:00:33    192.168.1.2     GigabitEthernet0/0
4.4.4.4           1   FULL/BDR        00:00:31    192.168.1.4     GigabitEthernet0/0
5.5.5.5           1   FULL/DR         00:00:30    192.168.1.5     GigabitEthernet0/0

Il est légitime de trouver les routeurs avec la plus haute OSPF Router-id comme DR (R5) et BDR (R3).

Table de routage OSPF

R3#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/32 is subnetted, 1 subnets
O        10.10.10.10 [110/2] via 192.168.1.1, 00:00:53, GigabitEthernet0/0
      20.0.0.0/32 is subnetted, 1 subnets
O        20.20.20.20 [110/2] via 192.168.1.2, 00:01:03, GigabitEthernet0/0
      30.0.0.0/32 is subnetted, 1 subnets
C        30.30.30.30 is directly connected, Loopback0
      40.0.0.0/32 is subnetted, 1 subnets
O        40.40.40.40 [110/2] via 192.168.1.4, 00:01:18, GigabitEthernet0/0
      50.0.0.0/32 is subnetted, 1 subnets
O        50.50.50.50 [110/2] via 192.168.1.5, 00:01:29, GigabitEthernet0/0
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, GigabitEthernet0/0
L        192.168.1.3/32 is directly connected, GigabitEthernet0/0

Debogage : R5 tombe

Sur R3 :

R3#debug ip ospf adj
OSPF adjacency debugging is on

Sur R5 :

R5(config)#int g0/0
R5(config-if)#shutdown
R5(config-if)#
*Sep 20 18:20:51.188: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Sep 20 18:20:51.188: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Sep 20 18:20:51.188: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Sep 20 18:20:51.188: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
R5(config-if)#
*Sep 20 18:20:53.161: %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down
*Sep 20 18:20:54.161: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down

Les logs apparaissent sur R3 :

R3#
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: 5.5.5.5 address 192.168.1.5 is dead
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: 5.5.5.5 address 192.168.1.5 is dead, state DOWN
*Sep 20 18:21:26.754: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired
R3#
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: Elect BDR 4.4.4.4
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0:    BDR: 4.4.4.4 (Id)
*Sep 20 18:21:26.754: OSPF-1 ADJ   Gi0/0: Remember old DR 5.5.5.5 (id)
R3#
*Sep 20 18:21:28.392: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:21:28.392: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:21:28.392: OSPF-1 ADJ   Gi0/0: Elect BDR 4.4.4.4
*Sep 20 18:21:28.393: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:28.393: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:21:28.393: OSPF-1 ADJ   Gi0/0:    BDR: 4.4.4.4 (Id)
R3#
*Sep 20 18:21:29.727: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:21:29.727: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:21:29.727: OSPF-1 ADJ   Gi0/0: Elect BDR 4.4.4.4
*Sep 20 18:21:29.727: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:29.727: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:21:29.727: OSPF-1 ADJ   Gi0/0:    BDR: 4.4.4.4 (Id)
R3#
*Sep 20 18:21:33.399: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:21:33.399: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:21:33.399: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:21:33.399: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Nbr 1.1.1.1: Prepare dbase exchange
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Send DBD to 1.1.1.1 seq 0x2482 opt 0x52 flag 0x7 len 32
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Nbr 2.2.2.2: Prepare dbase exchange
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Send DBD to 2.2.2.2 seq 0x1A69 opt 0x52 flag 0x7 len 32
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:33.401: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:21:33.402: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: Rcv DBD from 1.1.1.1 seq 0x1483 opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: First DBD and we are not SLAVE
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: Rcv DBD from 2.2.2.2 seq 0xCA3 opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: First DBD and we are not SLAVE
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: Rcv DBD from 1.1.1.1 seq 0x2482 opt 0x52 flag 0x2 len 172  mtu 1500 state EXSTART
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: NBR Negotiation Done. We are the MASTER
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: Nbr 1.1.1.1: Summary list built, size 7
*Sep 20 18:21:33.404: OSPF-1 ADJ   Gi0/0: Send DBD to 1.1.1.1 seq 0x2483 opt 0x52 flag 0x1 len 5
R3#2
*Sep 20 18:21:33.405: OSPF-1 ADJ   Gi0/0: Rcv DBD from 2.2.2.2 seq 0x1A69 opt 0x52 flag 0x2 len 172  mtu 1500 state EXSTART
*Sep 20 18:21:33.405: OSPF-1 ADJ   Gi0/0: NBR Negotiation Done. We are the MASTER
*Sep 20 18:21:33.405: OSPF-1 ADJ   Gi0/0: Nbr 2.2.2.2: Summary list built, size 7
*Sep 20 18:21:33.405: OSPF-1 ADJ   Gi0/0: Send DBD to 2.2.2.2 seq 0x1A6A opt 0x52 flag 0x1 len 52
*Sep 20 18:21:33.408: OSPF-1 ADJ   Gi0/0: Rcv DBD from 1.1.1.1 seq 0x2483 opt 0x52 flag 0x0 len 32  mtu 1500 state EXCHANGE
*Sep 20 18:21:33.408: OSPF-1 ADJ   Gi0/0: Exchange Done with 1.1.1.1
*Sep 20 18:21:33.408: OSPF-1 ADJ   Gi0/0: Synchronized with 1.1.1.1, state FULL
*Sep 20 18:21:33.408: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
*Sep 20 18:21:33.408: OSPF-1 ADJ   Gi0/0: Rcv DBD from 2.2.2.2 seq 0x1A6A opt 0x52 flag 0x0 len 32  mtu 1500 state EXCHANGE
*Sep 20 18:21:33.408: OSPF-1 ADJ   Gi0/0: Exchange Done with 2.2.2.2
*Sep 20 18:21:33.408: OSPF-1 ADJ   Gi0/0: Synchronized with 2.2.2.2, state FULL
*Sep 20 18:21:33.408: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
R3#
*Sep 20 18:21:37.628: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:21:37.629: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:21:37.629: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:21:37.629: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:37.629: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:21:37.629: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
R3#
*Sep 20 18:21:39.326: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:21:39.326: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:21:39.326: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:21:39.326: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:21:39.326: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:21:39.326: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
R3#
*Sep 20 18:22:13.408: OSPF-1 ADJ   Gi0/0: Nbr 1.1.1.1: Clean-up dbase exchange
*Sep 20 18:22:13.408: OSPF-1 ADJ   Gi0/0: Nbr 2.2.2.2: Clean-up dbase exchange

Debogage : R5 revient

Sur R5 :

R5(config-if)#int g0/0
R5(config-if)#no shutdown
R5(config-if)#
*Sep 20 18:24:05.655: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
R5(config-if)#
*Sep 20 18:24:06.655: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
R5(config-if)#
*Sep 20 18:24:11.345: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
*Sep 20 18:24:11.521: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/0 from LOADING to FULL, Loading Done

Sur R3, les logs :

R3#
*Sep 20 18:24:11.294: OSPF-1 ADJ   Gi0/0: Rcv DBD from 5.5.5.5 seq 0x1291 opt 0x52 flag 0x7 len 32  mtu 1500 state INIT
*Sep 20 18:24:11.294: OSPF-1 ADJ   Gi0/0: 2 Way Communication to 5.5.5.5, state 2WAY
*Sep 20 18:24:11.294: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:24:11.294: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:24:11.294: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:24:11.294: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:24:11.295: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:24:11.295: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
*Sep 20 18:24:11.295: OSPF-1 ADJ   Gi0/0: Nbr 5.5.5.5: Prepare dbase exchange
*Sep 20 18:24:11.295: OSPF-1 ADJ   Gi0/0: Send DBD to 5.5.5.5 seq 0x504 opt 0x52 flag 0x7 len 32
*Sep 20 18:24:11.295: OSPF-1 ADJ   Gi0/0: NBR Negotiation Done. We are the SLAVE
*Sep 20 18:24:11.295: OSPF-1 ADJ   Gi0/0: Nbr 5.5.5.5: Summary list built, size 6
*Sep 20 18:24:11.295: OSPF-1 ADJ   Gi0/0: Send DBD to 5.5.5.5 seq 0x1291 opt 0x52 flag 0x2 len 152
*Sep 20 18:24:11.297: OSPF-1 ADJ   Gi0/0: Rcv DBD from 5.5.5.5 seq 0x1292 opt 0x52 flag 0x1 len 52  mtu 1500 state EXCHANGE
*Sep 20 18:24:11.297: OSPF-1 ADJ   Gi0/0: Exchange Done with 5.5.5.5
*Sep 20 18:24:11.297: OSPF-1 ADJ   Gi0/0: Synchronized with 5.5.5.5, state FULL
*Sep 20 18:24:11.298: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
R3#
*Sep 20 18:24:11.298: OSPF-1 ADJ   Gi0/0: Send DBD to 5.5.5.5 seq 0x1292 opt 0x52 flag 0x0 len 32
R3#
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: Elect DR 4.4.4.4
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0: DR: 4.4.4.4 (Id)
R3#
*Sep 20 18:24:15.916: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
R3#
*Sep 20 18:24:51.297: OSPF-1 ADJ   Gi0/0: Nbr 5.5.5.5: Clean-up dbase exchange

Sur R3 la table de voisinage :

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DROTHER    00:00:34    192.168.1.1     GigabitEthernet0/0
2.2.2.2           1   FULL/DROTHER    00:00:35    192.168.1.2     GigabitEthernet0/0
4.4.4.4           1   FULL/DR         00:00:38    192.168.1.4     GigabitEthernet0/0
5.5.5.5           1   FULL/DROTHER    00:00:31    192.168.1.5     GigabitEthernet0/0

R4 reste DR et R3 reste BDR :

R3#show ip ospf interface g0/0
GigabitEthernet0/0 is up, line protocol is up
  Internet Address 192.168.1.3/24, Area 0, Attached via Interface Enable
  Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Enabled by interface config, including secondary ip addresses
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID) 4.4.4.4, Interface address 192.168.1.4
  Backup Designated router (ID) 3.3.3.3, Interface address 192.168.1.3
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:03
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/1/1, flood queue length 0
  Next 0x0(0)/0x0(0)/0x0(0)
  Last flood scan length is 0, maximum is 1
  Last flood scan time is 0 msec, maximum is 0 msec
  Neighbor Count is 4, Adjacent neighbor count is 4
    Adjacent with neighbor 1.1.1.1
    Adjacent with neighbor 2.2.2.2
    Adjacent with neighbor 4.4.4.4  (Designated Router)
    Adjacent with neighbor 5.5.5.5
  Suppress hello for 0 neighbor(s)

Phase 2 : R3 en DR et R2 en BDR

Sur R3 :

configure terminal
interface g0/0
 ip ospf priority 255
end
wr

Sur R2 :

configure terminal
interface g0/0
 ip ospf priority 239
end
wr

Table de voisinage

Après redémarrage de la topologie, R5 voit ses voisins dont R3 en DR et R2 en BDR, remarquez les priorités :

R5#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   2WAY/DROTHER    00:00:31    192.168.1.1     GigabitEthernet0/0
2.2.2.2         239   FULL/BDR        00:00:39    192.168.1.2     GigabitEthernet0/0
3.3.3.3         255   FULL/DR         00:00:39    192.168.1.3     GigabitEthernet0/0
4.4.4.4           1   2WAY/DROTHER    00:00:31    192.168.1.4     GigabitEthernet0/0