It's important to note that type 2 LSA's are only generated on segments where a DR/BDR has been elected - this includes BMA (Broadcast Multi-Access) and NBMA (Non-Broadcast Multi-Access) networks. The DR is what generates the type 2 LSA. This behavior can be bypassed by configuring your Ethernet interfaces that you're choosing to run OSPF on as point-to-point
(this will also prevent the DR election process).
Type 2 LSA's are beneficial when running OSPF over a Broadcast (Ethernet) or Non-Broadcast Multi-Access (Frame Relay) medium. Put simply, yes, the routers could use type 1 LSA's and detail every router's links to all other routers, but this is inefficient and will introduce unnecessary bloat into the OSPF LSDB. To mitigate this, the Type 2 (network) LSA is used to represent the broadcast subnet. Each router LSA then has a link to the broadcast subnet’s network LSA, and the network LSA has links to each of the router LSAs. It's a math problem - with every router using type 1 LSA's, you have n * (n - 1)
links in the link state database. With type 2 LSA's, this number is reduced to n * 2
.
I highly recommend reading John Moy's book on OSPF. He also wrote the initial RFC's for the protocol.
Very well explained!
Maybe this graphic help visualize that.
A Tale of Three Stubs...
When using Cisco equipment, OSPF calls several things a "stub"... it gets a bit confusing....
- Stub Host
- Stub Network
- Stub Area
The meanings are very different for each term; even more confusing is the reality that you can potentially apply multiple stub terms to a single OSPF interface. I'll elaborate more below.
Background
Let's clear up some terminology... The question starts off asking about what Cisco is calling a "Stub Host"... OSPF automatically assigns Loopback interfaces to this category...
CORE01.PUB.DAL02#sh ip ospf interface lo0
Loopback0 is up, line protocol is up
Internet Address 128.66.62.5/32, Area 0.0.0.0
Process ID 100, Router ID 128.66.62.5, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host
^^^^^^^^^
CORE01.PUB.DAL02#
All this is not to be confused with what OSPF refers to as "Stub Network"... which merely means a network without an OSPF neighbor
CORE01.PUB.DAL02#sh ip ospf data router internal
...
Link connected to: a Transit Network <------- Broadcast Intf w/ Neighbor
(Link ID) Designated Router address: 128.66.62.75 <-------
(Link Data) Router Interface address: 128.66.62.75
Number of TOS metrics: 0
TOS 0 Metrics: 10
...
Link connected to: a Stub Network <------ Broadcast Intf w/o Neighbor
(Link ID) Network/subnet number: 128.66.62.32 <------
(Link Data) Network Mask: 255.255.255.248
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network <------ Loopback interface
(Link ID) Network/subnet number: 128.66.62.5
(Link Data) Network Mask: 255.255.255.255
Number of TOS metrics: 0
TOS 0 Metrics: 1
Then, of course, we have an OSPF Stub Area. Let's consider where all this comes from...
OSPF Stub Network vs OSPF Transit Network
Transit and Stub networks are discussed in RFC 2328: OSPFv2 - Section 2.1:
2. The Link-state Database: organization and calculations
The following subsections describe the organization of OSPF's link-
state database, and the routing calculations that are performed on
the database in order to produce a router's routing table.
2.1. Representation of routers and networks
... Networks can be either transit or
stub networks. Transit networks are those capable of carrying
data traffic that is neither locally originated nor locally
destined. A transit network is represented by a graph vertex
having both incoming and outgoing edges. A stub network's vertex
has only incoming edges.
The whole point of this distinction between Transit Network and Stub Network is to save resources in the router.
- Transit Networks must maintain additional memory for neighbor information
- Stub Networks save memory on the router because no neighbors need to be assigned
When we start scaling to potentially thousands of LSAs, even small memory savings are important. Note that OSPF hellos are still sent on a stub networks, and they are capable of forming neighbors / transitioning to a transit network unless the interface has been administratively marked as a passive interface.
OSPF Host Routes - Cisco's "Stub Host"
So now we still have the original discussion about the Stub Host, which also happens to be an OSPF Stub Network. This concept comes from RFC 2328: OSPFv2 - Section 9.1, where it discusses various interface states...
9.1. Interface states
The various states that router interfaces may attain is
documented in this section.
Down
...
Loopback
... For this reason, IP packets may
still be addressed to an interface in Loopback state. To
facilitate this, such interfaces are advertised in router-
LSAs as single host routes, whose destination is the IP
interface address.[4]
...
Waiting
...
Point-to-point
...
The RFC requires Loopback network types to be advertised as a /32 host route. What Cisco calls a Stub Host in show ip ospf interface
output is really just the Loopback interface type, which OSPF allocates automatically as a /32 host route within OSPF.
OSPF Stub Area
Stub areas are covered in RFC 2328: OSPFv2 - Section 3.6. There are several categories of OSPF stub areas...
- Stub Area: No Type-5 External LSAs are allowed in this area, which means no route redistribution inside the area. A Type-3 Network LSA is originated at the ABR so no connectivity is lost from Type 5 LSAs which are blocked by the stub feature. OSPF has a E-bit field in Hello packets (E-bit =
ExternalRoutingCapability
), which is cleared when an area is configured as a Stub Area
- Totally Stubby Area: No Type-5 External LSAs, and only the Type-3 Network LSA default route is permitted. This is a vendor-specific feature, which is not covered in RFC 2328.
- Not So Stubby Area: No Type-5 External LSAs are allowed, but redistribution is permitted via a special Type-7 LSA.
Summary
In summary, we talked about...
- Stub Host: A loopback network-type, which is always advertised as a /32 host route; Cisco calls this a stub host.
- Stub Network: An OSPF network, which does not have a neighbor attached to it
- Stub Area: An OSPF area, which does not permit Type-5 External LSAs.
If you really want to wrap your mind around all this, consider an OSPF router, which has a loopback interface; this router is completely contained in a single OSPF stub area. Technically, you could apply all three of the OSPF "stub" terms to this Loopback (Stub Host, Stub Network, Stub Area).
Best Answer
In the OSPF 'Ex Start' state, the master begins the Database Description (DBD) packets exchange. Following this, through the 'Loading' state, Link State Requests (LSR) and Link State Updates (LSU) are exchanged to get more information on the routes in the DBD. The DBD contains abbreviated list of the sending routers Link State Database (LSDB) and is used by the receiving router to check against its own LSDB. Receiving routers can request more information about any entry in the DBD by sending a LSR, for example for new entries or entries with a higher sequence number. The LSU's are used to reply to LSR's. Link State Ack's are used to confirm receipt of LSUs. - Source: From my own CCNA study, thanks for the revision practice! (Maybe try Cisco Learning Network for more formal explanations.)