Comment faire un routage dynamique avec le protocole OSPF ?

Routage OSPF

 

Schéma :

Ajouter les interfaces :

Sur les routeur, nous allons avoir besoin de rajouter de nouvelles interfaces afin de pouvoir connecter d’autres équipements.

Choisissez le module WIC-2T ainsi que le module NM-4 pour le modèles 2620, 2621 & 2811. Penser à éteindre avant et à rallumer après. 

 

Relier les machines :

Reliez les machines selon le schéma.

A savoir :

  • Les liaisons rouges correspondent à des liaisons série.
  • Les liaisons croisées correspondent à des liaisons croisées.
  • DCE = Data Connection Equipment
  • DTE = Data Terminal Equipment
  • Le DCE envoie la synchronisation (heart beat) pour l’horloge et la DTE écoute et agit en conséquence. Il faut qu’il y ait toujours au moins une liaison DCE par routeur.

Configuration des routeurs :

Résumé :

Voici les configurations que nous devons retrouver au final :

1841 Series Router0 (R1) :

  • Adresse IP sur FastEthernet0/0 : 10.0.0.1 (Connecté avec Pc0)
  • Adresse IP sur Serial0/0/0 : 20.0.0.1 (Connecté avec R2 sur Serial 0/0)

2620XM Series Router1 (R2) :

  • Adresse IP sur FastEthernet0/0 : 20.0.0.1 (Connecté avec R3 sur FastEthernet0/0)
  • Adresse IP sur Serial0/0/0 : 20.0.0.1 (Connecté avec R1 sur Serial 0/0/0)

2621XM Series Router0 (R3) :

  • Adresse IP sur FastEthernet0/0 : 30.0.0.2 (Connecté avec FastEthernet0/0)
  • Adresse IP sur Serial0/0/0 : 40.0.0.1 (Connecté avec R4 sur Serial0/0/0)

2811 Series Router0 (R4) :

  • Adresse IP sur FastEthernet0/0 : 50.0.0.1 (Connecté avec Pc1)
  • Adresse IP sur Serial0/0/0 : 40.0.0.2 (Connecté avec R3 sur Serial 0/0)

 

(1841Router0) Hostname R1 :

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R1
R1(config)#interface fastethernet 0/0
R1(config-if)#ip address 10.0.0.1 255.0.0.0
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#exit
R1(config)#interface serial 0/0/0
R1(config-if)#ip address 20.0.0.1 255.0.0.0
//Commande à faire uniquement sur le routeur qui gère le DCE (avec l’horloge) :
R1(config-if)#clock rate 64000
R1(config-if)#bandwidth 64
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 10.0.0.0 0.255.255.255 area 0
R1(config-router)#network 20.0.0.0 0.255.255.255 area 0
R1(config-router)#exit

(2620XM-Router1) Hostname R2 :

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#interface serial 0/0
R2(config-if)#ip address 20.0.0.2 255.0.0.0
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
R2(config-if)#exit
R2(config)#interface fastethernet 0/0
R2(config-if)#ip address 30.0.0.1 255.0.0.0
R2(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
R2(config-if)#exit
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config)#router ospf 2
R2(config-router)#network 20.0.0.0 0.255.255.255 area 0
R2(config-router)#network 30.0.0.0 0.255.255.255 area 0
R2(config-router)#exit
R2(config)#

(2620XM-Router2)Hostname R3 :

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R3
R3(config)#interface fastethernet 0/0
R3(config-if)#ip address 30.0.0.2 255.0.0.0
R3(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#interface serial 0/0
R3(config-if)#ip address 40.0.0.1 255.0.0.0
 
//Commandes à passer seulement si gestion du DCE (les deux commandes suivantes) :
R3(config-if)#clock rate 64000
R3(config-if)#bandwidth 64
 
R3(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0, changed state to down
R3(config-if)#exit
%LINK-5-CHANGED: Interface Serial0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
R3(config)#router ospf 3
R3(config-router)#network 40.0.0.0 0.255.255.255 area 0
R3(config-router)#network 30.0.0.0 0.255.255.255 area 0
%OSPF-5-ADJCHG: Process 3, Nbr 30.0.0.1 on FastEthernet0/0 from
LOADING to FULL, Loading D
R3(config-router)#exit
R3(config)#
%SYS-5-CONFIG_I: Configured from console by console

(2811Router3) Hostname R4 :

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R4
Router(config)#interface serial 0/3/0
Router(config-if)#ip address 40.0.0.2 255.0.0.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
Router(config-if)#exit
Router(config)#interface fastethernet 0/0
Router(config-if)#ip address 50.0.0.1 255.0.0.0
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
R4(config)#router ospf 4
R4(config-router)#network 50.0.0.0 0.255.255.255 area 0
R4(config-router)#network 40.0.0.0 0.255.255.255 area 0
R4(config-router)#
00:06:32: %OSPF-5-ADJCHG: Process 4, Nbr 40.0.0.1 on Serial0/0/0 from
LOADING to FULL, Loading Done
R4(config-router)#exit

 

Configuration des PC et vérification :

PC1 :

PC>ipconfig
 
IP Address………………….: 10.0.0.2
Subnet Mask…………………: 255.0.0.0
Default Gateway……………..: 10.0.0.1
 
PC>ping 50.0.0.2
 
Pinging 50.0.0.2 with 32 bytes of data:
 
Reply from 50.0.0.2: bytes=32 time=156ms TTL=124
Reply from 50.0.0.2: bytes=32 time=127ms TTL=124
Reply from 50.0.0.2: bytes=32 time=156ms TTL=124
Reply from 50.0.0.2: bytes=32 time=140ms TTL=124
 
Ping statistics for 50.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 127ms, Maximum = 156ms, Average = 144ms

PC2 :

PC>ipconfig
 
IP Address………………….: 50.0.0.2
Subnet Mask…………………: 255.0.0.0
Default Gateway……………..: 50.0.0.1
 
PC>ping 10.0.0.2
 
Pinging 10.0.0.2 with 32 bytes of data:
 
Reply from 10.0.0.2: bytes=32 time=140ms TTL=124
Reply from 10.0.0.2: bytes=32 time=141ms TTL=124
Reply from 10.0.0.2: bytes=32 time=157ms TTL=124
Reply from 10.0.0.2: bytes=32 time=156ms TTL=124
 
Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 140ms, Maximum = 157ms, Average = 148ms

Vérification :

Pour vérifier le fonctionnement d’OSPF, vous pouvez entrer la commande sur le routeur R4 : show ip protocols.

R4#show ip protocols
Routing Protocol is « ospf 4 »
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 50.0.0.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
50.0.0.0 0.255.255.255 area 0
40.0.0.0 0.255.255.255 area 0
Routing Information Sources:
Gateway Distance Last Update
40.0.0.1 110 00:01:26
Distance: (default is 110)

La commande show ip route peut vous aider à détecter des problèmes en affichant les routes.

R4#show ip route
Codes: C – connected, S – static, I – IGRP, 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, E – EGP
i – IS-IS, 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
Gateway of last resort is not set
O 10.0.0.0/8 [110/1564] via 40.0.0.1, 00:02:37, Serial0/0/0
O 20.0.0.0/8 [110/1563] via 40.0.0.1, 00:02:37, Serial0/0/0
O 30.0.0.0/8 [110/782] via 40.0.0.1, 00:02:37, Serial0/0/0
C 40.0.0.0/8 is directly connected, Serial0/0/0
50.0.0.0/8 is directly connected, FastEthernet0/0

Was this article helpful?

Articles en relations

Leave A Comment?

You must be logged in to post a comment.