This entire series on routing was created when I was preparing for the Cisco 642-901 BSCI test, as my notes. I then made a simple edit and published the text. If you think something essential is missing, something is not described correctly or is not entirely clear, I will welcome your information in the comments.
OSPF Properties
- an open standard, probably the most widely used IGP protocol in larger companies
- it is a classless protocol / supports VLSM
- uses the Dijkstra shortest path algorithm - SPF
- collaborates with MPLS (Multi Protocol Label Switching) - maintains routing tables
- large OSPF networks should be divided into areas - reduces SPF computation, smaller routing tables, reduced LSU (link-state update)
- thanks to the areas, it supports a hierarchical network design
- uses a link-state database, which prevents loops
- manual summarization can be used to reduce routing tables, but automatic summarization is not supported
- routing updates are sent only when needed
- uses multicast (so it doesn't affect stations and other devices without OSPF), 224.0.0.6 - all DR and BDR, 224.0.0.5 - all routers, 224.0.0.2 - all routers on the same subnet
- does not use TCP, but IP protocol 89, it handles error detection and correction itself
- supports authentication, plain text or MD5, for accepting LSA
- uses a hello protocol - better than exchanging tables in RIP, uses it to establish adjacency, sends every 10s
- for routers to become neighbors, the hello packet must have matching values - area number, area type (stub or NSSA flag), subnet and subnet mask, hello and dead timer, authentication data
- LSA is sent every 30min or upon change, spread using flooding
- link cost for OSPF
cost = 100Mb / bandwidth - OSPF router ID (set at restart) is the highest IP address (active) on the router or the loopback interface address (this is recommended, as it is always up)
- DR/BDR election is based on the configured priority or Router ID, occurs only in multi-access networks, not in point-to-point, when the DR fails, the BDR becomes the DR and a new BDR is elected, if the original DR comes back online, it does not automatically become the DR (only when the DR and BDR both fail)
- if an area cannot be directly connected to the backbone, it can be connected to another area that is directly connected to area 0, and a virtual link must be created (a logical path to the backbone through the transit area) - identified by the neighbor router's router ID (if set incorrectly, it won't be created)
- area boundaries are defined within the router
- up to 30 OSPF routing processes can run on a router
Tables for OSPF
- routing - the best routes to destinations
- topology - routing records for all destinations
- neighbors - information about neighboring routers
- link-state database - the same for all routers, synchronized through LSA flooding, used to create routing tables, a tree-structured image of the network topology
OSPF Routes (Record Types)
- O - OSPF network within the same area (intra-area)
- O IA - OSPF inter-area, from ABR (LSA 3 and 4)
- O* IA - default OSPF inter-area
- O N1 - OSPF NSSA external type 1
- O* N2 - default OSPF NSSA external type 2
- O E1 - OSPF external type 1, from ASBR,
- O* E2 - default OSPF external type 2
OSPF Area Types
- standard area - accepts link updates, summary routes, and external routes
- backbone area - connects all other areas, always Area 0, same properties as standard
- stub area - does not receive routes from other AS (autonomous system), a default route is used for routing outside the AS, O, O IA, O* IA
- totally stubby area - Cisco proprietary, does not receive summary routes outside its area, O, O* IA
- not-so-stubby area (NSSA) - similar to stub, but imports some external type 7 LSA routes and converts them to type 5 LSA, O, O IA, O N2, O* N2
OSPF Router Types
- Area Border Router - ABR - has interfaces in multiple areas, has a separate link-state table for each area, connects areas to the backbone
- Autonomous System Border Router - ASBR - has interfaces in multiple AS, used to distribute routes from another AS, often also runs BGP
- Internal Router - regular, only in one area
- Backbone Router - at least one interface in Area 0
DR/BDR Routers
- Designated Router - DR - sends LSA 2 to all neighbors in multi-access, it is the router (or more precisely, the router interface) that is elected within the segment in multi-access (using special techniques even in NBMA), serves to reduce network traffic, the DR is the source of routing updates, maintains a complete topology table, all other routers establish a connection with it
- Backup Designated Router - BDR - becomes the DR if the original DR fails, has the second highest priority during the election
Link State Advertisements - LSA in OSPF
- type 1 - router, information about the router and its directly connected interfaces, only within the area, generated by each router
- type 2 - network, information about the LAN and the routers in it, in a multi-access network it originates from the DR, only within the area
- type 3 - summary, originates from the ABR (Area Border Router), networks accessible outside the area, for the ABR
- type 4 - ASBR summary, originates from the ABR, for the ASBR
- type 5 - external AS, announces external routes (default route), originates from ASBR, within the AS
- type 6 - multicast info
- type 7 - other extensions - NSSA
Network Types
- broadcast multi-access (BMA) - shared medium, Ethernet, DR and BDR are elected automatically
- nonbroadcast multi-access (NBMA) - without subinterfaces, typically serial Frame Relay, DR and BDR require manually defined neighbors
- point-to-point (PtoP)- connection between two routers, does not require DR and BDR
- point-to-multipoint (PtoM) - one interface that connects to multiple destinations (using subinterfaces), a series of point-to-point circuits, no DR/BDR election, often serial Frame Relay, automatically forms adjacency (no need for manual definition)
Cisco IOS Commands for Configuring OSPF
ROUTER(config)#router ospf 1 // 1 is the process-id, we can run multiple processes on a router ROUTER(config-router)#network 192.168.5.4 0.0.0.3 area 1 // uses wildcard mask, 1 is the area number ROUTER(config-router)#neighbor 192.168.5.4 // defines a neighbor, can include priority/cost ROUTER(config-router)#summary-address 10.1.0.0 255.255.0.0 // summarize networks on ASBR ROUTER(config-router)#redistribute connected [subnets] // sends all local interfaces, subnets - also sends subneted routes ROUTER(config-router)#passive-interface Serial0/0 // the given interface does not send or receive updates ROUTER(config-router)#area 1 stub // designates area 1 as a stub ROUTER(config-router)#area 1 stub no-summary // does not send LSA 3 and 4 = totally stubby ROUTER(config-router)#area 1 nssa no-summary // does not send LSA 3 and 4 = NSSA totally stubby ROUTER(config-router)#area 1 range 10.1.0.0 255.255.0.0 // summarize networks on ABR, can specify whether to advertise - keyword advertise ROUTER(config-router)#area 16 virtual-link 8.187.175.82 // virtual link to IP (e.g. loopback) into the backbone ROUTER(config-if)#ip ospf network point-to-multipoint // sets the mode on the interface, other options are broadcast, non-broadcast, point-to-point ROUTER(config-if)#encapsulation frame-relay // sets the encapsulation on the interface ROUTER(config-if)#ip ospf priority 10 // sets the priority for DR election ROUTER(config-if)#ip ospf cost 10 // sets the cost of outgoing packets on the interface ROUTER(config-if)#frame-relay map ip 10.1.1.1 200 broadcast // 200 = DLCI (Data-link connection identifier), broadcast is needed for Frame Relay ROUTER#show ip ospf // main information about the OSPF process, areas, etc. ROUTER#show ip ospf border-routers // internal routing records to ABR and ASBR ROUTER#show ip ospf neighbor // information about neighbors per interface including link state, excluding ABR, ASBR, SPF ROUTER#show ip ospf interface // information from the given interface related to OSPF (link state, etc.) - router ID, neighbor relationship ROUTER#show ip ospf virtual-link // info about the virtual link to the backbone ROUTER#show ip ospf database // info about topology, link state, LSA
OSPF and IPv6
- IPv6 is supported in OSPF version 3 (and only for IPv6, not IPv4), the basis is similar to the previous OSPF versions, but there is a new configuration mode
- we can run multiple OSPF IPv6 instances
- the
networkcommand is not used to include an interface in the routing process, but the interface is configured directly
ROUTER#show ipv6 ospf // main information about the OSPF process, areas, etc. ROUTER#clear ipv6 ospf process // the OSPF DB will be refreshed and the SPF will be restarted ROUTER(config)#ipv6 unicast-routing // enables IPv6 support ROUTER(config)#ipv6 router ospf 1 // enables OSPF IPv6, 1 - internal process-id identification 1 to 65535 ROUTER(config-if)#ipv6 ospf 1 area 5 // enables OSPF IPv6 for the interface, 1 - process-id, 5 - area-id ROUTER(config-if)#ipv6 ospf authentication ipsec spi 500 md5 // IPsec authentication
OSPF nepodporuje MPLS. Je pouze jedním z protokolů, které jsou použitelné ke spolupráci s LDP. (pod pojmem "podporuje" bych chápal to, že by byl schopen distribuovat labely, což nedělá)
respond to [1]davro: Děkuji za info. S MPLS nemám žádné zkušenosti. Absolvoval jsem pouze krátký seminář a z něj jsem si odnesl následující informaci (doufám, že správnou).
Pro výpočet/údržbu routovacích tabulek v MPLS se používá link-state IGP (jako OSPF nebo IS-IS). Protokol LDP (Label Distribution Protocol) spravuje značky (label) a vazby mezi routami a značkami. Na Control Plane pak běží dohromady LDP (nebo alternativní protokol) a IGB (třeba OSPF).
respond to [2]Samuraj: To je správně. Nicméně to neznamená podporu MPLS, protože toho se dá dosáhnout s libovolným protokolem.
Podporou MPLS bych rozumněl takovou situaci, kdy bude OSPF distribuovat i značky, čehož by asi modifikací protokolu šlo dosáhnout.
Nicméně přístup s odděleným protokolem pro distribuci značek je hezčí, protože není nutné modifikovat směrovací protokol a funguje v podstatě s každým protokolem.
respond to [3]davro:
myslím, že by nebyl dobrý nápad nechat ospf distribuovat labely.
1. jedná se o LS, tedy informace o labelech, které se "per-hop" mění by byly zbytečně a nefektivně ve všech databázích (ls protokoly distribuují všechny informace do celé sítě (chápej area))
2. labely nemají nic společného s výměnou směrovacích informací směrovacími protokoly, ale spíše s používanou směrovací tabulkou. Ta jak víme přímo s tím co máme za informace v ospf nesouvisí :)
respond to [3]davro:
myslím, že by nebyl dobrý nápad nechat ospf distribuovat labely.
1. jedná se o LS, tedy informace o labelech, které se "per-hop" mění by byly zbytečně a nefektivně ve všech databázích (ls protokoly distribuují všechny informace do celé sítě (chápej area))
2. labely nemají nic společného s výměnou směrovacích informací směrovacími protokoly, ale spíše s používanou směrovací tabulkou. Ta jak víme přímo s tím co máme za informace v ospf nesouvisí :)
respond to [5]tomfi:
2. to není tak úplně pravda, labely se mohou přidělovat podle různých kritérií, třeba i podle mac adres nebo staticky (a vytvářet tak EoMPLS). Nicméně ve speciálních případech by se modifikované OSPF pro distribuci labelů dalo použít (např. v síti běží jako směrovací protokol pouze OSPF a všechny další routy jsou redistribuovány do OSPF). Ale asi je zřejmé, že samostatný protokol je nezávislejší a tudíž lepší.
Este by som pridal ze existuje aj NSSA totally stubby area, je to Cisco extension, ktora automaticky generuje defaultnu routu O*N2 , nieje nutne davat area x nssa default-information originate na ABR,potom do NSSA je advertisovana iba ta routa, O IA su supresnute na ABR.
K network types, existuje este point-to-multipoint nonbroadcast, opat cisco proprietarny,rozdely oproti standardu su tie ze funguje na WAN sietach kde nieje povoleny broadcast/multicast, pri tomto mode sa musia konfigurovat susedia rucne (na hube),a elekcia DR/BDR nieje vyzadovana
Ahoj,
posilam drobne doplneni clanku o par poznatku:
aby se routery staly sousedy, hello paket musí mít shodné hodnoty - dalsi nutna podminka je shodne MTU, ale to plati pro vetsinu routovacich protokolu.
Typ site Point-to-multipoint (PtoM) - jeden interface, který se připojuje k více cílům - je potreba manualne zvolit DR, ten ktery je hubem
to co dal pises je obejiti pomoci subinterfacu
jinak diky za prehledne shrnuti
Ahoj, chtěl bych se zeptat kdo je autorem algoritmu OSPF
Díky za odpověď