|
|
|
---|---|---|
|
||
|
OSPF |
|
OSPF OSPF is a routing protocol based on the mathematical concept of graph. A graph is a bidimensional structure made by nodes (also called vertex) connected together via links aldo called branches or arches. A graph could be weighed if every branch has an associate numerical value. Every link could also be bidirectional and therefore it is possible to have two different connection between two nodes and two weight values. In this case the graph is called oriented. Therefore a graph is a natural way to represent a network that infact is a bidirectional structure made of router connected together with bidirectional links. The links are weighed with a number that could be, for example, the bandwidth available on it. If OSPF is enabled a router mantein a topological graph of the entire network. This graph is bidirectional and weighted. In reality the graph is limited to the OSPF area to which the router belong. With OSPF is possible to split a big network in parts called area. So we are going to have some routers that are connected to different areas. This routers are called ABR and normally the do a summarization of the network prefix. This behaviour is different from what we have in protocols like RIP, EIGRP and IGRP. With OSPF are propaged only the topology changes in the network, this is way OSPF is a link-state algorithm. This is why OSPF is able to scale to big networks. With OSPF a router extract a tree from the graph using an shortest-path algorithm (like Dijkstra). In this way a router is able to determine the best path to reach a destination. Questo grafo ha link bidirezionali con peso. Pertanto ogni router della rete ha visibilita’ su tutta la struttura di rete. In RIP, EIGRP, IGRP un router non ha idea dell’intera struttura topologica della rete in cui si trova ma soltanto di quella relativa ad esso e ai suoi suoi vicini. Per questa ragione OSPF si chiama protocollo “link-state”. La presenza del grafo dell’intera rete consente ad ogni router, applicando l’algoritmo di Dijkstra (shortest-path), di estrarre un albero dal grafo cosi’ da determinare il percorso ottimale per raggiungere ogni destinazione evitando loop e senza fare uso di hold-down timer che sono causa della lenta la convergenza in RIP e IGRP. Ogni router estrae un albero di cui lui stesso e’ la radice. Se due percorsi hanno lo stesso costo OSPF distribuisce il carico tra i due. Nella configurazione di OSPF non si fa uso di AS number ma di process-id che e' cosa differente in quanto si puo' avere differente process-id in router differenti. OSPF ha pieno supporto della netmask, invia solo aggiornamenti e non l’intera tabella di routing ai suoi vicini, e’ piu’ CPU intensive di RIP, IGRP ed EIGRP, ed e’ scalabile. Poiche’ ogni router ha un grafo dell’intera rete col crescere della stessa il ricalcolo con Dijstra puo' impiegare eccessive risorse di CPU e memoria. Per questa ragione sono state introdotte le AREE. Ogni router ha in realta' consapevolezza della struttura dell’area a cui appartiene. Alcuni router, gli ABR, hanno interfacce su aree diverse. L’area 0 e’ speciale ed e’ sempre presente in una rete OSPF. Gli ASBR sono invece quei router che ridistribuiscono in OSPF informazioni provenienti da statiche o da altri algoritmi di routing. Tutte le informazioni di routing vengono scambiate tramite messaggi chiamati LSA. RFC1247definisce gli LSA ‘link-state advertisements’ e vengono inviati all'indirizzo multicast 224.0.0.5. Gli LSA piu' importanti sono 5. Gli
LSA type 1 e type 2 sono di fatto quelli che permettono la
costruzione del grafo in quanto sono relativi all'area di
appartenenza di un router. type 1 Propaga
informazioni relative a tutte le reti collegate ad
un router e appartenenti alla sua stessa area. Gli LSA
type 1 vengono inviati ai router di un'area e non ne superano i
confini. Gli LSA di tipo 1 contengono uno di qu Esempi Questo esempio mostra una tipica configurazione OSPF nel caso di un router lato customer di una rete:
router ospf 4
Per resettare il processo OSPF
e rigenerare la tabella di routing si usa "clear ip ospf
process". Ecco l'invio di un comando clear ad un router con
OSPF. La sequenza mostra tutto il processo prova-ct#
clear ip ospf process prova-ct#
*Mar 10 16:07:06.810: OSPF: Flushing External Links
*Mar 10 16:07:06.814: OSPF: Set Nbr 10.121.139.253
1 first flood info from 0 (0)
#
# Quando si manda un LSA questo
viene conservato in attesa dell'ACK
*Mar 10 16:07:06.814: OSPF: Add Type 5 LSA ID
192.13.19.80 Adv rtr 10.121.139.89 # Si trasmette LSA type 5 (si noti che siamo nello stesso istante di prima)
*Mar 10 16:07:06.814: OSPF: Flooding update on
Serial2/0 to 224.0.0.5 Area 0
#
*Mar 10 16:07:06.854: OSPF: Flushing Link states in
area 0 #
*Mar 10 16:07:06.854: OSPF: Stop Serial2/0 flood
timer
#
#
EXCHANGE: In questo stato il router scambia pacchetti DBD,
che
*Mar 10 16:07:08.274: OSPF: Rcv hello from
10.121.139.253 area 0 from Serial2/0
#
*Mar 10 16:07:08.370: OSPF: Rcv DBD from
10.121.139.253 on Serial2/0 seq 0x14B1 opt
0x42 flag 0x3 len 1472 mtu 1500 state EXCHANGE ...
*Mar 10 16:07:08.546: OSPF: Received same lsa ...
*Mar 10 16:07:08.558: OSPF: Rcv Update Type 1, LSID
192.13.2.166, Adv rtr 192.13.2.166, age 1801, seq 0x800034BC
#
*Mar 10 16:07:08.562: OSPF: Received same lsa ...
*Mar 10 16:08:01.894: OSPF: Rcv Update Type 3, LSID
10.121.131.4, Adv rtr 10.121.131.2, age 7, seq 0x80000679 ...
*Mar 10 16:08:04.410: OSPF: Ack Type 3, LSID
192.13.21.237, Adv rtr 10.121.131.2, age 7, seq 0x80000B01 prova-ct#undebug all
Articolo versione beta 0.9 - ultima revisione 16/3/03 Aggiornamento Dicembre 2014: OSPF
SU ASR9000: RP/0/RSP0/CPU0:ASR9001-A#
sh run router ospf !
IOS-XR PLATFORM RP/0/RSP0/CPU0:ASR9001-A#show
ospf neighbor OSPF manda multicast sulle interfacce dove e' attivo alla ricerca dei neighbor. Quindi due router completamente isolati come layer 3 ma con OSPF attivo si troveranno e si scambieranno le righe di routing abilitandosi al layer 3. E' cosi' che noi mettiamo una interfaccia di loopback per router come router-id di OSPF. A quel punto abilitiamo OSPF nelle interfacce che mettono in comunicazione i router tra di loro. Ci garantiamo l'annuncio delle classi configurate nelle interfacce dove OSPF e abilitato. Non ha senso usare come router-id interfacce fisiche perche' potrebbero diventare down e quindi bloccare OSPF dal funzionare correttamente. ! IOS platform router ospf 10100 router-id 10.69.69.4 redistribute connected subnets <--- distribuiamo le classi su tutte le ethernet network 10.100.100.0 0.0.0.255 area 0 <--- OSPF e' attivo sulle interfacce che cadono in questa network maximum-paths 1 <--- evitiamo load-balancing non voluti RP/0/RSP0/CPU0:ASR9001-A#show ospf summary Tue Jan 20 16:53:48.484 MET Routing process "ospf 10" Number of OSPF interfaces 6 <--- INTERFACCE SU CUI E' ATTIVO OSPF Number of OSPF interfaces up 6 <--- INTERFACCE nello stato di UP Number of OSPF virtual interfaces up 0 Number of OSPF sham-link interfaces up 0 Number of neighbors 5 <--- una interfaccia e' una loopback che non ha neighbor Number of neighbors adjacent 5 Number of areas 1 <--- abbiamo solo area 0 in uso LSA Type Count Router : 11 <--- router lsa, ovvero LSA Type 1. LSA relativi ad una singola area. Network : 10 <--- LSA Type 2. Un router DR indica i router collegati in un segmento broadcast Summary Net : 0 Summary ASBR : 0 Type-7 Ext : 0 Opaque Link : 0 Opaque Area : 0 Type-5 Ext : 80 <--- importate in OSPF da altri processi di routing Opaque AS : 0 RP/0/RSP0/CPU0:ASR9001-A#show ospf neighbor Tue Jan 20 17:17:30.136 MET * Indicates MADJ interface Neighbors for OSPF 10 Neighbor ID Pri State Dead Time Address Interface 217.27.118.189 1 FULL/DR 00:00:33 217.27.118.7 Bundle-Ether2.1 Neighbor is up for 6w4d 10.69.69.9 1 FULL/BDR 00:00:31 217.27.118.166 GigabitEthernet0/0/0/0.1 Neighbor is up for 02:27:28 10.69.69.10 1 FULL/BDR 00:00:38 217.27.118.162 GigabitEthernet0/0/0/1.1 Neighbor is up for 00:23:50 10.69.69.11 1 FULL/BDR 00:00:37 217.27.118.170 GigabitEthernet0/0/0/6.1 Neighbor is up for 04:31:31 10.69.69.8 1 FULL/DR 00:00:33 217.27.118.174 GigabitEthernet0/0/0/7.1 Neighbor is up for 5d03h Total neighbor count: 5 ------- RP/0/RSP0/CPU0:ASR9001-A#traceroute 10.69.69.14 PANCALI 217.27.118.186 29 msec 29 msec 2 10.100.100.26 32 msec * 30 msec da lentini RP/0/RSP0/CPU0:ASR9001-A#traceroute 10.69.69.13 AUGUSTA 217.27.118.186 30 msec 32 msec 2 10.100.100.26 [MPLS: Label 137 Exp 0] 31 msec 32 msec 29 msec da lentini 3 10.100.100.22 31 msec * 31 msec RP/0/RSP0/CPU0:ASR9001-A#traceroute 10.69.69.15 PALAGONIA 217.27.118.186 32 msec 31 msec 2 10.100.100.26 [MPLS: Label 136 Exp 0] 30 msec 34 msec 32 msec da lentini 3 10.100.100.30 32 msec * 30 msec RP/0/RSP0/CPU0:ASR9001-A#traceroute 10.69.69.4 SANDEMETRIO 217.27.118.174 31 msec 32 msec 2 10.100.100.14 [MPLS: Label 153 Exp 0] 31 msec 30 msec 30 msec da montepo 3 10.100.100.9 32 msec * 31 msec Appesantiamo Sandemetrio-sandemetrio2 in modo che sandemetrio vada verso lentini invece che montepo GEALINE->montepo-sandemetrio2-sandemetrio->lentini->GEALINE ->pancali - palagonia -ramacca -> augusta RP/0/RSP0/CPU0:ASR9001-A#traceroute 10.69.69.14 217.27.118.186 29 msec 30 msec lentini 2 10.100.100.26 30 msec * 30 msec lentini-pancali Ora augusta fa lentini-sandemetrio-pancali RP/0/RSP0/CPU0:ASR9001-A#traceroute 10.69.69.13 217.27.118.186 30 msec 31 msec 2 10.100.100.6 [MPLS: Label 184 Exp 0] 31 msec 31 msec 30 msec 3 10.100.100.53 [MPLS: Label 137 Exp 0] 30 msec 31 msec 30 msec 4 10.100.100.22 31 msec * 31 msec Vediamo tutto cio’ che annuncia il router 10.69.69.13 e che arriva all’ASR. Quindi abbiamo l’elenco delle reti gestite da 10.69.69.13 nelle sue vlan: RP/0/RSP0/CPU0:ASR9001-A#show ospf database adv-router 10.69.69.13 Wed Apr 8 14:52:37.580 MEDT OSPF Router with ID (217.27.118.130) (Process ID 10)
10.69.69.13 10.69.69.13 1469 0x800005cd 0x0088c2 1
10.69.69.13 10.69.69.13 1469 0x800005b7 0x00752c 0 172.17.6.0 10.69.69.13 1469 0x8000035a 0x00a03e 0 172.18.24.0 10.69.69.13 1469 0x8000035b 0x00bc11 0 172.20.96.0 10.69.69.13 1469 0x800002aa 0x00ed47 0 172.26.5.0 10.69.69.13 1469 0x8000035b 0x003d98 0 RP/0/RSP0/CPU0:ASR9001-A# Vediamo la route corrente per raggiungere 10.69.69.4 che ha due strade possibili: RP/0/RSP0/CPU0:ASR9001-A#show ospf routes 10.69.69.4/32 Wed Apr 8 17:03:58.844 MEDT Topology Table for ospf 10 with ID 217.27.118.130 Codes: O - Intra area, O IA - Inter area O E1 - External type 1, O E2 - External type 2 O N1 - NSSA external type 1, O N2 - NSSA external type 2 O E2 10.69.69.4/32, metric 20 area 0.0.0.0 217.27.118.186, from 10.69.69.4, via GigabitEthernet0/0/0/5.1 RP/0/RSP0/CPU0:ASR9001-A#show ospf database router 10.69.69.14 Wed Apr 8 17:19:02.454 MEDT OSPF Router with ID (217.27.118.130) (Process ID 10) Router Link States (Area 0) Routing Bit Set on this LSA LS age: 1047 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 10.69.69.14 Advertising Router: 10.69.69.14 LS Seq Number: 80000624 Checksum: 0xd908 Length: 60 AS Boundary Router Number of Links: 3 <— 10.69.69.14 difatti ha tre vicini di cui il primo che naviga e gli altri due a reti remote che alimenta Link connected to: a Transit Network (Link ID) Designated Router address: 10.100.100.54 (Link Data) Router Interface address: 10.100.100.53 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 10.100.100.29 (Link Data) Router Interface address: 10.100.100.29 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 10.100.100.21 (Link Data) Router Interface address: 10.100.100.21 Number of TOS metrics: 0 TOS 0 Metrics: 1 Invece 10.69.69.13 e’ l’ultimo nodo della rete quindi ha un solo link: RP/0/RSP0/CPU0:ASR9001-A#show ospf database router 10.69.69.13 Wed Apr 8 17:22:29.927 MEDT OSPF Router with ID (217.27.118.130) (Process ID 10) Router Link States (Area 0) Routing Bit Set on this LSA LS age: 457 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 10.69.69.13 Advertising Router: 10.69.69.13 LS Seq Number: 800005d2 Checksum: 0x7ec7 Length: 36 AS Boundary Router Number of Links: 1 <— un vicino perche’ e’ foglia Link connected to: a Transit Network (Link ID) Designated Router address: 10.100.100.21 <- punto-punto a cui e’ collegato (Link Data) Router Interface address: 10.100.100.22 <— lato suo Number of TOS metrics: 0 TOS 0 Metrics: 1 ——— OSPF non tiene in memoria i path di backup: This is because ospf re-runs the spf algorithm each time there's a topology change like say a link going down. This is where EIGRP trumps ospf cos it stores the backup links. Pero’ con i comandi di cui sopra si hanno alcune informazioni utili. First of all, OSPF has no backup path concept like we can find in EIGRP. If a link fails in the area the router(s) connected to the failed link generate a new Router LSA stating the state of the link as down. The LSA(s) is flooded in the area all routers run SPF and eventually make changes to the IP routint table for one or more destinations. —————— Route di default in ASR 9000 Ci vuole 1) default-information originate 2) una statica per la 0.0.0.0 router ospf 10 router-id 217.27.118.130 default-information originate area 0 interface Bundle-Ether2.1 ! interface Loopback1 ! interface GigabitEthernet0/0/0/0.1 ! ! router static address-family ipv4 unicast 0.0.0.0/0 100.126.0.1 Per verificare che annuncia: RP/0/RSP0/CPU0:ASR9001-A#show ospf database | include 0.0.0.0 Thu Apr 30 12:14:13.505 MEDT 0.0.0.0 217.27.118.130 422 0x80000001 0x0010ab 10 RP/0/RSP0/CPU0:ASR9001-A# In un router della rete per verificare la ricezione: ASR901-8-AUGUSTA#show ip route 0.0.0.0 Routing entry for 0.0.0.0/0, supernet Known via "ospf 10110", distance 110, metric 1, candidate default path Tag 10, type extern 2, forward metric 2 Last update from 10.100.100.18 on Vlan500, 00:08:13 ago Routing Descriptor Blocks: * 10.100.100.18, from 217.27.118.130, 00:08:13 ago, via Vlan500 Route metric is 1, traffic share count is 1 Route tag 10 ASR901-8-AUGUSTA# ——————
Altre letture Consiglio di consultare l’enorme documentazione disponibile on-line nel sito della cisco http://www.cisco.com/ . E’ possibile trovare sempre tutto cio’ che si cerca.
Copyright 2002-2004 Gianrico Fichera – ITESYS srl – Il
materiale di questa pagina non e’ sponsorizzato o
sottoscritto da Cisco Systems, Inc. Ciscoâ
e’ un trademark di Cisco Systems, Inc. negli Stati Uniti e
in altri stati. L’autore di questa pagina non si assume
nessuna responsabilita’ e non da nessuna garanzia
riguardante l’accuratezza e la completezza delle
informazioni presenti nonche’ da conseguenze sull’uso
delle informazioni presenti in questa pagina. |