OSPF

Link State toc

=Router ID=


 * use "config-router# router-id" command
 * use highest up/up loopback address
 * use highest up/up non-loopback address

=Multicast Addresses=


 * **224.0.0.5** - All OSPF Routers
 * **224.0.0.6** - OSPF DRs

=Messages=


 * **Hello** - discover neighbors; heartbeat
 * **Database Description (DD)** - exchange brief LSA headers
 * **Link-state Request (LSR)** - request full details of LSAs
 * **Link-state Update (LSU)** - contains fully detailed LSAs
 * **Link-state Acknowledgement (LSAck)** - confirm LSU

=Requesting, Getting and Acknowledging LSAs=


 * After DD exchange of LSA headers, router will request full copies of LSAs that it needs
 * compares sequence numbers in local LSADB with headers in DD
 * sequence numbers start with 0x80000001, wrap around to 0x7FFFFFFF and re-flood at 0x80000000
 * ===**__Acknowledgements__**===
 * sends the same packet back
 * **LSAck Message** - list of LSA headers that be acknowledged

=DR Election=


 * occurs after routers have become neighbors, before DD packets
 * if Hello says DR is 0.0.0.0 (means no DR has been elected yet)
 * then routers wait a little longer for others to initialize (OSPF wait time; same value as dead timer)
 * ===**__Rules__**===
 * if priority is set, routers put their own RID in their Hello messages
 * others examine Hellos, look at the priority
 * if a router receives better priority, it replaces the RID in it's Hello messages with the better one
 * highest priority is considered better
 * if a router doesn't want to be a DR but still have a high priority, then it will become a BDR
 * late routers don't count
 * if a DR fails, its replaces by the BDR and a election for a new BDR starts

=Network Types=


 * **Broadcast** - DR & BDR; hello 10; 3+ hosts
 * **Point-to-Point** - No DR or BDR, only 224.0.0.5; hello 10
 * **NonBroadcast-MultiAccess** (NBMA) - Neighbors configured statically (unicast); hello 30; 3+ hosts
 * **Point-to-Multipoint** - No DR or BDR (multicast & broadcast); hello 30; 3+ hosts
 * **Point-to-point Nonbroadcast** - hello 30; neighbor command; 3+ hosts

=NBMA=

=Area Types=
 * ===Troubleshooting===
 * Hello/Dead timers
 * All expect or don't expect DR
 * DR must have PVC to every other router in the subnet
 * If one router has static neighbor command, the other router shouldn't need it, but it is recommended


 * **__Backbone__** - Area 0
 * **__Stub__** - Blocks external routes (no LSA type 5; ABR is default gateway)
 * area  stub
 * **__Totally Stubby__** - Blocks external routes and routes of other areas (no LSA type 3,5; ABR is default gateway)
 * area  nssa no-summary
 * **__Not-so-stubby (NSSA)__** - no LSA type 5; can create type 7
 * area  nssa
 * **__Totally NSSA__** - no LSA type 3, 5; can create type 7
 * area  stub no-summary

=LSA Types=


 * 1 - **router** - one per router; listing RID and all interface ip addresses; also represents stub networks
 * 2 - **network** - one per transit network; created by DR on subnet; represents the subnet and router interfaces
 * 3 - **net summary** - created by ABRs; represent area's type 1 & 2 LSAs into another area
 * 4 - **ASBR summary** - like type 3; advertises host route to reach each ASBR
 * 5 - **AS external** - created by ASBR; for externals routes injected into OSPF
 * 6 - **group membership** - defined for MOSPF; not supported by Cisco
 * 7 - **not-so-stubby-area external** - created by ASBRs inside NSSA area instead of type 5
 * 8 - **external attributes** - not implemented in Cisco routers
 * 9-11 - **opaque** - used as generic LSAs for future expansion

=External Route Types=


 * **E2** - LSA type 5; only external metric is considered by SPF; ASBR injects
 * **E1** - Floods type 5; creates type 4 with metric to ASBR that created type 5; both external and internal metrics are added together to compute the metric

=Best Type of Paths=


 * 1) Intra-area routes
 * 2) Interarea routes
 * 3) E1 routes
 * 4) E2 routes

=Loop Prevention=


 * ABR will not advertise LSAs from other ABRs into the backbone area
 * ABR will ignore LSAs created by other ABRs when learned through the backbone when calculating least-cost paths

=Filtering (not with redistribution)=


 * ===__Distribute Lists__===
 * doesnt filter inbound LSA; filters routes added to routing table
 * incoming interface param - incoming interface chacked as if its the outgoing interface for the routes

config# ip prefix-list WORD seq 5 deny 10.4.8.0/24 config# ip prefix-list WORD seq 10 permit 0.0.0.0/0 le 32 config-router# distribute-list prefix WORD in Serial0.2

config# route-map WORD deny 10 (sequence number) config-route-map# match ip address 1 (acl) config-route-map# match ip route-source 2 (acl) config# route-map WORD permit 20 (sequence number) config-router# distribute-list route-map WORD in


 * ===__ABR LSA Type 3 Filtering__===

config-router# area 3 filter-list prefix WORD out config-router# area 3 range 10.3.2.0 255.255.254.0 no-advertise

=Stub Router=


 * prevent router from becoming transit router
 * non-transit only forward to and from locally attached subnets
 * will advertise as infinite metric routes

config-router# max-metric router-lsa on-startup config-router# max-metric router-lsa on-startup wait-for-bgp (or 10 minutes)

=Configuration=

Basic
config# router ospf 1 config-router# log-adjacency-changes detail config-router# ip ospf priority 255 config-router# router-id 1.1.1.1 config-router# network 172.16.2.0 0.0.0.255 area 0 (any interface that matches the ip address will run ospf) config-router# area 0 range 172.16.0.0 255.255.0.0 (ABR injects internal router summaries) config-router# summary-address 172.30.0.0 255.255.0.0 (configured an ABR for external router summaries) config-router# area 2 stub (configures an ABR and Internal Routers for a stub area) config-router# area 3 stub no-summary (configures an ABR in a totally stubby area, internal routers should be configured as stub)

config-if# ip ospf 1 area 3 (ospf AS and area number on each interface)

RIP Redistribute
config# router ospf 1 config-router# network 172.30.0.0 config-router# redistribute rip metric 1000 metric-type [1|2] subnets (1= metric increments; 2 = no increment) config# router rip config-router# redistribute ospf 1 metric 10

NonBroadcast MultiAccess Mode
config-subif# ip ospf priority 0...255 (0 = not DR/BDR; 255 = DR/BDR) config-router# neighbor 170.100.100.2 (need to configure only one direction; used when nonbroadcast) config-if# frame-relay map ip 170.100.100.3 201 broadcast (need to configure on both ABRs to communicate even though routes have been learned)

Point-to-Multipoint
config-subif# ip ospf network point-to-multipoint (need to configure on both directions)

Timer Configuration
config-subif# ip ospf hello-interval 30 config-subif# ip ospf dead-interval 30 config-subif# ip ospf dead-timer minimal hello-multiplier 4 config-subif# ip ospf retransmit-interval

Virtual Links

 * for areas not directly connected to backbone
 * middle router becomes ABR with full copy of area 0's LSDB

config-router# area 1 virtual-link 1.1.1.1 (use router id; links two ABRs)

Redistribution Using Tags and ACLs
config# route-map eigrp2ospf config-route-map# match ip address 20 (ACL 20 to allow) config-route-map# set tag 10 (sets a tag of 10 to whatever matches this route map) config# router ospf 1 config-router# redistribute eigrp 10 metric 100 subnets route-map eigrp2ospf config# router eigrp 10 config-router# redistribute ospf 1 metric 1500 0 255 1 1500 route-map ospf2eigrp config# route-map ospf2eigrp config-route-map# match tag 5 config# route map ospf2eigrp 20 (sequence number 20; start is 10) config-route-map# match route-type internal

Inject Default Route into OSPF Domain
config-router# default-information originate always (configure this router as the gateway of last resort)

Authentication and VirtualLinks
config-router# area 0 authentication message-digest config-subif# ip ospf message-digest-key 1 md5 WORD config-router# area 1 virtual-link 6.6.6.6 message-digest-key 1 md5 WORD

=View/Debug Commands=

show ip ospf interface show ip ospf database show ip ospf database network (lsa type 2) show ip ospf database router (lsa type 1) show ip ospf database summary (lsa type 3) show ip ospf database asbr-summary (lsa type 4) show ip ospf database external (lsa type 5) show ip ospf database nssa-external (lsa type 7) show ip ospf virtual-links show ip ospf border-routers show ip ospf statistics debug ip ospf hello debug ip ospf adj