OSPF is an interior gateway protocol (IGP) that runs within a single autonomous system (AS). Exterior gateway protocols (EGPs), such as Border Gateway Protocol (BGP), exchange routing information between ASs.

OSPF is a link-state routing protocol, similar to the Intermediate System–to–Intermediate System (IS-IS) routing protocol. It advertises the states of its local network links. This link advertisement distinguishes OSPF from some IGPs, such as Routing Information Protocol (RIP). A distance vector protocol, such as RIP, advertises the distances (that is, the number of hops) to each known destination within the network.

Each participating OSPF router within the AS has an identical database describing the AS’s topology. Each individual piece of this database is a particular router’s local state. From this database, OSPF calculates a routing table by constructing a shortest-path tree.

OSPF learns the best routes to reachable destinations. It can quickly detect changes in the topology of an AS and, after a short convergence period, calculate new loop-free routes. This protocol has been designed expressly for the TCP/IP Internet environment, including explicit support for classless interdomain routing (CIDR) and the tagging of externally derived routing information.

This chapter provides direction for customizing basic OSPF settings if you need to do so. For detailed information about the OSPF commands, see the JunosE Command Reference Guide.

OSPF Terms

Table 51 defines commonly used OSPF terms.

Table 51: OSPF-Related Terms




The relationship between selected neighboring routers for exchanging routing information. Not every pair of neighboring routers is adjacent.


A collection of network segments interconnected by routers. It is a region in an OSPF routing domain.

area border router (ABR)

A router that sits on the edge of an OSPF area and routes link-state advertisements (LSAs) between areas.

area ID

A unique number that identifies an area. Typically, formatted as an IP address.


A process whereby a user or data source proves that it is what it claims to be.

authentication type

The method by which authentication is achieved—null (or none), simple, or MD5. For example, simple authentication requires a 64-bit password in each OSPF packet.

autonomous system (AS)

A set of networks or IP prefixes within a single routing policy domain.

autonomous system boundary router (AS boundary router)

An OSPF router that redistributes routing information from other routing protocol sources.

classless interdomain routing (CIDR)

An addressing method that replaces the traditional class structure of IP addresses. In CIDR, the boundary between the network and host portions of an IP address can be on any bit boundary. CIDR addresses have no class restrictions, enabling more efficient use of the IP address space. CIDR addresses are represented by a prefix and a notation that indicates the IP address and mask; for example,

designated router

A designated device (OSPF router) with which other routers form adjacencies, reducing the number of adjacencies required on a broadcast or NBMA network.


A collection of routers that use a common interior gateway protocol.


The distribution and synchronization of the link-state database between OSPF routers.

hello protocol

A protocol that establishes and maintains neighbor relationships and that communication between neighbors is bidirectional. The hello protocol also dynamically discovers neighboring routers on broadcast or point-to-point networks.

interior gateway protocol (IGP)

A routing protocol that routers within an AS use to exchange information.

link-state advertisement (LSA)

A unit of data that describes the local state of a router or network. LSAs are flooded throughout their respective flooding domains. For example, router LSAs are flooded within the area to which the router belongs, summary LSAs are flooded to other areas through the backbone, and external LSAs are flooded throughout the OSPF domain.

LSA types

OSPF LSAs are categorized into the following types:

  • Type 1—LSAs generated by an OSPF router for each area that it belongs to. Type 1 LSAs are flooded to only a single area. These LSAs carry information about directly connected links. Also known as router LSA.
  • Type 2—LSAs generated by an OSPF designated router to describe the set of routers in a network. Type 2 LSAs are flooded to the area that contains that network. Also known as network LSA.
  • Type 3—LSAs generated by an ABR to describe inter-area routes to networks outside of that area and internal to the AS; used for route summarization. Also known as inter-area prefix LSA.
  • Type 4—LSAs generated by an ABR to describe inter-area routes to ASBRs outside of that area and internal to the AS; used for route summarization. Also known as inter-area router LSA.
  • Type 5—LSAs generated by an ASBR to describe links that are external to the AS. Type 5 LSAs are reflooded from other protocols into OSPF, and are flooded by OSPF throughout the routing domain to all area types other than stub areas. OSPF sets the forwarding address for a type 5 LSA when the next hop is directly connected to the OSPF interface. Also known as AS-external LSA.
  • Type 6—Not supported.
  • Type 7—LSAs generated by an ASBR to describe routes that are external to an NSSA. Type 7 LSAs are flooded only to NSSAs.
  • Type 8—Not supported.
  • Type 9—Opaque LSA with a link-local scope. Type 9 LSAs are not flooded beyond the local network (local link).
  • Type 10—Opaque LSA with an area-local scope. Type-10 LSAs are not flooded beyond the borders of their associated area.
  • Type 11—Opaque LSA flooded throughout the AS. Type 11 LSAs are flooded throughout all transit areas, are not flooded into stub areas from the backbone, and are not originated by routers into their connected stub areas. Any type 11 LSA received in a stub area from a neighboring router within the stub area is rejected.
  • Link LSA—OSPFv3 LSA that Provides the router’s link-local address to all other routers attached to the link; informs other routers attached to the link of a list of IPv6 prefixes to associate with the link; enables the router to assert a collection of options bits in the network LSA to be originated for the link
  • Intra-area prefix LSA—OSPFv3 LSA that associates a list of IPv6 address prefixes with a transit network link by referencing a network LSA, or associates a list of IPv6 address prefixes with a router by referencing a router LSA. The intra-area prefix LSA includes the IPv6 prefix information that OSPFv2 includes in type 1 and type 2 LSAs.

neighboring routers

Routers that have interfaces to a common network.

nonbroadcast network

A network that has no broadcast capability but supports more than two routers.

Not-so-stubby area (NSSA)

Similar to a stub area, but can also import selected external LSAs.

router ID

A 32-bit number that uniquely identifies a router within an AS; for example,

stub area

An area that does not get flooded with external LSAs but does carry intra-area and interarea routes and a default route.

Totally stubby area

A stub area that also blocks type 3 summary LSAs from flowing into the area; however, type 3 LSAs carrying default route information alone are injected into the area.

virtual link

A logical link between two backbone routers for which the link tunnels through a nonbackbone area.

Figure 16 illustrates the topology of an OSPF routing domain.

Figure 16: OSPF Topology

OSPF Topology