Contents
OSPF: Open Shortest Path First
Link State routing protocol.
Uses Dijkstra's SPF (Shortest Path First) algorithm.
Tables
- Neighbor
- Topology
- Route
Notes
- All areas connect to area 0.
- All routers in an area know about all other routers in that area.
- Area 0 is aka Backbone area.
- Neighborships form in same area only.
- Hellos:
- 10 sec on broadcast & P2P networks
- 30 sec on NBMA networks
- Timeout 4x Hello
- Reliability: Uses RTP (Reliable Transport Protocol) for reliability. This is built into OSPF.
Router Types
- ABR: Area Border Router. Must have 1 int in area 0. Can summarize here only.
- ASBR: Autonomous System Boundary Router. Links the OSPF AS to external network(s).
Area Types
Normal
The normal area.
Stubby
Block LSA 5. All area routers will know IA routes but external routes will just go to the ABR as 0/0. On all routers in the area, mark the area as a stub. Neighborships will not form if stub flag does not match. No virtual links are allowed.
router# area # stub
Totally Stubby
Block LSA 3, 4, 5. All non-local area routes are summarized. All IA and external routes will go to the ABR as 0/0. TSA is cisco proprietary but only ABR summarizing must be cisco compatible. On all routers in the area, mark the area as a stub. Neighborships will not form if stub flag does not match. No virtual links are allowed.
on ABR: router# area # stub no-summary on other area routers: router# area # stub
Totally Stubby Not-So-Stubby
Same as TSA, but allows LSA 7 for external routes originating in that area to pass into area 0. Once in area 0, LSA 7 are converted to LSA 5 by ABR.
on area router with external network: router# no area # stub router# area # nssa redistribute external routes into ospf router# redistribute ... on ABR: router# no area # stub no-summary router# no area # stub router# area # nssa no-summary
Verify LSAs:
# sh ip ospf database
.
Technical
LSA Types
(Link State Adverts)
- 1: Router
- 2: Network
- 3: ABR Summary
- 4: ASBR Summary
- 5: External
- 7: External Type2
Packet Types
- Hello
- RID, Router Priority, Neighbors, BR & BDR addresses
- (Must match for neighborship formation.) Area #, Hello & Dead timers, NetMask, Auth
- Link-State packets:
- LSU (Link-Stake Update). Encapsulating packet for updates. Contain LSAs.
- LSA (Link-State Advert). Individual updates about routes to networks.
- LSAck (Link-State Ack). Acks for reliability. (RTP)
Neighborship
- RID (Router ID) is determined.
- Staticly declared or determined by: highest active IP when OSPF starts (loopback > physical).
- RID is 32 bit in IPv4 format.
- If dynamic RID, RID will only change if OSPF is manually restarted or at router reload.
- If Hello contains This router, This knows neighborship is formed. If Hello doesn't contain This, This attempts to form neighborship.
Router States
- Init State: received Hello (if no Hello matches, Init -> Down).
- 2-Way State: This router listed in Other's Hello & Other router listed in This' Hello. (DROthers stay here)
- ExStart State: Master-Slave determined by Priority > RID. Master sends DB Desc (DBD) packet (summary of Link-State db). Slave sends DBD.
- Loading State: Ack DBDs.
- Slave Req details (Link-State Requests [LSR])
- Master Tx updates (Link-State Updates [LSU])
- Master Req details (LSR)
- Slave Tx updates (LSU)
- Full State: Neighborship formed.
Router Roles
- DR (Designated Router)
- updates are sent to DR (from all rtrs) on 224.0.0.6
- DR calculates changes, then sends update on 224.0.0.5
- determined by Rtr Priority > RID
- BDR (Backup Designated Router)
- takes over as DR if DR fails.
- DROther (all other routers on network segment or routers on P2P)
- listen on 224.0.0.5
- P2P links have DROthers only (stuck in 2-Way) and only use 224.0.0.5
Roles are per network. A router connected to multiple networks can have multiple roles.
Router Role Election: Router Priority > RID
OSPF Over NBMA
for Frame Relay, ATM, MPLS
Modes of Operation:
Non-Broadcast
- Default mode for X.25, FR, ATM
- Neighbors Statically Configured
- Must be one subnet.
- Acts like LAN environment
- DR/BDR election.
- ie full connectivity b/w all rtrs
- result: Hub rtr must be DR, Spokes (to Hub) will be BDR, Spoke-Spoke will be 2-Way
Point to Multipoint
- Fixes issues with NBMA networks by treating all links as P2P.
- Requires single subnet.
- No DR/BDR election.
- Neighborships auto form.
Point to Point (Cisco proprietary)
- Uses seperate sub-interfaces.
- Requires diff subnets.
- No DR/BDR election.
- Neighborships auto form.
Broadcast (Cisco proprietary)
- Treated as Ethernet network.
- DR/BDR election.
Point to Multipoint Non-Broadcast (Cisco proprietary)
- Fixes issues with NBMA networks by treating all links as P2P.
- Requires single subnet.
- No DR/BDR election.
- Neighbors statically defined.
Implementation
Non-Broadcast
- Setup connectivity per any requirements.
- Start OSPF process and declare networks to advert.
- Create neighborships.
config# router ospf # router# router-id # router# network [IP] [wildcard] area # router# neighbor [IP] (priority #)
Point-to-Multipoint
Point-to-Point
Broadcast
Point-to-Multipoint Non-Broadcast
Virtual Links
Virtual Links are tunnels.
When configuring virtual links, the links are made between the ABRs. Any routers between will be traversed.
R2:
config# router ospf 1 router# router-id 2.2.2.2 router# network 10.1.23.1 0.0.0.0 area 1 router# network 10.1.1.1 0.0.0.0 area 2 router# area 1 virtual-link 3.3.3.3
R3:
config# router ospf 1 router# network 10.1.23.2 0.0.0.0 area 1 router# area 1 vitual-link 2.2.2.2
Verify:
# sh ip ospf neighbors # sh ip ospf virtual-links ... will show POINT_TO_POINT for virtual links active ...
Passive Interface
Passive interface ensures no neighborships will be formed. OSPF data is accepted but not advertised. This will drop all neighborships, so neighborship interfaces must be specified.
router# passive-interface default router# no passive-interface fast0/0
Authentication
Force md5 auth for an area (no recommended):
router# area # authentication message-digest
Auth per interface (adj forms when keys on connected int match):
! clear text if# ip ospf authentication message-digest ! md5 ; key # must match across adj if# ip ospf authentication message-digest if# ip ospf message-digest-key [id:1..255] md5 [key]
Routes
- Standard: AD: 110
- InterArea:
- E1: AD: 110. Cost: [det+cost]. Cost metric increments as the route traverses the AS.
- E2: AD: 110. Cost: [det]. Cost metric does not increment across AS.
Cost: 100 / (BW-inMBps). All speeds above 100 MBps are 1... Unless you adjust the factor.
Area's advertised cost:
On the ABR, declare the initial cost for an area:
router# area # default-cost #
Commands
Clear OSPF:
# clear ip ospf process
Show OSPF db:
# sh ip ospf database
Show OSPF config per interface
# sh ip ospf int
.
