Pages

OSPF notes

Packet types:
Hello (type1): used to discover neighbors, build and maintain adjacencies
DBD(type2): database description packets. These are a summary of the topological database. Detects MTU mismatches (fragmentation is not allowed). Have bits I (start of DBD), M (more ackets DB), MS(master/slave used to decides who starts sending DBD first)
LSR(type3): link state request. Request specific link state advertisement (LSA) from a neighbor, typically after receiving DBD packets and noticing the local link state database is out of date
LSU(type4): link state updates. Advertises LSAs into the network . Can contain multiple LSAs
LSAck(type5): link state acknowledgements. Acknowledges LSUs

Packet formats:

OSPF packet:

Version | Type | Length | Router ID | Area ID | Cksum | Auth type | Auth data | Data

LSU packet (type 4):
Number of LSAs | LSA header | LSA data | LSA header | LSA data | ...

LSA header:
Age | Options | Link-state Type | Link-state ID | Advertising router | Seq number | Cksum | Length

LSA types:


Router LSA (type 1):
- has area scope
- describes local router
- standards LSA header  plus some extras (only a few showed below):
   - 5 bits set to 0 followed by bits 6,7,8  set for virtual links (V), ASBR (E), ABR (B)
   - number of links (2 bytes)
   - link ID (4 bytes)
   - link data (4 bytes)
   - link type (1 bytes)
   - metric (2 bytes)

 Link-type: Type 1 (P2P). Link ID: Neighbor Router ID. Link data: Local interface IP
 Link-type: Type 2 (Transit). Link ID: DR's interface IP. Link data: Local interface IP [broadcast segment]
 Link-type: Type 3 (Stub). Link ID: Network number. Link data: Subnet mask [passive interfaces, loopback interfaces]
 Link-type: Type 4 (Virtual link). Link ID: Neighbor Router ID. Link data: Local interface IP


 Network LSA (type 2):

- has area scope
- is generated by the DR (the idea is to have only one router advertisement for the broadcast segment.)
- standards LSA header  plus some extras:
   - Network mask (subnet for interface on broadcast segment)
   - Attached router (each Router ID connected to the broadcast network)  
  
Summary LSA (type 3):
- has area scope
- is originated by the ABR
-describes networks connected to area
- standards LSA header  plus some extras:
   - Netmask and Link-state ID: represents the network advetised
   - Metric: cost to reach the network. In case of aggregate, the metric is the highest from the composing members

ASBR summary LSA (type 4):

- has area scope
- originated by the ABR (based on th E bit in the Router LSA)
- standards LSA header  plus some extras:
   - Netmask (set to  0.0.0.0), Link-state ID (the ASBR address)
   - Metric: cost to reach the ASBR
  
AS External LSA (type 5):
- has domain scope
- originated by ASBR
- standards LSA header  plus some extras:
   - Netmask , Link-state ID: represents the network advetised
   - E bit 0: metric type is E2 (cost = metric); E bit 1: metric type is E1 (cost = metric + ASBR cost)
   - Metric: set by ASBR (the cost to reach the external network)
   - Forward address (set to 0.0.0.0 to forward packets to ASBR)

NSSA external LSA (type 7):

- has area scope
- translated to AS External LSA at NSSA area border
- Forwarding address. Citation from RFC3101:
"Normally the next hop address of an installed AS external route learned by an NSSA ASBR from an adjacent AS points at one of the adjacent AS's gateway routers.  If this address belongs to a network connected to the NSSA ASBR via one of its NSSAs' active interfaces,  then the NSSA ASBR copies this next hop address into the forwarding address field of the route's Type-7 LSA that is originated into this NSSA, as is currently done with Type-5 LSAs. (See [OSPF] Section 12.4.4.1.)  For an NSSA with no such network the forwarding address field may only be filled with an address from one of the its active interfaces or 0.0.0.0.  If the P-bit is set, the forwarding address must be non-zero; otherwise it may be 0.0.0.0.  If an NSSA requires  the P-bit be set and a non-zero forwarding address is unavailable, then the route's Type-7 LSA is not originated into this NSSA.
When a router is forced to pick a forwarding address for a Type-7 LSA, preference should be given first to the router's internal addresses (provided internal addressing is supported).  If internal addresses are not available, preference should be given to the router's active OSPF stub network addresses.  These choices avoid the possible extra hop that may happen when a transit network's address is used.  When the interface whose IP address is the LSA's forwarding    address transitions to a Down state (see [OSPF] Section 9.3), the router must select a new forwarding address for the LSA and then re-originate it.  If one is not available the LSA should be flushed."
Opaque LSAs:
- can be used for MPLS TE, Graceful restart, etc

Area types:

Backbone: Area 0
Stub: no type 4,5 LSAs. Does not allow virtual links and ASBR to reside in area
Stub no-summary: no type 3,4,5 LSAs. Does not allow virtual links and ASBR to reside in area
NSSA: no type 5 LSAs, allows ASBR to generate type 7 LSA. Does not allow virtual links

Misc:

- OSPF uses IP protocol 89
- DR and BDR election on broadcast segments. It is non-deterministic.
- Multiarea adjacency a llows one logical interface in multiple areas.Reasoning: intra area routes are prefered over intra area routes. In some scenario this can prove suboptimal.
- standard allows ABR without being connected to area 0
- virtual link merges a split area 0

No comments: