
OSPF Key Concepts Part I/II
July 31, 2012
BGP Key Concepts Part I
April 13, 2014Photo by Mathew Schwartz on Unsplash
For configuring basic OSPF:
Router(config)#router ospf<Process ID> Router(config)#router ospf 2 Router(config-router)#network <Subnet ID/Network ID> <Wildcard Mask> Area<#> Router(config-router)#network 192.168.10.4 0.0.0.3 Area 0 Router(config-router)#network 130.50.10.64 0.0.0.31 Area 0 Router(config)#interface loopback0 Router(config-if)#ip ospf network point-to-point (P2P, instead of w.x.y.z/32 you will see w.x.y.z/proper mask)
Useful show commands for OSPF:
Router#show ip ospf neighbor Router#show ip ospf interface Router#show ip route ospf
For configuring OSPF to broadcast itself as the default-gateway:
Router(config)#ip route 0.0.0.0 0.0.0.0 serial 0/0 Router(config)#router ospf <Process ID> Router(config)#router ospf 2 Router(config-router)#default-information originate always
By default, OSPF Metric is Cost (Cost = 100 Mbps/BW). The reference bandwidth for OSPF Metric, Cost, can be changed by the following command.
Router(config-router)# auto-cost reference-bandwidth 1000 (where the reference bandwidth is defined as 1Gbps)
The cost can be manually assigned under interface configuration mode, as follows.
Router(config-if)#ip ospf cost 27, where 27 is the cost
The following command shows the Link State Advertisement (LSA) age (in seconds) and sequence number of each router in the LSDB.
Router#show ip ospf database
OSPF LSA Types
LSA Type | Description | Routing Table Symbol | |||
LSA Type Description | Advertisement | Type of Router LSA Generated from | Flooded Area | ||
1 | Router LSA | Advertises intra-area routes | Generated by each OSPF router | Flooded only within the area | O |
2 | Network LSA | Advertises routes on a multi-access link | Generated by DR | Flooded only within the area | O |
3 | Summary LSA | Advertises inter-area routes | Generated by ABR | Flooded to adjacent areas | O IA |
4 | Summary LSA | Advertises the route to an ASBR | Generated by an ABR | Flooded to adjacent areas | O |
5 | External LSAE1-metricincreases at each router as it passed through the network.E2-metric does not increase (this is default) | Advertises routes in another routing domain | Generated by an ASBR | Flooded to adjacent areas | O-E2 O-E1 |
6 | Multicast LSA | It is used in multicast OSPF operations | |||
7 | Not-So-Stubby Area (NSSA) LSA | Advertises routers in another routing domain | Generated by an ASBR within a NSSA | O-N2 O-N1 |
|
8 | External Attributes LSA | It is used in OSPF and BGP internetworking | |||
9, 10, 11 | Opaque LSAs | It is used for specific applications, such as OSPF and MPLS internetworking |
Stubby Area: Blocks type 5 LSAs from entering
R1(config)#router ospf 1 R1(config-router)#area 1 stub
Totally Stubby Area: Blocks type 3, 4, and 5 LSAs from entering
R2(config)#router ospf 1 R2(config-router)#area 1 stub no-summary
Not-So-Stubby Area: Passes external routes through via type 7 LSAs; these convert back to type 5 LSASsonce they reach the backbone. It denies type 3, 4, and 5 LSAs from entering.
R1(config)#router ospf 1 R1(config-router)#no area 1 stub R1(config-router)#area 1 nssa R2(config)#router ospf 1 R2(config-router)#no area 1 stub no-summary R2(config-router)#no area 1 stub R2(config-router)#area 1 nssa no-summary
OSPF Packets
OSPF uses several different types of packets to establish and maintain neighbour relationships, and to maintain correct routing information.
- Helloidentifies neighbours and serves as a keepalive. The following parameters within the OSPF Hellos must match for two routers to become neighbours
- Hello/Dead Timers
- Default 10sec/40sec for LAN and point-to-point interfaces
- Default 30sec/120sec for NBMA interface
- Area ID
- Common Subnet
- Authentication type and passwor
- Stub Area Flag
- Hello/Dead Timers
- Link State Request (LSR) requests a Link State Update (LSU). It contains the type of LSU requested and the ID of router requesting it.
- Database Description (DBD) consists of the summary of the LSDB, including the RID and sequence number of each LSA in the LSDB
- Link State Update (LSU) contains a full Link State Advertisement (LSA) entry. An LSA includes topology information; for example, the RID of this router and RID and cost to each neighbour. One LSU can contain multiple LSAs.
- Link State Acknowledgment (LSAck) acknowledges all other OSPF packets (except Hellos and LSAcks)
Establishing Neighbours and Exchanging Routes
- Down state – OSPF process has not yet started, so no Hellos sent
- Init state – Router sends Hello packets out of all OSPF interfaces
- Two-way state B – Router receives a Hello from another router that contains its own router ID in the neighbour list. All other required elements match, so routers can become neighbours
- Exstart state – If routers become adjacent (exchange routes), they determine which one starts the exchange process
- Exchange state – Routers exchange DBDs listing the LSAs in their LSD by RID and sequence number
- Loading state – Each router compares the DBD received to the contents of its LS database. It then sends a LSR for missing or outdated LSAs. Each router responds to its neighbor’s LSR with a Link State Update. Each LSU is acknowledged.
- Full state – The LSDB has been synchronized with the adjacent neighbour.