OSPF Design and LSAs
- Most OSPF design choices directly impact the LSA types in a network and impose restrictions on which neighbors can exchange those LSAs.
OSPF Design Terms
- Area Border Routers (ABRs) = Routers that connect to different areas.
- ABRs must connect to area 0, the backbone area, and to one or more other areas.
- Only a router that is actively attached to multiple areas, including the backbone area, considers itself an ABR and performs the appropriate functions.
- A router actively attached to multiple areas but not to the backbone area does not consider itself an ABR and does not act like one.
- Autonomous System Boundary Routers (ASBRs) inject external routes into the OSPF domain.
- OSPF keeps an independent and separate LSDB for each area to which it is connected.
- By default, the contents of per-area LSDBs are completely isolated. One LSDB does not leak into another.
- Only the ABR can translate and carry information between the areas in a controlled way.
- The SPF is run in each LSDB separately, and the results are combined into the routing table subject to the OSPF path preference rules.
- Using OSPF areas provides the following benefits:
- Generally smaller per-area LSDBs, requiring less memory.
- Faster SPF computation.
- A link failure in one area only requires a partial SPF computation in other areas.
- Routes can be summarized and filtered only at ABRs.
- The number of routers and subnet does not shrink in multiarea OSPF design, but the LSDB does.
- An ABR does not pass denser and more detailed Type 1 and 2 LSAs between areas - instead, Type 3 LSAs are passed.
OSPF Path Selection Process
- OSPF always chooses an intra-area route over an inter-area route for the same prefix, regardless of metric.
- ABRs ignore Type 3 LSAs learned in a non-backbone area during SPF calculation.
LSA Types
- Only a router that has originated a particular LSA is allowed to modify or withdraw it.
- Other routers must process and flood this LSA, but they must never change its contents, block it, or drop it before its maximum lifetime has expired.
- This makes sure that all routers in an area have the same LSDB contents and the same view of the network.
- Summarization and route filtering can be done in very limited fashion vs. distance vector protocols where these functions can be performed at any point in the network.
Type 1 LSA - Router
- One per router per area, listing the router's RID and all interface IP addresses in that area.
- Represents stub networks as well.
- Flooded only within its area of origin.
Type 2 LSA - Network
- One per transit network.
- Created by the DR on the subnet, and represents the subnet and the router interfaces connected to the subnet.
- Flooded only within its area of origin.
Type 3 LSA - Net Summary
- Created by ABRs to represent networks in one area when advertised into another area.
- Defines the subnets in the origin area, and cost, but no topology data.
- Flooded only within its area of origin; reoriginated on ABRs.
Type 4 LSA - ASBR Summary
- Like Type 3 LSA, except it advertises a host route used to reach an ASBR.
- Flooded only within its area of origin; reoriginated on ABRs.
Type 5 LSA - External
- Created by ASBRs for external routes injected into OSPF.
- Flooded to all regular areas.
Type 6 LSA - Group Membership
- Defined for MOSPF.
- Not supported by Cisco IOS.
Type 7 LSA - NSSA External
- Created by ASBRs inside an NSSA, instead of a Type 5 LSA.
- Flooded only within its area of origin; converted to Type 5 LSA on an ABR toward other areas.
Type 8 - External Attributes
- Created by ASBRs during BGP-to-OSPF redistribution to preserve BGP attributes of redistributed networks.
- Not implemented in Cisco routers.
Type 9-11 LSAs - Opaque
- Used as generic LSAs to allow for easy future extension of OSPF. For example, Type 10 LSA has been adapted for MPLS traffic engineering.
- These LSAs have different flooding scope: Type 9 has link-local flooding scope, Type 10 has area-local flooding scope, and Type 11 has autonomous system flooding scope equivalent to the flooding scope of Type 5 LSAs (not flooded into stubby areas or NSSAs).
- Transit network: A network over which two or more OSPF routers have become
neighbors and elected a DR so that traffic can transit from one to the other. - Stub network: A subnet on which a router has not formed any neighbor relationships.
LSA Types 1 and 2
- Each router creates and floods a Type 1 LSA for itself.
- These LSAs describe the router, its interfaces (in that area), and a list of neighboring routers (in that area) on each interface.
- Identified by a link-state ID (LSID) equal to that router's RID
- Type 2 LSA represents a transit subnet for which a DR has been elected.
- The LSID is the interface IP address on that subnet.
- Type 2 LSAs are not created for subnets on which no DR has been elected.
- Armed with an LSDB with all the Type 1 and 2 LSAs inside an area, the SPF algorithm is able to create a topological graph of the network, calculate the possible routes, and finally choose the best routes.
- The Type 2 LSA includes references to the RIDs of all routers that are currently neighbors of the DR on that subnet. That information, combined with the Type 1 LSAs for each router connected to the subnet represented by the Type 2 LSA, allows SPF to construct an accurate picture of the network.
- Be aware of a long-term glitch in the show ip ospf database output: the Link ID column should say Link State ID.
- While Link State ID is a unique identifier for an entire LSA, a Link ID is a particular entry specifically in a Type 1 LSA body that describes an adjacency to a neighboring object of a router.
- A single Type 1 LSA identified by a single Link State ID can describe several adjacencies represented by several Link ID entries.
- These two terms are not interchangeable.
- The show ip ospf database command lists the LSAs in that router's LSDB in sequential order.
- To signify a network that is down, the appropriate Type 1 or 2 LSA is either reoriginated and the disconnected network is removed from that LSA, or the entire LSA is prematurely aged by setting its age to 3600 seconds and flooding it, causing it to immediately expire from all LSDBs.
LSA Type 3 and Inter-Area Costs
- ABRs do not forward Type 1 and 2 LSAs from one area to another.
- ABRs advertise Type 3 LSAs, which represent subnets described in both Type 1 and 2 LSAs in another area.
- Describe a simple inter-area destination: the subnet, the mask, and the ABR's cost to reach that subnet.
S2# show ip ospf database
! Lines omitted for brevity
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.3.0.0 1.1.1.1 257 0x80000001 0x00A63C
10.3.2.0 1.1.1.1 257 0x80000001 0x009A45
10.3.13.0 1.1.1.1 261 0x80000021 0x007747
S2# show ip ospf database summary 10.3.0.0
OSPF Router with ID (8.8.8.8) (Process ID 1)
Summary Net Link States (Area 0)
Routing Bit Set on this LSA
LS age: 341
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.3.0.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0xA63C
Length: 28
Network Mask: /23
TOS: 0 Metric: 74
- Next, S2's routes to all three subnets are listed. S2 calculates its cost based on its cost to reach R1, plus the cost listed in the type 3 LSA.
S2# show ip route ospf
O IA 10.3.0.0/23 [110/75] via 10.1.1.1, 00:05:08, Vlan1
S2# show ip ospf border-routers
OSPF Process 1 internal Routing Table
Codes: i – Intra-area route, I – Inter-area route
i 1.1.1.1 [1] via 10.1.1.1, Vlan1, ABR, Area 0, SPF 18
- Routers calculate the cost for a Typer 3 LSA route by adding the following:
- The calculated cost to reach the ABR that created and advertised the Type 3 LSA. (show ip ospf database summary <link-id>).
- The cost as listed in the Type 3 LSA. (show ip ospf border-routers)
- When a Type 1 or 2 LSA changes in some way, each router in the area runs SPF, but routers inside other areas do not. They only run minor modications - a process called a partial run, partial SPF, or partial route calculation.
- Type 3 summary LSAs are flooded only within the are into which they were originated by ABRs.
- An ABR uses only Type 3 LSAs received over a backbone area in its calculation. Type 3 LSAs received over non-backbone areas will be skipped during the ABR's SPF computation, though they are stored in the ABR's LSDB and flooded within that non-backbone area as usual.
- Only intra-area routes from non-backbone areas are advertised into the backbone; both intra-area and inter-area routes are advertised from the backbone into non-backbone areas.
LSA Types 4 and 5, and External Route Types 1 and 2
- OSPF allows for two types of external routes, aptly named types 1 and 2.
- The type determines whether only the external metric is considered by SPF when picking the best routes (external type 2, or E2), or whether both the external and internal metrics are added together to compute the metric (external type 1, or E1).
- By default, Cisco routers use the E2 metric type in redistribution.
- When an ASBR injects an external route, it creates a Type 5 LSA for the subnet.
- The LSA lists the metric and the metric type.
- The ASBR then floods the Type 5 LSA throughout all regular areas.
- If the LSA contains the E1 metric, the total cost of the external network is the cost of reaching the ASBR + the E1 cost carried in the LSA.
- If the LSA contains the E2 metric, this metric is used exactly as it is indicated in the LSA.
- If there are multiple paths, the path with the least total cost is used. Otherwise, all of them will be used.
- No additional costs are ever summed with the E2 metric.
- If there are multiple paths, the path with the lowest E2 metric is used.
- If there are still multiple paths, the path through the closest ASBR is used.
- If there ara still multiple paths, all of them will be used.
- If there are both E1 and E2 routes to the same network, the E1 is always preferred to E2.
- With both E1 and E2 metric types, it is necessary to compute the metric to the ASBR.
- Within the area where the ASBR resides, this is simply the least-cost path from the computing router to the ASBR as computed using Type 1 and 2 LSAs.
- When an ABR floods the Type 5 LSA into another area, it creates a Type 4 LSA, containing the ASBR's RID and the ABR's metric to reach the ASBR.
- Routers in other areas use the Type 4 LSA to know what ASBRs in other areas exist, what ABRs can be used to reach them, and what is the distance of each ABR to a particular ASBR.
- For a router in a different area, the total cost of reaching the ASBR = the cost to the ABR + the cost between the ABR and ASBR (as indicated in the Type 4 LSA).
- Type 4 LSA is not required in the area where the ASBR resides.
R3# show ip ospf database | begin Type-5
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.1.0 7.7.7.7 1916 0x8000002B 0x0080EF 0
192.168.2.0 7.7.7.7 1916 0x80000028 0x00FEF2 0
R3# show ip ospf database external 192.168.2.0
OSPF Router with ID (3.3.3.3) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 1969
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 192.168.2.0 (External Network Number)
Advertising Router: 7.7.7.7
LS Seq Number: 80000028
Checksum: 0xFEF2
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
- Note about the usage of summary in OSPF:
- Type 3 and 4 LSAs are called summary LSAs.
- The term LSA summary refers to the LSA headers that identify LSAs and are sent inside DD packets.
- The term summary can also be used to refer to summary routes created with the area range and summary-address commands.
Stubby Areas
- Areas that do not perform any automatic filtering on the type of accepted information are called regular areas.
- Stubby areas take advantage of the fact that not all areas need to have knowledge about individual external networks.
- The advantage of knowing the external networks is only visible if there were multiple ABRs in the current area and multiple ASBRs in other areas, so the least-cost paths could be chosen individually.
- The connectivity to external networks can be equivalently provided to a stubby area by replacing the list of external networks with a simple default route injected by the area's ABRs.
- If an area is configured as a stubby area, ABRs will stop advertising Type 4 and 5 LSAs into this area.
- In addition, the ABRs will automatically inject a default route into the area as Type 3 LSA.
- The connectivity to external networks is still guaranteed but the LSDBs will be sparser.
- The visibility of intra-area and inter-area networks is not affected in any way.
- OSPF defines several different types of stubby areas.
- By definition, all stubby areas stop Type 4 (ASBR summary) and Type 5 (external) LSAs.
- However, a stubby area might also prevent Type 3 LSAs from being injected, causing the area to stop seeing individual inter-area routes as well.
- Another variation includes whether a router inside the stubby area can redistribute routes into OSPF, thereby injected an external route.
- When the name includes "totally", Type 3 LSAs are not passed into the area, except the Type 3 LSA carrying the default route.
- If the name includes "NSSA", it means that external routes can be redistributed into OSPF by routers inside the stubby area (in Type 7 LSAs, because Type 5 LSAs are prohibited).
- To configure stubby areas, all routers attached to the area must be configured with the exact same command for each stubby area type.
- However, in totally stubby areas, non-ABRs should omit the no-summary keyword because the additional Type 3 LSA filtering is performed only by the ABR.
- An NSSA is still a stubby area in the sense that external routes from other areas are not advertised to it.
- However, an NSSA can hold an ASBR and perform external route injection.
- This external information is carried in Type 7 LSAs to distinguish it from normal external routes in Type 5 LSAs, which are still prohibited even in NSSAs.
- A default route is not advertised into the NSSA automatically.
- ABRs must be configured with the area <area-id> nssa default-information-originate command.
- All other non-regular area types will inject a default route automatically, including totally NSSA (NSSA-TS).
- ABRs convert Type 7 LSAs to Type 5 LSAs before forwarding them into another area.
- If using NSSAs, N1 refers to NSSA-external Type 1 routes and N2 to NSSA-external Type 2. The differences are equivalent to differences between E1 and E2 routes.
OSPF Path Choices That Do Not Use Cost
- Under most circumstances, when an OSPF router runs the SPF algorithm and finds more than one possible route to reach a particular subnet, the router chooses the route with the least cost.
- However, OSPF does considers a few conditions other than cost when making this best-path decision.
- It is possible for a router to find multiple routes to reach a given subnet where the type of route (intra-area, inter-area, E1/N1, or E2/N2) is different.
- In these cases, the router should ignore the costs and instead choose the best route based on the following order of preference:
- Intra-area routes.
- Inter-area routes.
- E1/N1 routes (equivalent).
- E2/N2 routes (equivalent).
- When an ABR originates type 3 LSAs on behalf of known routes, it translates only intra-area routes from a nonbackbone area into type 3 LSAs and floods them into the backbone, and it translates both intra-area and inter-area routes from the backbone area into type 3 LSAs and floods them into nonbackbone areas.
- When an ABR runs the SPF algorithm, it ignores all type 3 LSAs received over nonbackbone areas.
- The first rule essentially makes sure that the only valid way of one area learning about
routes in another area is through the backbone, and that the backbone is never fed a
route that must have already traversed the backbone. - The second rule makes sure that an ABR does not traverse a nonbackbone area to reach
a network that is located in the backbone or in some other nonbackbone area.
No comments:
Post a Comment