Topic: tech juniper jir prev next
tech juniper jir > 06: Fundamentals of OSPF
OSPF is a link state interior gateway protocol (IGP). OSPF routers floods link state advertisements (LSAs). Each router keeps a link state database (LSDB) to compute the shortest path to a destination. The LSDB must be identical on all routers in an OSPF area to ensure accurate routing. OSPF uses Dijkstra’s algorithm to compute the shortest path to each destination prefix. The next hops from the resulting shortest paths are added to the routing information base (RIB).
As a link state protocol, OSPF is better for larger internetworks than distance vector protocols. It is also less susceptible to bad routing information.
OSPF does not use a transport layer protocol, such as TCP (6) or UDP (17). This is because TCP does not support multicast, and UDP is unreliable. Instead, it has its own IP protocol number (89).
Five packet types:
Link state advertisements (LSAs) comprise all three link state packets.
The hello time is ten seconds by default. 224.0.0.5
is the all OSPF routers
multicast address.
The following fields, in the hello packet, must match for a pair of routers to form an adjacency:
Database description (DD) packets are exchanged during adjacency formation to determine which router is in charge of the database exchange. The router with the highest router ID is the primary router; the other is the backup router. DD packets describe the contents of the LSDB. They consist of the OSPF header, a sequence number, and LSA headers. An LSA header contains enough information to identify that specific LSA. It is the job of the primary router to set the sequence numbers whilst the database transfer takes place. Once the transfer has been completed, the primary/backup router relationship is forgotten.
Link state request packets are sent in response to DD packets advertising LSA headers not in its own database. It is a request for information. The other router will respond with link state update (LSU) packets. The link state request packet contains the OSPF header, link state type, link state id, and advertising router (that originated the LSA).
Link state update packets are the basic information block and can carry
multiple LSAs. They are sent to the OSPF all routers address 224.0.0.5
or
the OSPF all designated routers address 224.0.0.6
. The link state update
packet contains the OSPF header, the number of advertisements, and the link
state advertisements. Link state update packets may be sent in response to a
LSR packet, or proactively when the network changes.
Link state acknowledgement (LSA) packets are sent unicast to the sending router to confirm that information was received. An LSA can acknowledge multiple LSU packets.
OSPF forming an adjacency states:
By default, OSPF tries to form adjacencies with all neighbours discovered on all interfaces. This is a problem on broadcast networks such as Ethernet segments, because every router on the network would be advertising the same information, wasting resources. OSPF optimises by selecting a designated router (DR) and a backup designated router (BDR) for each Ethernet segment.
Adding interface-type p2p;
to a Junos interface
forces Junos to ignore the
DR/BDR election process. This saves up to forty seconds of waiting time for
adjacencies to form. This is useful when connecting routers directly over
Ethernet.
Every OSPF router has a designated router election priority. The priority range is 0-255, the default is 128. The designated router is determined based on priority (higher numbers are higher priority) and router ID (again, higher numbers are higher priority). The election of a DR is nondeterministic; a DR continues to operate as DR even if a router with higher priority joins the Ethernet segment. After the designated router is elected, a backup designated router (BDR) is elected using the same process.
The backup designated router monitors the designated router. If the designated router becomes unavailable, the backup designated router becomes the designated router and a new backup designated router is elected.
There is a difference between neighbours and adjacencies. Routers on an Ethernet segment will only form full adjacencies with the DR and BDR. The DR and BDR for adjacencies with all other routers. Routers which are not DRs or BDRs stop at 2way in the adjacency formation process.
All OSPF routers share an LSDB. Reducing the size of the LSDB is achieved by splitting OSPF into areas. Route summarisation is performed at the borders. This reduces the size of the LSDB and hides instabilities in areas of the network from other areas.
Area 0 is the backbone area. All packets between OSPF areas must transit the backbone area. An area border router (ABR) belongs to area 0 and another area. An ASBR (AS boundary router) injects routing information from outside the OSPF domain. ASBRs are usually, but not always, in the backbone area. Backbone routers have at least one link in area 0. Internal routers have all their links in the same area. If an internal router is located in the backbone area, it is also known as a backbone router.
Routes are referred to as intra-area or internal if the source and destination are in the same area. Routes are inter-area or summary routes if they cross from one area into another. External routes are those which are redistributed into OSPF from other routing protocols.
Stub areas are those into which external routes are not flooded. They can be useful as they reduce the amount of routing information that must be flooded through OSPF. A totally stubby area receives only a default route. A stub area does not contain any external routes. A not-so-stubby stub area accepts external routes to be advertised into OSPF, but does not receive these routes from other areas.
Type 1 LSAs describe router links; the state and cost of the router’s links to the area (intra-area). Type 2 LSAs are used on segments with more than one router. They describe all routers attached to the same segment. Type 2 LSAs are originated by DRs. Summary link LSAs, types 3 and 4, are originated by ABRs and describe networks in the AS but outside of the interarea. They also describe the location of the ASBR.
Type 5 LSAs are redistributed from other protocols. Type 7 LSAs are sent by ASBRs in NSSAs (not so stubby areas) to import external routes into a stub area. There are 11 types in total.
NSSA areas do not accept type 4 or 5 LSAs.