3 minute read


Uses IP protocol 89 / RFC 1513 and 2328

Classless, and Uses Dijkstra’s shortest path algorithm (SFP)

Default OSPF Config:

R1(config)#Router ospf # locally significant. Doesn't have to match
R1(config-router)#router-id # sets the router ID. If you assign this while no interfaces are configured with an IP and in the up state, IOS will enable a router ID of
R1(config-router)#Network   area
# see below
R1(config-router)#network area 0
R1(config-router)#passive-interface fa0/2 # sets a passive interface.
R1(config-router)#default-information originate
R1(config-router)#maximum-paths 16 # default is 4 or 8, not sure.
R1(config-router)#auto-cost reference-bandwidth 1000 # to support 1 Gbps links. The command value is expressed in Mbps instead of bps

Interface Commands:

# Make sure to set bandwidth values for all interfaces instead of using the defaults
R1(config)#int g0/1
R1(config-if)#ip ospf authentication message-digest
R1(config-if)#ipv6 ospf authentication ipsec spi # couldn't get it to work in Packet tracer.
R1(config-if)#ip ospf authentication-key 7 cisco # 7 is the encryption level - if you leave it at default, it will be viewable in run!
R1(config-if)#ip ospf cost 10 # link costs = 100,000,000 bps / interface bandwidth in bps (Both 100Mbps and 1 Gbps = 1)
R1(config-if)#ip ospf dead-interval
R1(config-if)#ip ospf hello-interval 5 # you can change the defaults if needed
R1(config-if)#ip ospf message-digest-key
R1(config-if)#ip ospf priority 255# router priority


R1(config)#ipv6 unicast-routing
R1(config)#ipv6 router ospf 1
R1(config)#interface Serial0/0
R1(config-if)#ipv6 address 3fff:1234:abcd:1::1/64
R1(config-if)#ipv6 ospf area
# see below
R1(config-if)#ipv6 ospf 1 area 0
R1(config-if)#ipv6 enable

When configuring OSPFv3 over NBMA networks, such as Frame Relay and ATM, the neighbour statements are specified under the specific interface using the “ipv6 ospf neighbor [link local address]” interface configuration command. In OSPFv2, these would be configured in Router Configuration mode.

R1(config)#ipv6 unicast-routing
R1(config)#ipv6 router ospf 1
R1(config)#interface Serial0/0
R1(config-if)#frame-relay map ipv6 FE80::205:5EFF:FE6E:5C80 111 broadcast
R1(config-if)#ipv6 ospf neighbor FE80::205:5EFF:FE6E:5C80

Show Commands:

show ip ospf
show ip protocols
show ip ospf interface Serial0/0
show ip ospf interface brief
show ip ospf database # Used to display the collection of OSPF link states
show ip ospf topology
show ipv6 ospf neighbor
show ipv6 ospf neighbor detail
show ip ospf database network self-originate # DR Only
show ip ospf database network [link state ID] # view network LSA
debug ip ospf adj

Special command to clear OSPF:

R1#clear ip ospf process


ip ospf message-digest-key 1 md5 MyPassword
area 0 authentication message-digest # Can also be applied in an interface instead of globally

Main Notes:

Things that have to match between routers:
-Area ID’s and types
-Hello and dead timers
-OSPF password

Router types:
Internal router – All interfaces in the same area
Backbone router – Usually area 0
Area Border Router (ABR) – Connects to multiple areas
Autonomous System Boundary Router (ASBR) – Connects to an external network of some kind, a non-OSPF network

Determining DR:
Highest Priority
Highest RouterID
Highest loopback ip
Highest interface ipv4 address

Router learns about directly connected networks
Exchange hello packets with neighbors
Build a Link-State Packet (LSP) with information on each link
Flood the LSP to neighbors
Routers collect the LSPs from neighbors and construct a topology map
They then run their SPF algorithm and create an SPF Tree, which is used to populate the routing table

Packets Types:

  1. Hello
    -Establish and maintain adjacency with neighbor.
    -Every 10 seconds usually, 30 on Frame Relay
    -Sent to or FF02::5 multicast address
    -Includes a dead timer to remove neighbors after certain time if no hello packet is received
  2. Database description – Contains short list of LSDB used for checking against local LSDB
  3. Link-state request – Request more information on an entry
  4. Link-state update – Reply to LSR and to announce new information
  5. Link-state acknowledgement – Acknowledges an LSU

LSA Packet Types:
Type 1 – Router link entries – Flooded within the area they originated
Type 2 – Contains router ID and IP address of the DR and all routers on the segment – Created for every multiaccess network in the area – Flooded within the area they originated
Type 3 – Collective data from type 1 LSAs – Created for every network learned – Flooded from one area to another – Used to advertise networks from other areas
Type 4 – Generated by an ABR when an ASBR exists within an area – Advertises external networks into a routing domain
Type 5 – Describes routes to networks outside of the OSPF AS – Generated by the ASBR – Flooded to everyone in the AS

Adjacency database – Neighbors
Link-state database (LSB) – Topology table
Forwarding database – Populates routing table