OSPF
Types of OSPF LSAs and Their Functions
Type 1
Router LSA
Intra-area
Describes router’s interfaces and neighbors. The Router LSA is generated by each router for each area it is located. In the link-state ID you will find the originating router’s ID.
Type 2
Network LSA
Intra-area
Generated by DR; lists routers on multi-access networks. The link-state ID will be the interface IP address of the DR.
Type 3
Summary LSA
Inter-area
Advertises networks from one area to another. The summary LSA is created by the ABR and flooded into other areas.
Type 4
ASBR Summary
LSA Inter-area
Advertises reachability to ASBRs By ABR. A summary ASBR LSA will include the router ID of the ASBR in the link-state ID field.
Type 5
External LSA
Autonomous System
Also known as autonomous system external LSA. The external LSAs are generated by the ASBR to describes routes redistributed into OSPF (e.g., from BGP).
Type 6
Group Membership
LSA Reserved
Used for multicast OSPF (rarely implemented)
Type 7
NSSA External LSA
NSSA only
Like Type 5, but used in Not-So-Stubby Areas. An NSSA (not-so-stubby-area) doesn’t allow external LSAs (type 5). To overcome this issue we are generating type 7 LSAs instead.
Type 8–11
Opaque LSAs
Varies
Used for extensions like traffic engineering, BGP attributes, etc.
Area Boundaries
Type 1 and 2 LSAs never leave their area.
Type 3 and 4 LSAs are generated by ABRs to propagate info between areas, e.g Type 3 is used by ABR to advertise Area 1 routes into Area 0.
Type 5 LSAs are flooded throughout the OSPF domain unless filtered, e.g: Redistributing BGP into OSPF for internal reachability.
Type 7 LSA: Used in NSSA to allow redistribution without full external flooding.
External Route Metric Type 1 vs Type 2 in OSPF
Metric Calculation
Sum of external metric + internal OSPF cost to ASBR
Only external metric is considered
Path Selection
Prefers route with lowest total cost (external + internal)
Prefers route with lowest external cost, regardless of internal path
Use Case
When internal topology matters
When external metric dominates decision
Default Behavior
Not default—must be explicitly configured
Default for most redistribution scenarios
How OSPF Treats Them
Type 1
OSPF calculates the total cost to reach the destination by adding:
Cost from local router to ASBR (internal OSPF cost)
External metric from ASBR to destination
Type 2
OSPF ignores internal cost to ASBR and uses only the external metric. This can lead to suboptimal routing if multiple ASBRs exist.
When to Use Each Type
Use Type 1 When:
You have multiple ASBRs and want OSPF to prefer the closest one.
Internal topology and link cost should influence path selection.
You’re redistributing critical services (e.g., data center routes) and want deterministic failover.
Use Type 2 When:
You have a single ASBR or don’t care about internal OSPF cost.
External routes are static or BGP-learned and internal path cost is irrelevant.
You want to simplify routing decisions and reduce LSA churn.
Platform-Specific Configuration
NX-OS
IOS XE
IOS XR
Example
Imagine two ASBRs redistributing BGP into OSPF:
ASBR1 is 10 cost away from Router A
ASBR2 is 50 cost away from Router A
Both advertise the same external route with metric 20
Type 1: Router A prefers ASBR1 (10 + 20 = 30)
Type 2: Router A sees both as equal (20), may pick ASBR2 even though it’s farther
How Is the Cost to ASBR Determined?
It’s Based on the Path to the ASBR’s Advertising Interface
OSPF builds its SPF tree using router LSAs (Type 1) and network LSAs (Type 2).
The ASBR is identified by its Router ID, but the cost is calculated to the interface that originated the external LSA (Type 5 or Type 7).
That interface is typically a physical interface—not the loopback—unless the loopback is used as the next-hop in redistribution.
Example
Let’s say:
ASBR has Router ID 1.1.1.1
It redistributes BGP and advertises 10.10.10.0/24 as an external route
It does this via interface Gig0/1 with OSPF cost 10
Your router reaches ASBR via two hops with cumulative OSPF cost 30
Then:
Type 1 route total cost = 30 (internal) + 10 (external) = 40
Type 2 route cost = 10, regardless of internal path
Is the Loopback Used?
Only if:
The ASBR’s loopback is the next-hop for redistributed routes (e.g., via static route pointing to loopback)
You manually configure redistribution to use loopback as the forwarding address
Otherwise, OSPF uses the interface that originated the LSA, which is typically a physical interface.
How to Verify
Look for:
Forwarding address in the LSA
Advertising router ID
Metric type (1 or 2)
IOS XE / NX-OS
show ip ospf database external: Routes to external routes
Link State ID: route
Advertising Router: Router ID of advertising router
Forward Address:
Address of next hop toward route (link state id): if interface toward next hop is ospf interface
0.0.0.0: if interface to next hop is NOT ospf interface
show ip route 10.10.10.0
show ip ospf border-routers: Show Route to router-id of border routers
IOS XR
show ospf database external
show route 10.10.10.0 detail
Forwarding Address
When the metric of the redistributed route from multiple ASBRs are equal (usually Type E2), the forwarding address changes the behavior of the type 5 LSA path selection.
When a router receives two type 5 LSAs to the same destination with the forwarding addresses set on one or both LSAs, the router makes a comparison based on the metric to the forwarding addresses if it is not 0.0.0.0. The LSA with a forwarding address (if it's not 0.0.0.0) that offers the smaller metric is placed into the routing table.
If the metric of the redistributed routes are different (usually type E1), the routers prefer the route with the lowest metric and not the lowest metric to the forwarding address.
Reference: OSPF Type 5 LSA
Last updated