Perhaps the first thing to point out is, there is no such thing as an Link State Advertisement (LSA) packet. Each OSPF speaking router has a database containing LSAs that describe the routes the router is aware of. These LSAs are exchanged in Link State Update (LSU) packets when routers first become adjacent, and later when there are topology changes. The LSA database is then used to build the routing table using Dijkstra’s algorithm
Type 1 LSA (Router LSA)
For each area, each router creates a Type 1 LSA to describe itself and the interfaces connected to it. The LSA itself is identified by a link-state ID, which is equal to the router ID. The router sends this LSA to its neighbours within the area, and also receives Type 1 LSAs from its neighbours. Consequently the router builds a picture of the routers in the area and the interfaces connected to those routers.
Consider the following simple network:

If we look at R3, we can see a list of the LSAs in its OSPF database. In the example below we can see three LSAs in area 0, and the routers that generated them:
R3#show ip ospf database
OSPF Router with ID (0.0.0.3) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
0.0.0.1 0.0.0.1 604 0x80000003 0x0015E1 2
0.0.0.2 0.0.0.2 566 0x80000006 0x000AC8 2
0.0.0.3 0.0.0.3 507 0x80000005 0x0007AB 2
If we then look specifically at the Type 1 LSAs, we can see details of the links on each router. In the below example we are looking at router 2 and its LSAs. We can see two links (interfaces), one for loopback0 (20.20.20.0/24) and one a for fa0/0 ip address 1.1.1.2
R2#show ip ospf database router OSPF Router with ID (0.0.0.3) (Process ID 1) Router Link States (Area 0) LS age: 926 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 0.0.0.2 Advertising Router: 0.0.0.2 LS Seq Number: 80000006 Checksum: 0xAC8 Length: 48 Number of Links: 2 Link connected to: a Stub Network (Link ID) Network/subnet number: 20.20.20.0 (Link Data) Network Mask: 255.255.255.0 Number of MTID metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 1.1.1.2 (Link Data) Router Interface address: 1.1.1.2 Number of MTID metrics: 0 TOS 0 Metrics: 1 R2#show ip int brief | i up FastEthernet0/0 1.1.1.2 YES manual up up Loopback0 20.20.20.20 YES manual up up
Type 2 LSA (Network LSA)
Type 2 LSAs are only generated by DRs and describe the DRs and the subnet on which the DR was elected on. If there is no DR elected then no Type2 LSAs are generated. Using the example network above we can see that R1 is the DR. Looking at R2 we can see that it has received a Type 2 LSA from R1 describing the DR and the subnet.
R2#show ip ospf database
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 0.0.0.1 398 0x80000002 0x00CD5
R2#show ip ospf database network OSPF Router with ID (0.0.0.2) (Process ID 1) Net Link States (Area 0) Routing Bit Set on this LSA in topology Base with MTID 0 LS age: 842 Options: (No TOS-capability, DC) LS Type: Network Links Link State ID: 1.1.1.1 (address of Designated Router) Advertising Router: 0.0.0.1 LS Seq Number: 80000002 Checksum: 0xCD5C Length: 36 Network Mask: /24 Attached Router: 0.0.0.1 Attached Router: 0.0.0.2 Attached Router: 0.0.0.3
Type 3 LSA (Summary LSA)
The key thing to remember about Type 1 an Type 2 LSAs is that they are only flooded in a single area and are not passed through to another OSPF area. This is where Type 3 LSAs come in. Type 3 LSAs are generated by the ABRs describing how to get to routes in an another area. For example in the above network, the ABR will send Type 3 SLAs into area 51 describing the routes in area 0, and the cost to those routes via the ABR – and vice verse.
For example, to see the Type 3 LSAs use the following commands:
R4#show ip ospf database
OSPF Router with ID (40.40.40.40) (Process ID 1)
Router Link States (Area 51)
Link ID ADV Router Age Seq# Checksum Link count
0.0.0.1 0.0.0.1 69 0x80000002 0x00C8AF 2
40.40.40.40 40.40.40.40 68 0x80000002 0x00AAA2 3
Summary Net Link States (Area 51)
Link ID ADV Router Age Seq# Checksum
1.1.1.0 0.0.0.1 69 0x80000001 0x0069CE
10.10.10.0 0.0.0.1 69 0x80000001 0x0024F8
20.20.20.0 0.0.0.1 53 0x80000001 0x00C439
30.30.30.0 0.0.0.1 48 0x80000001 0x005B84
R4#
R4#show ip ospf database summary OSPF Router with ID (40.40.40.40) (Process ID 1) Summary Net Link States (Area 51) Routing Bit Set on this LSA in topology Base with MTID 0 LS age: 252 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 1.1.1.0 (summary Network Number) Advertising Router: 0.0.0.1 LS Seq Number: 80000002 Checksum: 0x67CF Length: 28 Network Mask: /24 MTID: 0 Metric: 1 Routing Bit Set on this LSA in topology Base with MTID 0 LS age: 252 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 10.10.10.0 (summary Network Number) Advertising Router: 0.0.0.1 LS Seq Number: 80000002 Checksum: 0x22F9 Length: 28 Network Mask: /24 MTID: 0 Metric: 1 Routing Bit Set on this LSA in topology Base with MTID 0 LS age: 252 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 20.20.20.0 (summary Network Number) Advertising Router: 0.0.0.1 LS Seq Number: 80000002 Checksum: 0xC23A Length: 28 Network Mask: /24 MTID: 0 Metric: 2 Routing Bit Set on this LSA in topology Base with MTID 0 LS age: 252 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 30.30.30.0 (summary Network Number) Advertising Router: 0.0.0.1 LS Seq Number: 80000002 Checksum: 0x5985 Length: 28 Network Mask: /24 MTID: 0 Metric: 2
Another useful command for showing different areas and their associated routes is the IOS hidden command show ip ospf route This command shows local area (Intra-area) and remote area (Inter-area) routes as well as the ABR.
R4#show ip ospf route
OSPF Router with ID (40.40.40.40) (Process ID 1)
Base Topology (MTID 0)
Area 51
Intra-area Route List
* 1.4.1.0/29, Intra, cost 1, area 51, Connected
via 1.4.1.4, FastEthernet0/1
* 40.40.40.0/24, Intra, cost 1, area 51, Connected
via 40.40.40.40, Loopback0
Intra-area Router Path List
i 0.0.0.1 [1] via 1.4.1.1, FastEthernet0/1, ABR, Area 51, SPF 2
Inter-area Route List
*> 30.30.30.0/24, Inter, cost 3, area 51
via 1.4.1.1, FastEthernet0/1
*> 20.20.20.0/24, Inter, cost 3, area 51
via 1.4.1.1, FastEthernet0/1
*> 1.1.1.0/24, Inter, cost 2, area 51
via 1.4.1.1, FastEthernet0/1
*> 10.10.10.0/24, Inter, cost 2, area 51
via 1.4.1.1, FastEthernet0/1
R4#
Type 4 and 5 LSAs
In order to understand Type 4 SLAs you must first understand the limitations of Type 5 SLAs. Type 5 SLAs are generated by ASBRs as a result of redistribution from a non OSPF protocol, into OSPF. In our example above, we are redistributing from RIP into OSPF, which makes R5 an ASBR.
OSPF subdivides these Type 5 SLAs into two further categories; External Type 1 and External Type 2, you’ll see them in the routing tables as E1 and E2 respectively:
R2#show ip route ospf Codes: <snip> N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 <snip> Gateway of last resort is not set 1.0.0.0/8 is variably subnetted, 3 subnets, 3 masks O IA 1.4.1.0/29 [110/2] via 1.1.1.1, 02:54:47, Fa0/0 4.0.0.0/29 is subnetted, 1 subnets O IA 4.5.4.0 [110/3] via 1.1.1.1, 02:10:41, Fa0/0 5.0.0.0/29 is subnetted, 1 subnets O E2 5.6.5.0 [110/20] via 1.1.1.1, 01:58:16, Fa0/0 10.0.0.0/24 is subnetted, 1 subnets <snip>
By default OSPF redistributes using Type 5, External Type 2 LSAs. These SLAs do not add to the redistributed OSPF metric and are flooded unchanged by ABRs into other normal (non-stubby) OSPF areas. By contrast Type 5, External Type 1 LSAs add the internal OSPF cost to the route.
R5-ASBR(config-router)#redistribute rip metric-type ? 1 Set OSPF External Type 1 metrics 2 Set OSPF External Type 2 metrics <<< default
If we look at the diagram we can see network 60.60.60.0/24 is redistributed into OSPF. The following output shows the effect of the two metric types:
R5-ASBR#show run | b router ospf router ospf 1 router-id 0.0.0.5 redistribute rip subnets R1-ABR#show ip route 60.60.60.0 Routing entry for 60.60.60.0/24 Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 2 Last update from 1.4.1.4 on FastEthernet0/1, 00:06:59 ago Routing Descriptor Blocks: * 1.4.1.4, from 0.0.0.5, 00:06:59 ago, via FastEthernet0/1 Route metric is 20, traffic share count is 1 R2#show ip route 60.60.60.0 Routing entry for 60.60.60.0/24 Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 3 Last update from 1.1.1.1 on FastEthernet0/0, 00:01:04 ago Routing Descriptor Blocks: * 1.1.1.1, from 0.0.0.5, 00:01:04 ago, via FastEthernet0/0 Route metric is 20, traffic share count is 1
R5-ASBR#show run | b router ospf router ospf 1 router-id 0.0.0.5 redistribute rip metric-type 1 subnets R1-ABR#show ip route 60.60.60.0 Routing entry for 60.60.60.0/24 Known via "ospf 1", distance 110, metric 22, type extern 1 Last update from 1.4.1.4 on FastEthernet0/1, 00:00:46 ago Routing Descriptor Blocks: * 1.4.1.4, from 0.0.0.5, 00:00:46 ago, via FastEthernet0/1 Route metric is 22, traffic share count is 1 R2#show ip route 60.60.60.0 Routing entry for 60.60.60.0/24 Known via "ospf 1", distance 110, metric 23, type extern 1 Last update from 1.1.1.1 on FastEthernet0/0, 00:01:10 ago Routing Descriptor Blocks: * 1.1.1.1, from 0.0.0.5, 00:01:10 ago, via FastEthernet0/0 Route metric is 23, traffic share count is 1
Notice that with the type 1 metric, the forward metric is added to the ospf cost.
Type 5 SLAs therefore describe the routes known by the ASBR, but what they don’t describe is how to get to the ASBR itself. As a reminder the ASBR originates Type-5 SLAs in all normal (non stubby areas). This is not a problem if you are in the same area as the ASBR because the ASBR also floods Type-1 (and Type-2 if it’s also a DR) into the same area. However if you are in another area, then this is a problem because you have no routing information to reach the ASBR. This is where Type-4 SLAs come in. The ABR between areas generates the Type-4 SLAs and says “come to me to get to the ASBR”
Stubby Areas
The concept of a stubby area is one that doesn’t have an ASBR, and doesn’t really need to know about individual external networks (outside of the OSPF domain). It just needs a default route to the backbone area injected by the ABR.
If an area is configured as stubby, Type 4 and Type 5 are not forwarded by the ABR into the area and Internal routers will ignore them. Note that a Stubby area can have more than one ABR, in which case both would inject a default route into the area.
Totally Stubby Areas
A totally stubby area goes one step further and stops Type-3 LSAs from being injected into the area (except for the Type-3 LSA carrying the default route). So it is not interested in individual external networks, or individual networks in another area, and just has a default route injected into the area by the ABR.
Not-So-Stubby-Area (NSSA) – Type 7 LSAs
Whilst an area might not need to know about external routes injected via other areas, it might be a requirement to inject some external routes directly into the stubby area, and flood these to the rest of the OSPF domain. This is where Type 7 LSAs come in. A Type 7 SLA is generated by a ASBR in an area configured as a NSSA. Type 5 LSAs are still prohibited from an NSSA. The ABR then translates this Type 7 to a Type 5 to make other areas aware of the external route. If there is more than one ABRs, the ABR with the highest RID is used.
An NSSA is also the only area where a default route is not injected by default. ABRs must be manually configured with the area area-id nssa default-information-originate command.
Totally NSSA (NSSA-TS)
Similar to a totally stubby area, a NSSA-TS area stops Type-3 LSAs from being injected into the area. So it is not interested in individual external networks, or individual networks in another area. The default route is automatically injected into the area as a Type-3 LSA by the ABR.
References:
http://www.astorinonetworks.com/2011/06/06/understanding-ospf-type-4-lsas/