Calcul du métrique OSPF
Le coût d’une interface est égale à : 100,000,000 / BW de l’interface
Dans notre cas, l’interface sérial de R2 à un cout de 64 : ( 100,000,000 / 1,544,000 = 64 )
R2#show int s0/0.21 Serial0/0.21 is up, line protocol is up Hardware is PowerQUICC Serial Internet address is 10.1.12.2/24 MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation FRAME-RELAY Last clearing of "show interface" counters never
R2#show ip ospf int s0/0.21 Serial0/0.21 is up, line protocol is up Internet Address 10.1.12.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 64
Le coût d’une interface loopback est de 1, ce qui donne une valeur de métrique de 65 pour atteindre 1.0.0.0/8 depuis R2
R2#show ip route ospf O 1.0.0.0/8 [110/65] via 10.1.12.1, 00:01:09, Serial0/0.21 O 3.0.0.0/8 [110/2] via 10.1.23.3, 00:01:09, FastEthernet0/0 O 4.0.0.0/8 [110/12] via 10.1.23.3, 00:01:09, FastEthernet0/0 10.0.0.0/24 is subnetted, 3 subnets O 10.1.34.0 [110/11] via 10.1.23.3, 00:01:09, FastEthernet0/0
Modification du cout de l’interface lo0 de R1
R1(config)#int loopback 0
R1(config-if)#ip ospf cost 20
Vérification :
R2#show ip route ospf O 1.0.0.0/8 [110/84] via 10.1.12.1, 00:00:18, Serial0/0.21 O 3.0.0.0/8 [110/2] via 10.1.23.3, 00:00:18, FastEthernet0/0 O 4.0.0.0/8 [110/12] via 10.1.23.3, 00:00:18, FastEthernet0/0 10.0.0.0/24 is subnetted, 3 subnets O 10.1.34.0 [110/11] via 10.1.23.3, 00:00:18, FastEthernet0/0
auto-cost reference-bandwidth
Il possible de modifier la référence de calcul des couts OSPF, surtout pour la prise en charge des liens Gigagits.
Mais cette modification doit être portée sur tous les routeurs OSPF
R2(config)#router ospf 1
R2(config-router)#auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
R2(config-router)#^Z
R2#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
Vérification :
R2#show ip ospf int s0/0.21 Serial0/0.21 is up, line protocol is up Internet Address 10.1.12.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 647
Autre exemple
Par défaut, le cout d’une interface de FastEthernet est de 1 (100,000,000 / 100,000,000) :
R2#show ip ospf int fa0/0 FastEthernet0/0 is up, line protocol is up Internet Address 10.1.23.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
Si l’on souhaite que le cout des interfaces FastEthernet soit par exemple de 70,
il suffit de prendre comme référence 70 x 100,000,000 = 7,000,000,000
R2(config)#router ospf 1
R2(config-router)#auto-cost reference-bandwidth 7000
Vérification :
R2#show ip ospf int fa0/0 FastEthernet0/0 is up, line protocol is up Internet Address 10.1.23.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 70
Une interface Gigabit aura dans ce cas un cout de 7