Open Shortest Path First

Open Shortest Path First (OSPF) is a routing protocol developed for Internet Protocol (IP) networks by the interior gateway protocol (IGP) working group of the Internet Engineering Task Force (IETF).

Infromation about OSPF from Cisco Systems
-- Great document apart from the fact that someone from Cisco must have written it for their Grandma

OSPF Configuration on Zebra

Ok, to get OSPF going first hack zebra.conf and ospfd.conf

The remote stations need stuff like this ;

  1. Zebra.conf

# hostname whatever password passwd enable password passwd

router ospf

network area 0

# log /var/log/ospd.log

  1. end

ONLY advertise networks that this device is responsible for.

Single Area OSPF Configuration on Cisco Routers

Global Router Configurations

Router(config)#router ospf <process-number>

- Starts the OSPF process and identifies it with a process ID.

Router(config-router)#network <network> <wildcard-mask> area 0

- Identifies which networks - and which interfaces - partake in the OSPF process.

Router(config-router)#router-id <ip-address>

- Used to define the RID of the router.

Example of configuring the Router ID

 Router(config)#interface loopback 0
 Router(config-if)#ip address
 Router(config)#router ospf 100

Interface Level Configurations

Router(config-if)#ip ospf cost <cost>

- Sets the cost or metric for the outgoing interface.

Router(config-if)#auto-cost reference-bandwidth <reference-bandwidth>

- Allows the administrator to change the formula used to calculate the metric.

Router(config-if)#ip ospf priority <number>

- Helps to determine which router on a multicast network will be elected as the DR/BDR.

Router(config-if)#ip ospf network <network-type>

- Identifies the type of network to the OSPF process, which will determine how the adjacencies are created.

Router(config-if)#neighbor <ip-address> (priority <number>) (poll-interval <sec>) (cost <number>)

- States the neighbor, its address, and its capability to become the DR. - This command also allows the configuration of cost and the timers on the interface.

Operation Verification Commands

Router#show ip ospf

- Shows the OSPF process and it's details.

Router#show ip ospf database

- Show the contents of the topological database.

Router#show ip ospf interface

- Gives information about how OSPF has been configured on each interface

Router#show ip ospf neighbor

- Displays all the information about the relationship that the router has with it's neighbors.

Router#show ip protocols

- Enables you to view the IP routing protocol configuration on the router.

Router#show ip route

- Shows detailed information about the networks the router is aware and the preferred paths to those networks. - Also gives the next logical hop as the next step in the path.

Troubleshooting Commands

With troubleshooting using debug, if you're connected via the console port, turn on console logging (Router(config)#logging console) or if connected by virtual terminal, turn on the logging monitor (Router#term mon)

Router#debug ip ospf events

- Displays information about OSPF-related events.

Router#debug ip packet

- Ip debugging information includes packets received, generated, and forwarded.

User Comments on Implementing OSPF

Perry says to stick everything in area 0, <shrug> so do it his way ok..

PerryLorier: Yeah, because dealing with area's is a bitch, and if you are just learning, stick everything in area 0, when your network gets large enough that convergance times are starting to become a worry, think about different areas then, but before that time, stick everything in area 0 and you'll save yourself a lot of hassle. Also, remember that Area 0 is "special" to OSPF, so if you decide to use area 42 or whatever, it will break.

LindsayDruett: Dealing with multiple areas is not really that bad, however, you must remember that all Areas must connect directly to Area 0, that is because Area 0 is the backbone Area.

If you really can't meet the requirements of directly connecting to Area 0 and have to go through another area instead, you can insert a Virtual Link - However, it is not a recommended strategy, I don't know if this feature is available on routers other than Cisco, but either way it is strongly advised to avoid using virtual links.

It is good practice to configure a Loopback Interface (other than on your OSPF router and use that Loopback interface for the OSPF RouterID. Also it is a good idea to configure it as the OSPF Router ID rather than letting the router discover that address as the OSPF RouterID.

It is also good practice to limit each area to 50 routers, make sure that each router has no more than 60 neighbors, that neighbor is spelled the American way, each Area Border router doesn't have more than 3 areas, and that you set the OSPF priority so that it doesn't get elected as a DR or BDR for more than 1 network.

OSPF Fundamentals

OSPF Neighbors

  • A router configured for OSPF sends out a small hello packet periodically. It has the source address of the router and a multicast destination address set to AllSPFRouters which is All routers running OSPF listen to the protocol and send their own hello packets periodically.
  • When the topology databases of the neighbors are the same (synchronized), the neighbors are fully adjacent. To ensure that the link is maintained and the topology databases are up to date and accurate, the Hello packet continues to transmit.

DR/BDR Election Process

  • Highest OSPF Priority Number

    • Priority is set between 0-255
    • Priority 0 means that the router is abstaining for DR/BDR Election
  • Highest IP Address (Router ID)

    • Cisco routers will submit their highest IP Address configured on a Loopback Interface if there is a Loopback Interface configured rather than use the highest IP Address configured on a physical interface of the router. If there is no Loopback Interface configured then the highest IP Address configured on a physical interface will be used.


  • Hello Timers

    • 10 Seconds on the default multicast media
    • 40 Seconds in instances where hello packets are tansmitted in unicast environments
  • Dead Timers

    • 4 times the hello timer period
  • Complete OSPF Database purge and update

    • 30 Minutes

Five packets are used to build the routing table for the first time.

  • Hello Protocol (Hello Packet)
  • Database Descriptor (DDP Packet)
  • Link-state Request (LSR Packet)
  • Link-state Update (LSU Packet)
  • Link-state Acknowledgement (LSACK Packet)

OSPF Topologies

  • Broadcast Multiaccess Network.

    • Broadcast multiaccess in any LAN Network, such as Ethernet, Token Ring, or FDDI. In this environment, OSPF sends out multicast traffic. A DR and a BDR will be elected.
  • Point-to-Point Network.

    • Point-to-Point technology is used where there is only one router directly connected to the transmitting or receiving router, such as PPP, SDLC, HDLC, etc. OSPF has no need for a DR or BDR in this scenario. OSPF messaging is sent using the multicast address for AllSPFRouters (
  • Point-to-Multipoint Network.

    • Point-to-Multipoint is a single interface that connects to multiple destinations. The underlying network treats the network as a series of point-to-point circuits. It replicates LSA packets for each circuit. OSPF traffic is sent as multicast. There is no DR or BDR election. This technology uses one IP subnet for all endpoints on the network.
  • Nonbroadcast Multiaccess Network.

    • Physically, some point-to-multipoint networks cannot support multicast or broadcast traffic. In an NBMA topology, special configuration is required. NBMA physically resembles a point-to-point line, but in fact, many destinations are possible. WAN clouds, including x.25 and Frame Relay, are examples of this technology. It is recommended that when deploying Frame Relay that sub-interfaces are configured.
 OSPF over NBMA   Point-to-Multipoint Nonbroadcast   Point-to-point   Broadcast   NBMA   Point-to-Multipoint 
 Addressing   Unicast   Multicast   Multicast   Unicast   Multicast 
 DR/BDR   No   No   Yes   Yes (Manual)   No 
 Manual Configuration of Neighbors   Yes   No   No   Yes   No 
 Hello Timer   30 Sec   10 Sec   10 Sec   30 Sec   30 Sec 
 Dead Timer   120 Sec   40 Sec   40 Sec   120 Sec   120 Sec 
 Compliance   Cisco   Cisco   Cisco   RFC 2328   RFC 2328 
 Network Supported   Star, Partial Mesh   Star, Sub-Interfaces   Full Mesh   Full Mesh   Star, Partial Mesh 
 Replicates Packets   Yes   Yes   Yes   Yes   Yes 
 Number of Subnets   1   Many (1 Per circuit)   1   1   1 

OSPF in multiple areas

Router Types

  • Internal Router
  • Backbone Router
  • Area Backbone Router (ABR)
  • Automonous System Boundary Router (ASBR)

Common Link-state Advertisemnets (LSA) Types

 Type 1   Router Link LSA   Intra-area LSA 
 Type 2   Network Link LSA   Intra-area LSA 
 Type 3   Network Summary Link LSA   Inter-area LSA 
 Type 4   AS external ASBR Summary Link LSA   Inter-area LSA 
 Type 5   External Link LSA   Originated by AS boundary routers 
 Type 7   Not So Stubby Area external LSA   Summary LSA 

OSPF Terms

 Adjacency   Formed when two neighboring routers have exchanged information and have the same topology table. The databases are synchronized, and they both see the same networks. 
 Area   A group of routers that share the same area ID. Each router in the area has the same topology table. The area is defined on an interface basis in the configuration of OSPF. 
 Autonomous System   Routers that share the same routing protocol with the organization. 
 Backup Designated Router (BDR)   The backup to the Designated Router (DR), in case the DR fails. The BDR performs none of the DR functions while the DR is operating correctly. 
 Cost   The metric for OSPF. It is not defined in the standard with a value. Cisco use the default of the inverse of bandwitdh so that the higher the speed of the link, the lower the cost, and, therefore, the more attractive the path.
This default can be overridden by by a manual configuration. This should be done only if you have full knowlege of the network. 
 Database descriptor   Referred to as DBDs or Database Descriptor Packets (DDPs). These are packets exchanged between neighbors during the exchange state. The DDPs contain a summary of the LSA, which describe the links of every router in the neighbor's topology table. 
 Designated Router (DR)   Router responsible for making adjacencies with all neighbors on a multiaccess network, such as Ethernet or FDDI. The DR represents the multiaccess network, in that it ensures that every router on the link has the same topology database. 
 Dijkstra Algorithm   A complex algorithm used by routers running link-state routing protocols to find the shortest path to the destination. 
 Exchange State   Method by which two neighboring routers discover the map of the network. When these routers become adjacent, they must first exchange DDPs to ensure that they have the same topology table. 
 Exstart State   State in which the neighboring routers determine the sequence number of the DDPs and establish the master/slave relationship. 
 Flood   A term that refers to network information. When network information is flooded, it is sent to every network device in the domain. 
 Fully Adjacent   When the routing tables of the two neighbors are fully synchronized, with exactly the same view of the network. 
 Init State   State in which a hello packet has been sent from the router, which is waiting for a reply to establish two-way communication. 
 Internal Router   A router that has all it's interfaces in the same area. 
 Link-state Advertisement (LSA)   A packet describing a router's links and the state of those links. There are different types of LSAa to describe the different types of links. 
 Link-state database   Otherwise known as the topology map, the link-state database has a map of every router, its links, and the state of the links. It also has a map of every network and every path to each network. 
 Link-state Request (LSR)   When the router recieves a DDP complete with summary of the LSA information, it compares the LSA against the topological database. If either the LSA entry is not present bor the entry is older than the DDP, it will request further information. 
 Link-state update (LSU)   Update sent in response to the LSR. It is the LSA that was requested. 
 Loading State   State in which, if the receiving router requires more information during the process in which two routers are creating an adjacency, it will request that particular link in more detail using the LSR packet. The LSR will prompt the master router to send the LSU packet. This is the same as an LSA used to flood the network with routing information. While the recieving router is awaiting the LSUs from its neighbor, it is in the loading state. 
 Neighbor   A router on the same link with whom routing information is exchanged. 
 Neighbor Table   A table built from hello messages received from the neighbors. The hello message also carries a list of the neighbors. 
 Priority   The means by which the DR can be manually elected - or, conversely, prevented from taking part in the DR/BDR election. 
 Shortest Path First (SPF)   The same as Dijkstra algorithm, which is the algorithm used to find the shortest path. 
 SPF Tree   A tree of the topological network. It can be drawn after the SPF algorithm has been run. The algorithm prunes the database of alternate paths and creates a loop-free shortest path to all networks. The router is at the root of the network, which is percieved from its perspective. 
 Topology Table   The same as a link-state database. the table contains every link in the wider network. 
 Two-way state   State during the process in which two routers are creating an adjacency. The new router see it's own router ID in the list of neighbors, and a neighbor relationship is established. This is the stage before routing information is exchanged.