# OSPFv2

OSPF version 2 is a routing protocol which is described in RFC 2328. OSPF is an IGP. Compared with RIP, OSPF can provide scalable network support and faster convergence times. OSPF is widely used in large networks such as ISP backbone and enterprise networks.

## OSPF Fundamentals

OSPF is, mostly, a link-state routing protocol. In contrast to distance-vector protocols, such as RIP or BGP, where routers describe available paths (i.e. routes) to each other, in link-state protocols routers instead describe the state of their links to their immediate neighboring routers.

Each router describes their link-state information in a message known as an LSA, which is then propagated through to all other routers in a link-state routing domain, by a process called flooding. Each router thus builds up an LSDB of all the link-state messages. From this collection of LSAs in the LSDB, each router can then calculate the shortest path to any other router, based on some common metric, by using an algorithm such as Edsger Dijkstra's SPF algorithm.

By describing connectivity of a network in this way, in terms of routers and links rather than in terms of the paths through a network, a link-state protocol can use less bandwidth and converge more quickly than other protocols. A link-state protocol need distribute only one link-state message throughout the link-state domain when a link on any single given router changes state, in order for all routers to reconverge on the best paths through the network. In contrast, distance vector protocols can require a progression of different path update messages from a series of different routers in order to converge.

The disadvantage to a link-state protocol is that the process of computing the best paths can be relatively intensive when compared to distance-vector protocols, in which near to no computation need be done other than (potentially) select between multiple routes. This overhead is mostly negligible for modern embedded CPUs, even for networks with thousands of nodes. The primary scaling overhead lies more in coping with the ever greater frequency of LSA updates as the size of a link-state area increases, in managing the LSDB and required flooding.

This section aims to give a distilled, but accurate, description of the more important workings of OSPF which an administrator may need to know to be able best configure and trouble-shoot OSPF.

### OSPF Mechanisms

OSPF defines a range of mechanisms, concerned with detecting, describing and propagating state through a network. These mechanisms will nearly all be covered in greater detail further on. They may be broadly classed as:

#### The Hello Protocol

The OSPF Hello protocol allows OSPF to quickly detect changes in two-way reachability between routers on a link. OSPF can additionally avail of other sources of reachability information, such as link-state information provided by hardware, or through dedicated reachability protocols such as BFD.

OSPF also uses the Hello protocol to propagate certain state between routers sharing a link, for example:

- Hello protocol configured state, such as the dead-interval.

- Router priority, for DR/BDR election.

- DR/BDR election results.

- Any optional capabilities supported by each router.

The Hello protocol is comparatively trivial and will not be explored in more detail.

#### LSAs

At the heart of OSPF are LSA messages. Despite the name, some LSA s do not, strictly speaking, describe link-state information. Common LSA s describe information such as:

- Routers, in terms of their links.

- Networks, in terms of attached routers.

- Routes, external to a link-state domain:

  External Routes

    Routes entirely external to OSPF. Routers originating such routes are known as ASBR routers.

  Summary Routes

    Routes which summarise routing information relating to OSPF areas external to the OSPF link-state area at hand, originated by ABR routers.

##### LSA Flooding

OSPF defines several related mechanisms, used to manage synchronisation of LSDB s between neighbors as neighbors form adjacencies and the propagation, or flooding of new or updated LSA s.

#### Areas

OSPF provides for the protocol to be broken up into multiple smaller and independent link-state areas. Each area must be connected to a common backbone area by an ABR. These ABR routers are responsible for summarising the link-state routing information of an area into Summary LSAs, possibly in a condensed (i.e. aggregated) form, and then originating these summaries into all other areas the ABR is connected to.

Note that only summaries and external routes are passed between areas. As these describe paths, rather than any router link-states, routing between areas hence is by distance-vector, not link-state.

### OSPF LSAs

The core objects in OSPF are LSA s. Everything else in OSPF revolves around detecting what to describe in LSAs, when to update them, how to flood them throughout a network and how to calculate routes from them.

There are a variety of different LSA s, for purposes such as describing actual link-state information, describing paths (i.e. routes), describing bandwidth usage of links for TE purposes, and even arbitrary data by way of Opaque LSA s.

#### LSA Header

All LSAs share a common header with the following information:

- Type

  Different types of LSA s describe different things in OSPF. Types include:

  - Router LSA

  - Network LSA

  - Network Summary LSA

  - Router Summary LSA

  - AS-External LSA

  The specifics of the different types of LSA are examined below.

- Advertising Router

  The Router ID of the router originating the LSA.

See also

`ospf router-id A.B.C.D`.

- LSA ID

  The ID of the LSA, which is typically derived in some way from the information the LSA describes, e.g. a Router LSA uses the Router ID as the LSA ID, a Network LSA will have the IP address of the DR as its LSA ID.

  The combination of the Type, ID and Advertising Router ID must uniquely identify the LSA. There can however be multiple instances of an LSA with the same Type, LSA ID and Advertising Router ID, see sequence number.

- Age

  A number to allow stale LSA s to, eventually, be purged by routers from their LSDB s.

  The value nominally is one of seconds. An age of 3600, i.e. 1 hour, is called the MaxAge. MaxAge LSAs are ignored in routing calculations. LSAs must be periodically refreshed by their Advertising Router before reaching MaxAge if they are to remain valid.

  Routers may deliberately flood LSAs with the age artificially set to 3600 to indicate an LSA is no longer valid. This is called flushing of an LSA.

  It is not abnormal to see stale LSAs in the LSDB, this can occur where a router has shutdown without flushing its LSA(s), e.g. where it has become disconnected from the network. Such LSAs do little harm.

- Sequence Number

  A number used to distinguish newer instances of an LSA from older instances.

#### Link-State LSAs

Of all the various kinds of LSA s, just two types comprise the actual link-state part of OSPF, Router LSA s and Network LSA s. These LSA types are absolutely core to the protocol.

Instances of these LSAs are specific to the link-state area in which they are originated. Routes calculated from these two LSA types are called intra-area routes.

- Router LSA

  Each OSPF Router must originate a router LSA to describe itself. In it, the router lists each of its OSPF enabled interfaces, for the given link-state area, in terms of:

  Cost

    The output cost of that interface, scaled inversely to some commonly known reference value, `auto-cost reference-bandwidth (1-4294967)`.

  Link Type

    Transit Network

    A link to a multi-access network, on which the router has at least one Full adjacency with another router.

  PtP

    A link to a single remote router, with a Full adjacency. No DR is elected on such links; no network LSA is originated for such a link.

    Stub

      A link with no adjacent neighbors, or a host route.

  - Link ID and Data

    These values depend on the Link Type:

    Link Type | Link ID | Link Data
    --- | --- | ---
    Transit | Link IP address of the DR | Interface IP address
    Point-to-Point | Router ID of the remote router | Local interface IP address, or the ifindex for unnumbered links
    Stub | IP address | Subnet Mask

    Links on a router may be listed multiple times in the Router LSA, e.g. a PtP interface on which OSPF is enabled must always be described by a Stub link in the Router LSA, in addition to being listed as PtP link in the Router LSA if the adjacency with the remote router is Full.

    Stub links may also be used as a way to describe links on which OSPF is not spoken, known as passive interfaces, see `ip ospf passive [A.B.C.D]`.

- Network LSA

  On multi-access links (e.g. ethernets, certain kinds of ATM and X.25 configurations), routers elect a DR. The DR is responsible for originating a Network LSA, which helps reduce the information needed to describe multi-access networks with multiple routers attached. The DR also acts as a hub for the flooding of LSA s on that link, thus reducing flooding overheads.

  The contents of the Network LSA describes the:

  - Subnet Mask

    As the LSA ID of a Network LSA must be the IP address of the DR, the Subnet Mask together with the LSA ID gives you the network address.

  - Attached Routers

    Each router fully-adjacent with the DR is listed in the LSA, by their Router-ID. This allows the corresponding Router LSA s to be easily retrieved from the LSDB.

Summary of Link State LSAs:

LSA Type | LSA ID | LSA Data Describes
--- | --- | ---
Router LSA | Router ID | The OSPF enabled links of the router, within a specific link-state area.
Network LSA | The IP address of the DR for the network | The subnet mask of the network and the Router IDs of all routers on the network

With an LSDB composed of just these two types of LSA, it is possible to construct a directed graph of the connectivity between all routers and networks in a given OSPF link-state area. So, not surprisingly, when OSPF routers build updated routing tables, the first stage of SPF calculation concerns itself only with these two LSA types.

#### Link-State LSA Examples

The example below shows two LSA s, both originated by the same router (Router ID 192.168.0.49) and with the same LSA ID (192.168.0.49), but of different LSA types.

The first LSA being the router LSA describing 192.168.0.49's links: 2 links to multi-access networks with fully-adjacent neighbors (i.e. Transit links) and 1 being a Stub link (no adjacent neighbors).

The second LSA being a Network LSA, for which 192.168.0.49 is the DR, listing the Router IDs of 4 routers on that network which are fully adjacent with 192.168.0.49.

    # show ip ospf database router 192.168.0.49

           OSPF Router with ID (192.168.0.53)

                    Router Link States (Area 0.0.0.0)

      LS age: 38
      Options: 0x2  : *|-|-|-|-|-|E|*
      LS Flags: 0x6
      Flags: 0x2 : ASBR
      LS Type: router-LSA
      Link State ID: 192.168.0.49
      Advertising Router: 192.168.0.49
      LS Seq Number: 80000f90
      Checksum: 0x518b
      Length: 60
       Number of Links: 3

        Link connected to: a Transit Network
         (Link ID) Designated Router address: 192.168.1.3
         (Link Data) Router Interface address: 192.168.1.3
          Number of TOS metrics: 0
           TOS 0 Metric: 10

        Link connected to: a Transit Network
         (Link ID) Designated Router address: 192.168.0.49
         (Link Data) Router Interface address: 192.168.0.49
          Number of TOS metrics: 0
           TOS 0 Metric: 10

        Link connected to: Stub Network
         (Link ID) Net: 192.168.3.190
         (Link Data) Network Mask: 255.255.255.255
          Number of TOS metrics: 0
           TOS 0 Metric: 39063
    # show ip ospf database network 192.168.0.49

           OSPF Router with ID (192.168.0.53)

                    Net Link States (Area 0.0.0.0)

      LS age: 285
      Options: 0x2  : *|-|-|-|-|-|E|*
      LS Flags: 0x6
      LS Type: network-LSA
      Link State ID: 192.168.0.49 (address of Designated Router)
      Advertising Router: 192.168.0.49
      LS Seq Number: 80000074
      Checksum: 0x0103
      Length: 40
      Network Mask: /29
            Attached Router: 192.168.0.49
            Attached Router: 192.168.0.52
            Attached Router: 192.168.0.53
            Attached Router: 192.168.0.54

Note that from one LSA, you can find the other. E.g. Given the Network-LSA you have a list of Router IDs on that network, from which you can then look up, in the local LSDB, the matching Router LSA. From that Router-LSA you may (potentially) find links to other Transit networks and Routers IDs which can be used to lookup the corresponding Router or Network LSA. And in that fashion, one can find all the Routers and Networks reachable from that starting LSA.

Given the Router LSA instead, you have the IP address of the DR of any attached transit links. Network LSAs will have that IP as their LSA ID, so you can then look up that Network LSA and from that find all the attached routers on that link, leading potentially to more links and Network and Router LSAs, etc. etc.

From just the above two LSA s, one can already see the following partial topology:

    ------------------------ Network: ......
                |            Designated Router IP: 192.168.1.3
                |
          IP: 192.168.1.3
           (transit link)
            (cost: 10)
       Router ID: 192.168.0.49(stub)---------- IP: 192.168.3.190/32
            (cost: 10)        (cost: 39063)
           (transit link)
          IP: 192.168.0.49
                |
                |
    ------------------------------ Network: 192.168.0.48/29
      |        |           |       Designated Router IP: 192.168.0.49
      |        |           |
      |        |     Router ID: 192.168.0.54
      |        |
      |   Router ID: 192.168.0.53
      |
    Router ID: 192.168.0.52

Note the Router IDs, though they look like IP addresses and often are IP addresses, are not strictly speaking IP addresses, nor need they be reachable addresses (though, OSPF will calculate routes to Router IDs).

#### External LSAs

External, or "Type 5", LSA s describe routing information which is entirely external to OSPF, and is "injected" into OSPF. Such routing information may have come from another routing protocol, such as RIP or BGP, they may represent static routes or they may represent a default route.

An OSPF router which originates External LSA s is known as an ASBR. Unlike the link-state LSA s, and most other LSA s, which are flooded only within the area in which they originate, External LSA s are flooded through-out the OSPF network to all areas capable of carrying External LSA s (Areas).

Routes internal to OSPF (intra-area or inter-area) are always preferred over external routes.

The External LSA describes the following:

IP Network number

  The IP Network number of the route is described by the LSA ID field.

IP Network Mask

  The body of the External LSA describes the IP Network Mask of the route. This, together with the LSA ID, describes the prefix of the IP route concerned.

Metric

  The cost of the External Route. This cost may be an OSPF cost (also known as a "Type 1" metric), i.e. equivalent to the normal OSPF costs, or an externally derived cost ("Type 2" metric) which is not comparable to OSPF costs and always considered larger than any OSPF cost. Where there are both Type 1 and 2 External routes for a route, the Type 1 is always preferred.

Forwarding Address

  The address of the router to forward packets to for the route. This may be, and usually is, left as 0 to specify that the ASBR originating the External LSA should be used. There must be an internal OSPF route to the forwarding address, for the forwarding address to be usable.

Tag

  An arbitrary 4-bytes of data, not interpreted by OSPF, which may carry whatever information about the route which OSPF speakers desire.

#### AS External LSA Example

To illustrate, below is an example of an External LSA in the LSDB of an OSPF router. It describes a route to the IP prefix of 192.168.165.0/24, originated by the ASBR with Router-ID 192.168.0.49. The metric of 20 is external to OSPF. The forwarding address is 0, so the route should forward to the originating ASBR if selected.

    # show ip ospf database external 192.168.165.0
      LS age: 995
      Options: 0x2  : *|-|-|-|-|-|E|*
      LS Flags: 0x9
      LS Type: AS-external-LSA
      Link State ID: 192.168.165.0 (External Network Number)
      Advertising Router: 192.168.0.49
      LS Seq Number: 800001d8
      Checksum: 0xea27
      Length: 36
      Network Mask: /24
            Metric Type: 2 (Larger than any link state path)
            TOS: 0
            Metric: 20
            Forward Address: 0.0.0.0
            External Route Tag: 0

We can add this to our partial topology from above, which now looks like::

    --------------------- Network: ......
             |            Designated Router IP: 192.168.1.3
             |
       IP: 192.168.1.3      /---- External route: 192.168.165.0/24
        (transit link)     /                Cost: 20 (External metric)
         (cost: 10)       /
    Router ID: 192.168.0.49(stub)---------- IP: 192.168.3.190/32
         (cost: 10)        (cost: 39063)
        (transit link)
       IP: 192.168.0.49
             |
             |
    ------------------------------ Network: 192.168.0.48/29
      |        |           |       Designated Router IP: 192.168.0.49
      |        |           |
      |        |     Router ID: 192.168.0.54
      |        |
      |   Router ID: 192.168.0.53
      |
    Router ID: 192.168.0.52

#### Summary LSAs

Summary LSAs are created by ABR s to summarise the destinations available within one area to other areas. These LSAs may describe IP networks, potentially in aggregated form, or ASBR routers.

## Configuring OSPF

ospfd accepts all Common Invocation Options.

-n, --instance

  Specify the instance number for this invocation of ospfd.

-a, --apiserver

  Enable the OSPF API server. This is required to use `ospfclient`.

-l, --apiserver_addr <address>

  Specify the local IPv4 address to which to bind the OSPF API server socket. If unspecified, connections are accepted to any address. Specification of 127.0.0.1 can be used to limit socket access to local applications.

ospfd must acquire interface information from zebra in order to function. Therefore zebra must be running before invoking ospfd. Also, if zebra is restarted then ospfd must be too.

Configuration for the daemon should be saved in the FRR integrated configuration file located in /etc/frr/frr.conf, see Integrated Config File for more information on system configuration.

Prior versions of FRR supported reading and writing per-daemon config files; however, with the introduction of the centralized management daemon `mgmtd` this could no longer be supported.

In order to allow for an orderly transition from per-daemon config files to the integrated config file, FRR daemons will continue to try and read their specific per-daemon configuration file as before. Additionally the config can still be loaded directly using the `-f` or `--config-file` CLI options; however, these files will not be updated when the configuration is written (e.g., with the `write mem` command).

Warning

Per-daemon files will no longer be updated when the user issues a `write memory` command. Therefore these per-daemon config files should only be used as a mechanism for transitioning to the integrated config, and then removed.

### Multi-instance Support

OSPF supports multiple instances. Each instance is identified by a positive nonzero integer that must be provided when adding configuration items specific to that instance. Enabling instances is done with `/etc/frr/daemons` in the following manner:

    ...
    ospfd=yes
    ospfd_instances=1,5,6
    ...

The `ospfd_instances` variable controls which instances are started and what their IDs are. In this example, after starting FRR you should see the following processes:

    # ps -ef | grep "ospfd"
    frr      11816     1  0 17:30 ?        00:00:00 /usr/lib/frr/ospfd --daemon -A 127.0.0.1 -n 1
    frr      11822     1  0 17:30 ?        00:00:00 /usr/lib/frr/ospfd --daemon -A 127.0.0.1 -n 2
    frr      11828     1  0 17:30 ?        00:00:00 /usr/lib/frr/ospfd --daemon -A 127.0.0.1 -n 3

The instance number should be specified in the config when addressing a particular instance:

    router ospf 5
       ospf router-id 1.2.3.4
       area 0.0.0.0 authentication message-digest
       ...

### Routers

To start OSPF process you have to specify the OSPF router.

router ospf [{(1-65535)|vrf NAME}]

  Enable or disable the OSPF process.

  Multiple instances don't support vrf NAME.

ospf router-id A.B.C.D

  This sets the router-ID of the OSPF process. The router-ID may be an IP address of the router, but need not be - it can be any arbitrary 32bit number. However it MUST be unique within the entire OSPF domain to the OSPF speaker - bad things will happen if multiple OSPF speakers are configured with the same router-ID! If one is not specified then ospfd will obtain a router-ID automatically from zebra.

ospf abr-type TYPE

  type can be cisco|ibm|shortcut|standard. The "Cisco" and "IBM" types are equivalent.

  The OSPF standard for ABR behaviour does not allow an ABR to consider routes through non-backbone areas when its links to the backbone are down, even when there are other ABRs in attached non-backbone areas which still can reach the backbone - this restriction exists primarily to ensure routing-loops are avoided.

  With the "Cisco" or "IBM" ABR type, the default in this release of FRR, this restriction is lifted, allowing an ABR to consider summaries learned from other ABRs through non-backbone areas, and hence route via non-backbone areas as a last resort when, and only when, backbone links are down.

  Note that areas with fully-adjacent virtual-links are considered to be "transit capable" and can always be used to route backbone traffic, and hence are unaffected by this setting (`area A.B.C.D virtual-link A.B.C.D`).

  More information regarding the behaviour controlled by this command can be found in RFC 3509, and draft-ietf-ospf-shortcut-abr-02.txt.

  Quote: "Though the definition of the ABR in the OSPF specification does not require a router with multiple attached areas to have a backbone connection, it is actually necessary to provide successful routing to the inter-area and external destinations. If this requirement is not met, all traffic destined for the areas not connected to such an ABR or out of the OSPF domain, is dropped. This document describes alternative ABR behaviors implemented in Cisco and IBM routers."

ospf rfc1583compatibility

  RFC 2328, the successor to RFC 1583, suggests according to section G.2 (changes) in section 16.4 a change to the path preference algorithm that prevents possible routing loops that were possible in the old version of OSPFv2. More specifically it demands that inter-area paths and intra-area backbone path are now of equal preference but still both preferred to external paths.

  This command should NOT be set normally.

log-adjacency-changes [detail]

  Configures ospfd to log changes in adjacency. With the optional detail argument, all changes in adjacency status are shown. Without detail, only changes to full or regressions are shown.

passive-interface default

  Make all interfaces that belong to this router passive by default. For the description of passive interface look at `ip ospf passive [A.B.C.D]`. Per-interface configuration takes precedence over the default value.

timers throttle spf (0-600000) (0-600000) (0-600000)

  This command sets the initial delay, the initial-holdtime and the maximum-holdtime between when SPF is calculated and the event which triggered the calculation. The times are specified in milliseconds and must be in the range of 0 to 600000 milliseconds.

  The delay specifies the minimum amount of time to delay SPF calculation (hence it affects how long SPF calculation is delayed after an event which occurs outside of the holdtime of any previous SPF calculation, and also serves as a minimum holdtime).

  Consecutive SPF calculations will always be separated by at least 'hold-time' milliseconds. The hold-time is adaptive and initially is set to the initial-holdtime configured with the above command. Events which occur within the holdtime of the previous SPF calculation will cause the holdtime to be increased by initial-holdtime, bounded by the maximum-holdtime configured with this command. If the adaptive hold-time elapses without any SPF-triggering event occurring then the current holdtime is reset to the initial-holdtime. The current holdtime can be viewed with `show ip ospf`, where it is expressed as a multiplier of the initial-holdtime.

      router ospf
      timers throttle spf 200 400 10000

  In this example, the delay is set to 200ms, the initial holdtime is set to 400ms and the maximum holdtime to 10s. Hence there will always be at least 200ms between an event which requires SPF calculation and the actual SPF calculation. Further consecutive SPF calculations will always be separated by between 400ms to 10s, the hold-time increasing by 400ms each time an SPF-triggering event occurs within the hold-time of the previous SPF calculation.

  This command supersedes the timers spf command in previous FRR releases.

timers throttle lsa all (0-5000)

  This command sets the minimum interval between originations of the same LSA or the minimum LSA refresh interval. The time is specified in milliseconds and the default is 5 seconds (5000 milliseconds) consistent with the architectural constant MinLSInterval specified in Appendix D of RFC 2328. When a self-originated LSA needs to be reoriginated, it may be delayed for up to this interval.

      router ospf
       timers throttle lsa all 1000

  In this example, the minimum LSA refresh interval is set to 1000ms. This command reduces the delay between successive originations of a self-originated LSA from 5000 milliseconds to 1000 milliseconds.

timers lsa min-arrival (0-5000)

  This command sets the minimum interval between receptions of instances of the same LSA or the minimum LSA arrival interval. The time is specified in milliseconds and the default is 1 second (1000 milliseconds) consistent with the architectural constant MinLSArrival specified in Appendix D of RFC 2328. If a newer instance of the same LSA is received in less than this interval, it is ignored.

      router ospf
       timers lsa min-arrival 50

  In this example, the minimum LSA arrival interval is set to 50ms. This command reduces the minimum interval required between instances of the same LSA from 1000 milliseconds to 50 milliseconds.

max-metric router-lsa [on-startup (5-86400)|on-shutdown (5-100)]

max-metric router-lsa administrative

  This enables RFC 3137 support, where the OSPF process describes its transit links in its router-LSA as having infinite distance so that other routers will avoid calculating transit paths through the router while still being able to reach networks through the router.

  This support may be enabled administratively (and indefinitely) or conditionally. Conditional enabling of max-metric router-lsas can be for a period of seconds after startup and/or for a period of seconds prior to shutdown.

  Enabling this for a period after startup allows OSPF to converge fully first without affecting any existing routes used by other routers, while still allowing any connected stub links and/or redistributed routes to be reachable. Enabling this for a period of time in advance of shutdown allows the router to gracefully excuse itself from the OSPF domain.

  Enabling this feature administratively allows for administrative intervention for whatever reason, for an indefinite period of time. Note that if the configuration is written to file, this administrative form of the stub-router command will also be written to file. If ospfd is restarted later, the command will then take effect until manually deconfigured.

  Configured state of this feature as well as current status, such as the number of second remaining till on-startup or on-shutdown ends, can be viewed with the `show ip ospf` command.

auto-cost reference-bandwidth (1-4294967)

  This sets the reference bandwidth for cost calculations, where this bandwidth is considered equivalent to an OSPF cost of 1, specified in Mbits/s. The default is 100Mbit/s (i.e. a link of bandwidth 100Mbit/s or higher will have a cost of 1. Cost of lower bandwidth links will be scaled with reference to this cost).

  This configuration setting MUST be consistent across all routers within the OSPF domain.

neighbor A.B.C.D [poll-interval (1-65535)] [priority (0-255)]

  Configures OSPF neighbors for non-broadcast multi-access (NBMA) networks and point-to-multipoint non-broadcast networks. The poll-interval specifies the rate for sending hello packets to neighbors that are not active. When the configured neighbor is discovered, hello packets will be sent at the rate of the hello-interval. The default poll-interval is 60 seconds. The priority is used to for the Designated Router (DR) election on non-broadcast multi-access networks.

network A.B.C.D/M area A.B.C.D

network A.B.C.D/M area (0-4294967295)

  This command specifies the OSPF enabled interface(s). If the interface has an address from range 192.168.1.0/24 then the command below enables ospf on this interface so router can provide network information to the other ospf routers via this interface.

      router ospf
      network 192.168.1.0/24 area 0.0.0.0

  Prefix length in interface must be equal or bigger (i.e. smaller network) than prefix length in network statement. For example statement above doesn't enable ospf on interface with address 192.168.1.1/23, but it does on interface with address 192.168.1.129/25.

  Note that the behavior when there is a peer address defined on an interface changed after release 0.99.7. Currently, if a peer prefix has been configured, then we test whether the prefix in the network command contains the destination prefix. Otherwise, we test whether the network command prefix contains the local address prefix of the interface.

  It is also possible to enable OSPF on a per interface/subnet basis using the interface command (`ip ospf area AREA [ADDR]`). However, mixing both network commands (`network`) and interface commands (`ip ospf`) on the same router is not supported.

proactive-arp

  This command enables or disables sending ARP requests to update neighbor table entries. It speeds up convergence for /32 networks on a P2P connection.

  This feature is enabled by default.

clear ip ospf [(1-65535)] process

  This command can be used to clear the ospf process data structures. This will clear the ospf neighborship as well and it will get re-established. This will clear the LSDB too. This will be helpful when there is a change in router-id and if user wants the router-id change to take effect, user can use this cli instead of restarting the ospfd daemon.

clear ip ospf [(1-65535)] neighbor

  This command can be used to clear the ospf neighbor data structures. This will clear the ospf neighborship and it will get re-established. This command can be used when the neighbor state get stuck at some state and this can be used to recover it from that state.

maximum-paths (1-64)

  Use this command to control the maximum number of equal cost paths to reach a specific destination. The upper limit may differ if you change the value of MULTIPATH_NUM during compilation. The default is MULTIPATH_NUM (64).

write-multiplier (1-100)

  Use this command to tune the amount of work done in the packet read and write threads before relinquishing control. The parameter is the number of packets to process before returning. The default value of this parameter is 20.

socket buffer <send | recv | all> (1-4000000000)

  This command controls the ospf instance's socket buffer sizes. The 'no' form resets one or both values to the default.

no socket-per-interface

  Ordinarily, ospfd uses a socket per interface for sending packets. This command disables those per-interface sockets, and causes ospfd to use a single socket per ospf instance for sending and receiving packets.

forwarding-address-self

  By default, when an OSPF router redistributes routes into OSPF, it sets the forwarding address field of the resulting next-hop.

  When this command is configured, the router sets the forwarding address field to its own address, causing other routers to send traffic for the redistributed routes to ASBR directly.

  This command is useful in scenarios where the ASBR is multi-homed (ECMP) and the administrator wants to ensure that traffic for redistributed routes is sent to the correct next-hop.

### Areas

area A.B.C.D range A.B.C.D/M [advertise [cost (0-16777215)]]

area (0-4294967295) range A.B.C.D/M [advertise [cost (0-16777215)]]

  Summarize intra area paths from specified area into one Type-3 summary-LSA announced to other areas. This command can be used only in ABR and ONLY router-LSAs (Type-1) and network-LSAs (Type-2) (i.e. LSAs with scope area) can be summarized. Type-5 AS-external-LSAs can't be summarized - their scope is AS.

      router ospf
       network 192.168.1.0/24 area 0.0.0.0
       network 10.0.0.0/8 area 0.0.0.10
       area 0.0.0.10 range 10.0.0.0/8

  With configuration above one Type-3 Summary-LSA with routing info 10.0.0.0/8 is announced into backbone area if area 0.0.0.10 contains at least one intra-area network (i.e. described with router or network LSA) from this range.

area A.B.C.D range A.B.C.D/M not-advertise

area (0-4294967295) range A.B.C.D/M not-advertise

  Instead of summarizing intra area paths filter them - i.e. intra area paths from this range are not advertised into other areas. This command makes sense in ABR only.

area A.B.C.D range A.B.C.D/M {substitute A.B.C.D/M|cost (0-16777215)}

area (0-4294967295) range A.B.C.D/M {substitute A.B.C.D/M|cost (0-16777215)}

  Substitute summarized prefix with another prefix.

      router ospf
       network 192.168.1.0/24 area 0.0.0.0
       network 10.0.0.0/8 area 0.0.0.10
       area 0.0.0.10 range 10.0.0.0/8 substitute 11.0.0.0/8

  One Type-3 summary-LSA with routing info 11.0.0.0/8 is announced into backbone area if area 0.0.0.10 contains at least one intra-area network (i.e. described with router-LSA or network-LSA) from range 10.0.0.0/8.

  By default, the metric of the summary route is calculated as the highest metric among the summarized routes. The cost option, however, can be used to set an explicit metric.

  This command makes sense in ABR only.

area A.B.C.D virtual-link A.B.C.D

area (0-4294967295) virtual-link A.B.C.D

area A.B.C.D shortcut

area (0-4294967295) shortcut

  Configure the area as Shortcut capable. See RFC 3509. This requires that the 'abr-type' be set to 'shortcut'.

area A.B.C.D stub

area (0-4294967295) stub

  Configure the area to be a stub area. That is, an area where no router originates routes external to OSPF and hence an area where all external routes are via the ABR(s). Hence, ABRs for such an area do not need to pass AS-External LSAs (type-5s) or ASBR-Summary LSAs (type-4) into the area. They need only pass Network-Summary (type-3) LSAs into such an area, along with a default-route summary.

area A.B.C.D stub no-summary

area (0-4294967295) stub no-summary

  Prevents an ospfd ABR from injecting inter-area summaries into the specified stub area.

area A.B.C.D nssa

area (0-4294967295) nssa

  Configure the area to be a NSSA (Not-So-Stubby Area). This is an area that allows OSPF to import external routes into a stub area via a new LSA type (type 7). An NSSA autonomous system boundary router (ASBR) will generate this type of LSA. The area border router (ABR) translates the LSA type 7 into LSA type 5, which is propagated into the OSPF domain. NSSA areas are defined in RFC 3101.

area A.B.C.D nssa suppress-fa

area (0-4294967295) nssa suppress-fa

  Configure the router to set the forwarding address to 0.0.0.0 in all LSA type 5 translated from LSA type 7. The router needs to be elected the translator of the area for this command to take effect. This feature causes routers that are configured not to advertise forwarding addresses into the backbone to direct forwarded traffic to the NSSA ABR translator.

area A.B.C.D nssa default-information-originate [metric-type (1-2)] [metric (0-16777214)]

area (0-4294967295) nssa default-information-originate [metric-type (1-2)] [metric (0-16777214)]

  NSSA ABRs and ASBRs can be configured with the default-information-originate option to originate a Type-7 default route into the NSSA area. In the case of NSSA ASBRs, the origination of the default route is conditioned to the existence of a default route in the RIB that wasn't learned via the OSPF protocol.

area A.B.C.D nssa range A.B.C.D/M [<not-advertise|cost (0-16777215)>]

area (0-4294967295) nssa range A.B.C.D/M [<not-advertise|cost (0-16777215)>]

  Summarize a group of external subnets into a single Type-7 LSA, which is then translated to a Type-5 LSA and avertised to the backbone. This command can only be used at the area boundary (NSSA ABR router).

  By default, the metric of the summary route is calculated as the highest metric among the summarized routes. The cost option, however, can be used to set an explicit metric.

  The not-advertise option, when present, prevents the summary route from being advertised, effectively filtering the summarized routes.

area A.B.C.D default-cost (0-16777215)

  Set the cost of default-summary LSAs announced to stubby areas.

area A.B.C.D export-list NAME

area (0-4294967295) export-list NAME

  Filter Type-3 summary-LSAs announced to other areas originated from intra- area paths from specified area.

      router ospf
       network 192.168.1.0/24 area 0.0.0.0
       network 10.0.0.0/8 area 0.0.0.10
       area 0.0.0.10 export-list foo
      !
      access-list foo permit 10.10.0.0/16
      access-list foo deny any

  With example above any intra-area paths from area 0.0.0.10 and from range 10.10.0.0/16 (for example 10.10.1.0/24 and 10.10.2.128/30) are announced into other areas as Type-3 summary-LSA's, but any others (for example 10.11.0.0/16 or 10.128.30.16/30) aren't.

  This command is only relevant if the router is an ABR for the specified area.

area A.B.C.D import-list NAME

area (0-4294967295) import-list NAME

  Same as export-list, but it applies to paths announced into specified area as Type-3 summary-LSAs.

area A.B.C.D filter-list prefix NAME in

area A.B.C.D filter-list prefix NAME out

area (0-4294967295) filter-list prefix NAME in

area (0-4294967295) filter-list prefix NAME out

  Filtering Type-3 summary-LSAs to/from area using prefix lists. This command makes sense in ABR only.

area A.B.C.D authentication

area (0-4294967295) authentication

  Specify that simple password authentication should be used for the given area.

area A.B.C.D authentication message-digest

area (0-4294967295) authentication message-digest

  Specify that OSPF packets must be authenticated with MD5 HMACs within the given area. Keying material must also be configured on a per-interface basis (`ip ospf message-digest-key`).

  MD5 authentication may also be configured on a per-interface basis (`ip ospf authentication message-digest`). Such per-interface settings will override any per-area authentication setting.

### Interfaces

ip ospf area AREA [ADDR]

  Enable OSPF on the interface, optionally restricted to just the IP address given by ADDR, putting it in the AREA area. If you have a lot of interfaces, and/or a lot of subnets, then enabling OSPF via this command instead of (`network A.B.C.D/M area A.B.C.D`) may result in a slight performance improvement.

  Notice that, mixing both network commands (`network`) and interface commands (`ip ospf`) on the same router is not supported. If (`ip ospf`) is present, (`network`) commands will fail.

ip ospf authentication-key AUTH_KEY

  Set OSPF authentication key to a simple password. After setting AUTH_KEY, all OSPF packets are authenticated. AUTH_KEY has length up to 8 chars.

  Simple text password authentication is insecure and deprecated in favour of MD5 HMAC authentication.

ip ospf authentication message-digest

  Specify that MD5 HMAC authentication must be used on this interface. MD5 keying material must also be configured. Overrides any authentication enabled on a per-area basis (`area A.B.C.D authentication message-digest`)

  Note that OSPF MD5 authentication requires that time never go backwards (correct time is NOT important, only that it never goes backwards), even across resets, if ospfd is to be able to promptly reestablish adjacencies with its neighbors after restarts/reboots. The host should have system time be set at boot from an external or non-volatile source (e.g. battery backed clock, NTP, etc.) or else the system clock should be periodically saved to non-volatile storage and restored at boot if MD5 authentication is to be expected to work reliably.

ip ospf message-digest-key KEYID md5 KEY

  Set OSPF authentication key to a cryptographic password. The cryptographic algorithm is MD5.

  KEYID identifies secret key used to create the message digest. This ID is part of the protocol and must be consistent across routers on a link.

  KEY is the actual message digest key, of up to 16 chars (larger strings will be truncated), and is associated with the given KEYID.

ip ospf authentication key-chain KEYCHAIN

  Specify that HMAC cryptographic authentication must be used on this interface using a key chain. Overrides any authentication enabled on a per-area basis (`area A.B.C.D authentication message-digest`).

  `KEYCHAIN`: Specifies the name of the key chain that contains the authentication key(s) and cryptographic algorithms to be used for OSPF authentication. The key chain is a logical container that holds one or more authentication keys, allowing for key rotation and management.

  Note that OSPF HMAC cryptographic authentication requires that time never go backwards (correct time is NOT important, only that it never goes backwards), even across resets, if ospfd is to be able to promptly reestablish adjacencies with its neighbors after restarts/reboots. The host should have system time be set at boot from an external or non-volatile source (e.g. battery backed clock, NTP, etc.) or else the system clock should be periodically saved to non-volatile storage and restored at boot if HMAC cryptographic authentication is to be expected to work reliably.

  Example:

      r1(config)#key chain temp
      r1(config-keychain)#key 13
      r1(config-keychain-key)#key-string ospf
      r1(config-keychain-key)#cryptographic-algorithm hmac-sha-256
      r1(config)#int eth0
      r1(config-if)#ip ospf authentication key-chain temp
      r1(config-if)#ip ospf area 0

ip ospf cost (1-65535)

  Set link cost for the specified interface. The cost value is set to router-LSA's metric field and used for SPF calculation.

ip ospf dead-interval (1-65535)

ip ospf dead-interval minimal hello-multiplier (2-20)

  Set number of seconds for RouterDeadInterval timer value used for Wait Timer and Inactivity Timer. This value must be the same for all routers attached to a common network. The default value is 40 seconds.

  If 'minimal' is specified instead, then the dead-interval is set to 1 second and one must specify a hello-multiplier. The hello-multiplier specifies how many Hellos to send per second, from 2 (every 500ms) to 20 (every 50ms). Thus one can have 1s convergence time for OSPF. If this form is specified, then the hello-interval advertised in Hello packets is set to 0 and the hello-interval on received Hello packets is not checked, thus the hello-multiplier need NOT be the same across multiple routers on a common link.

ip ospf hello-interval (1-65535)

  Set number of seconds for HelloInterval timer value. Setting this value, Hello packet will be sent every timer value seconds on the specified interface. This value must be the same for all routers attached to a common network. The default value is 10 seconds.

  This command has no effect if `ip ospf dead-interval minimal hello-multiplier (2-20)` is also specified for the interface.

ip ospf dead-timer-reset any-control

  Enable resetting the OSPF neighbor inactivity timer upon receipt of any valid OSPF control packet, not only Hello packets. This implements Recommendation 2 from RFC 4222 to improve adjacency robustness under congestion.

ip ospf dscp (all|low-control) (0-63)

  Set the DSCP value applied to OSPF control packets. The `all` option marks all OSPF packets with the specified DSCP value. The `low-control` option marks only low‑priority OSPF control packets.

  Example:

      ! mark only low‑priority OSPF control packets with DSCP 40:
      interface eth0
        ip ospf dscp low-control 40

ip ospf graceful-restart hello-delay (1-1800)

  Set the length of time during which Grace-LSAs are sent at 1-second intervals while coming back up after an unplanned outage. During this time, no hello packets are sent.

  A higher hello delay will increase the chance that all neighbors are notified about the ongoing graceful restart before receiving a hello packet (which is crucial for the graceful restart to succeed). The hello delay shouldn't be set too high, however, otherwise the adjacencies might time out. As a best practice, it's recommended to set the hello delay and hello interval with the same values. The default value is 10 seconds.

ip ospf network (broadcast|non-broadcast|point-to-multipoint [delay-reflood|non-broadcast]|point-to-point [dmvpn])

  When configuring a point-to-point network on an interface and the interface has a /32 address associated with then OSPF will treat the interface as being unnumbered. If you are doing this you must set the net.ipv4.conf.<interface name>.rp_filter value to 0. In order for the ospf multicast packets to be delivered by the kernel.

  When used in a DMVPN network at a spoke, this OSPF will be configured in point-to-point, but the HUB will be a point-to-multipoint. To make this topology work, specify the optional 'dmvpn' parameter at the spoke.

  When the network is configured as point-to-multipoint and non-broadcast is specified, the network doesn't support broadcast or multicast delivery and neighbors cannot be discovered from OSPF hello received from the OSPFAllRouters (224.0.0.5). Rather, they must be explicitly configured using the `neighbor A.B.C.D` configuration command as they are on non-broadcast networks.

  When the network is configured as point-to-multipoint and delay-reflood is specified, LSAs received on the interface from neighbors on the interface will not be flooded back out on the interface immediately. Rather, they will be added to the neighbor's link state retransmission list and only sent to the neighbor if the neighbor doesn't acknowledge the LSA prior to the link state retransmission timer expiring.

  Set explicitly network type for specified interface.

ip ospf priority (0-255)

  Set RouterPriority integer value. The router with the highest priority will be more eligible to become Designated Router. Setting the value to 0, makes the router ineligible to become Designated Router. The default value is 1.

ip ospf retransmit-interval (1-65535)

  Set number of seconds for RxmtInterval timer value. This value is used when retransmitting Database Description and Link State Request packets. The default value is 5 seconds.

ip ospf retransmit-window (20-1000)

  > Set number of milliseconds in the window for neighbor LSA retransmission. When a neighbor Link State (LS) retransmission timer expires, LSAs scheduled to be retransmitted within the number of milliseconds configured are retransmitted to the neighbor. Any expiring after the window will be retransmitted the next time the neighbor LS retransmission timer expires. The default is 50 milliseconds.

  ip ospf transmit-delay (1-65535) [A.B.C.D]

    Set number of seconds for InfTransDelay value. LSAs' age should be incremented by this value when transmitting. The default value is 1 second.

ip ospf passive [A.B.C.D]

  Do not speak OSPF on the interface, but do advertise the interface as a stub link in the router-LSA for this router. This allows one to advertise addresses on such connected interfaces without having to originate AS-External/Type-5 LSAs (which have global flooding scope) - as would occur if connected addresses were redistributed into OSPF (Redistribution). This is the only way to advertise non-OSPF links into stub areas.

ip ospf prefix-suppression [A.B.C.D]

  Configure OSPF to not advertise the IPv4 prefix associated with the OSPF interface. The associated IPv4 prefix will be omitted from an OSPF router-LSA or advertised with a host mask in an OSPF network-LSA as specified in RFC 6860, "Hiding Transit-Only Networks in OSPF". If an optional IPv4 address is specified, the prefix suppression will apply to the OSPF interface associated with the specified interface address.

ip ospf neighbor-filter NAME [A.B.C.D]

  Configure an IP prefix-list to use to filter packets received from OSPF neighbors on the OSPF interface. The prefix-list should include rules to permit or deny OSPF neighbors by IP source address. This is useful for multi-access interfaces where adjacencies with only a subset of the reachable neighbors are desired. Applications include testing partially meshed topologies, OSPF Denial of Service (DoS) mitigation, and avoidance of adjacencies with OSPF neighbors not meeting traffic engineering criteria.

  > Example:

    !
    ! Prefix-list to block neighbor with source address 10.1.0.2
    !
    ip prefix-list nbr-filter seq 10 deny 10.1.0.2/32
    ip prefix-list nbr-filter seq 200 permit any
    !
    ! Configure the neighbor filter prefix-list on interface eth0
    !
    interface eth0
     ip ospf neighbor-filter nbr-filter
    !

ip ospf area (A.B.C.D|(0-4294967295))

  Enable ospf on an interface and set associated area.

## OSPF route-map

Usage of ospfd's route-map support.

set metric [+|-](0-4294967295)

  Set a metric for matched route when sending announcement. Use plus (+) sign to add a metric value to an existing metric. Use minus (-) sign to subtract a metric value from an existing metric.

### Redistribution

redistribute <babel|bgp|connected|eigrp|isis|kernel|openfabric|ospf|rip|sharp|static|table> [metric-type (1-2)] [metric (0-16777214)] [route-map WORD]

  Redistribute routes of the specified protocol or kind into OSPF, with the metric type and metric set if specified, filtering the routes using the given route-map if specified. Redistributed routes may also be filtered with distribute-lists, see ospf distribute-list configuration.

  Redistributed routes are distributed as into OSPF as Type-5 External LSAs into links to areas that accept external routes, Type-7 External LSAs for NSSA areas and are not redistributed at all into Stub areas, where external routes are not permitted.

  Note that for connected routes, one may instead use the `ip ospf passive [A.B.C.D]` configuration.

default-information originate

default-information originate metric (0-16777214)

default-information originate metric (0-16777214) metric-type (1|2)

default-information originate metric (0-16777214) metric-type (1|2) route-map WORD

default-information originate always

default-information originate always metric (0-16777214)

default-information originate always metric (0-16777214) metric-type (1|2)

default-information originate always metric (0-16777214) metric-type (1|2) route-map WORD

  Originate an AS-External (type-5) LSA describing a default route into all external-routing capable areas, of the specified metric and metric type. If the 'always' keyword is given then the default is always advertised, even when there is no default present in the routing table.

distribute-list NAME out <kernel|connected|static|rip|isis|bgp|eigrp|nhrp|table|vnc|babel|openfabric>

  Apply the access-list filter, NAME, to redistributed routes of the given type before allowing the routes to be redistributed into OSPF (ospf redistribution).

default-metric (0-16777214)

distance (1-255)

distance ospf (intra-area|inter-area|external) (1-255)

## Graceful Restart

graceful-restart [grace-period (1-1800)]

  Configure Graceful Restart (RFC 3623) restarting support. When enabled, the default grace period is 120 seconds.

  To perform a graceful shutdown, the "graceful-restart prepare ip ospf" EXEC-level command needs to be issued before restarting the ospfd daemon.

  When Graceful Restart is enabled and the ospfd daemon crashes or is killed abruptely (e.g. SIGKILL), it will attempt an unplanned Graceful Restart once it restarts.

graceful-restart helper enable [A.B.C.D]

  Configure Graceful Restart (RFC 3623) helper support. By default, helper support is disabled for all neighbors. This config enables/disables helper support on this router for all neighbors. To enable/disable helper support for a specific neighbor, the router-id (A.B.C.D) has to be specified.

graceful-restart helper strict-lsa-checking

  If 'strict-lsa-checking' is configured then the helper will abort the Graceful Restart when a LSA change occurs which affects the restarting router. By default 'strict-lsa-checking' is enabled"

graceful-restart helper supported-grace-time (10-1800)

  Supports as HELPER for configured grace period.

graceful-restart helper planned-only

  It helps to support as HELPER only for planned restarts. By default, it supports both planned and unplanned outages.

graceful-restart prepare ip ospf

  Initiate a graceful restart for all OSPF instances configured with the "graceful-restart" command. The ospfd daemon should be restarted during the instance-specific grace period, otherwise the graceful restart will fail.

  This is an EXEC-level command.

## Showing Information

show ip ospf [vrf <NAME|all>] [json]

  Show information on a variety of general OSPF and area state and configuration information.

show ip ospf interface [INTERFACE] [json]

  Show state and configuration of OSPF the specified interface, or all interfaces if no interface is given.

show ip ospf neighbor [json]

show ip ospf [vrf <NAME|all>] neighbor INTERFACE [json]

show ip ospf neighbor detail [json]

show ip ospf [vrf <NAME|all>] neighbor A.B.C.D [detail] [json]

show ip ospf [vrf <NAME|all>] neighbor INTERFACE detail [json]

  Display lsa information of LSDB. Json o/p of this command covers base route information i.e all LSAs except opaque lsa info.

show ip ospf [vrf <NAME|all>] database [self-originate] [json]

  Show the OSPF database summary.

show ip ospf [vrf <NAME|all>] database max-age [json]

  Show all MaxAge LSAs present in the OSPF link-state database.

show ip ospf [vrf <NAME|all>] database detail [LINK-STATE-ID] [adv-router A.B.C.D] [json]

show ip ospf [vrf <NAME|all>] database detail [LINK-STATE-ID] [self-originate] [json]

show ip ospf [vrf <NAME|all>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) [LINK-STATE-ID] [adv-router A.B.C.D] [json]

show ip ospf [vrf <NAME|all>] database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) [LINK-STATE-ID] [self-originate] [json]

  Show detailed information about the OSPF link-state database.

show ip ospf route [detail] [json]

  Show the OSPF routing table, as determined by the most recent SPF calculation. When detail option is used, it shows more information to the CLI like advertising router ID for each route, etc.

show ip ospf [vrf <NAME|all>] border-routers [json]

  Show the list of ABR and ASBR border routers summary learnt via OSPFv2 Type-3 (Summary LSA) and Type-4 (Summary ASBR LSA). User can get that information as JSON format when `json` keyword at the end of cli is presented.

show ip ospf [{(1-65535)|vrf <NAME|all>}] graceful-restart helper [detail] [json]

  Displays the Graceful Restart Helper details including helper config changes.

## Opaque LSA

ospf opaque-lsa

capability opaque

  ospfd supports Opaque LSA (RFC 5250) as partial support for MPLS Traffic Engineering LSAs. The opaque-lsa capability must be enabled in the configuration. An alternate command could be "mpls-te on" (Traffic Engineering). Note that FRR offers only partial support for some of the routing protocol extensions that are used with MPLS-TE; it does not support a complete RSVP-TE solution.

ip ospf capability opaque [A.B.C.D]

  Enable or disable OSPF LSA database exchange and flooding on an interface. The default is that opaque capability is enabled as long as the opaque capability is enabled with the `capability opaque` command at the OSPF instance level (using the command above). Note that disabling opaque LSA support on an interface will impact the applications using opaque LSAs if the opaque LSAs are not received on other flooding paths by all the OSPF routers using those applications. For example, OSPF Graceful Restart uses opaque-link LSAs and disabling support on an interface will disable graceful restart signaling on that interface.

show ip ospf [vrf <NAME|all>] database (opaque-link|opaque-area|opaque-external)

show ip ospf [vrf <NAME|all>] database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID

show ip ospf [vrf <NAME|all>] database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID adv-router ADV-ROUTER

show ip ospf [vrf <NAME|all>] database (opaque-link|opaque-area|opaque-external) adv-router ADV-ROUTER

show ip ospf [vrf <NAME|all>] database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID self-originate

show ip ospf [vrf <NAME|all>] database (opaque-link|opaque-area|opaque-external) self-originate

  Show Opaque LSA from the database.

show ip ospf (1-65535) reachable-routers

show ip ospf [vrf <NAME|all>] reachable-routers

  Show routing table of reachable routers.

## Traffic Engineering

Note

At this time, FRR offers partial support for some of the routing protocol extensions that can be used with MPLS-TE. FRR does not support a complete RSVP-TE solution currently.

mpls-te on

  Enable Traffic Engineering LSA flooding.

mpls-te router-address <A.B.C.D>

  Configure stable IP address for MPLS-TE. This IP address is then advertise in Opaque LSA Type-10 TLV=1 (TE) option 1 (Router-Address).

mpls-te inter-as area <area-id>|as

  Enable RFC 5392 support - Inter-AS TE v2 - to flood Traffic Engineering parameters of Inter-AS link. 2 modes are supported: AREA and AS; LSA are flood in AREA <area-id> with Opaque Type-10, respectively in AS with Opaque Type-11. In all case, Opaque-LSA TLV=6.

mpls-te export

  Export Traffic Engineering Data Base to other daemons through the ZAPI Opaque Link State messages.

show ip ospf mpls-te interface

show ip ospf mpls-te interface INTERFACE

  Show MPLS Traffic Engineering parameters for all or specified interface.

show ip ospf mpls-te router

  Show Traffic Engineering router parameters.

show ip ospf mpls-te database [verbose|json]

show ip ospf mpls-te database vertex [self-originate|adv-router ADV-ROUTER] [verbose|json]

show ip ospf mpls-te database edge [A.B.C.D] [verbose|json]

show ip ospf mpls-te database subnet [A.B.C.D/M] [verbose|json]

  Show Traffic Engineering Database

## Router Information

router-info [as | area]

  Enable Router Information (RFC 4970) LSA advertisement with AS scope (default) or Area scope flooding when area is specified. Old syntax router-info area <A.B.C.D> is always supported but mark as deprecated as the area ID is no more necessary. Indeed, router information support multi-area and detect automatically the areas.

pce address <A.B.C.D>

pce domain as (0-65535)

pce neighbor as (0-65535)

pce flag BITPATTERN

pce scope BITPATTERN

  The commands are conform to RFC 5088 and allow OSPF router announce Path Computation Element (PCE) capabilities through the Router Information (RI) LSA. Router Information must be enable prior to this. The command set/unset respectively the PCE IP address, Autonomous System (AS) numbers of controlled domains, neighbor ASs, flag and scope. For flag and scope, please refer to :rfc`5088` for the BITPATTERN recognition. Multiple 'pce neighbor' command could be specified in order to specify all PCE neighbors.

show ip ospf router-info

  Show Router Capabilities flag.

show ip ospf router-info pce

  Show Router Capabilities PCE parameters.

## Segment Routing

This is an EXPERIMENTAL support of Segment Routing as per RFC 8665 for MPLS dataplane.

segment-routing on

  Enable Segment Routing. Even if this also activate routing information support, it is preferable to also activate routing information, and set accordingly the Area or AS flooding.

segment-routing global-block (16-1048575) (16-1048575) [local-block (16-1048575) (16-1048575)]

  Set the Segment Routing Global Block i.e. the label range used by MPLS to store label in the MPLS FIB for Prefix SID. Optionally also set the Local Block, i.e. the label range used for Adjacency SID. The negative version of the command always unsets both ranges.

segment-routing node-msd (1-16)

  Fix the Maximum Stack Depth supported by the router. The value depend of the MPLS dataplane. E.g. for Linux kernel, since version 4.13 it is 32.

segment-routing prefix A.B.C.D/M [index (0-65535)|no-php-flag|explicit-null]

  prefix with /32 corresponding to a loopback interface are currently supported. The 'no-php-flag' means NO Penultimate Hop Popping that allows SR node to request to its neighbor to not pop the label. The 'explicit-null' means that neighbor nodes must swap the incoming label by the MPLS Explicit Null label before delivering the packet.

show ip ospf database segment-routing <adv-router ADVROUTER|self-originate> [json]

  Show Segment Routing Data Base, all SR nodes, specific advertised router or self router. Optional JSON output can be obtained by appending 'json' to the end of the command.

## External Route Summarisation

This feature summarises originated external LSAs(Type-5 and Type-7). Summary Route will be originated on-behalf of all matched external LSAs.

summary-address A.B.C.D/M [tag (1-4294967295)]

  This command enable/disables summarisation for the configured address range. Tag is the optional parameter. If tag configured Summary route will be originated with the configured tag.

summary-address A.B.C.D/M no-advertise

  This command to ensure not advertise the summary lsa for the matched external LSAs.

aggregation timer (5-1800)

  Configure aggregation delay timer interval. Summarisation starts only after this delay timer expiry. By default, delay interval is 5 seconds.

  The no form of the command resets the aggregation delay interval to default value.

show ip ospf [vrf <NAME|all>] summary-address [detail] [json]

  Show configuration for display all configured summary routes with matching external LSA information.

## TI-LFA

Experimental support for Topology Independent LFA (Loop-Free Alternate), see for example 'draft-bashandy-rtgwg-segment-routing-ti-lfa-05'. Note that TI-LFA requires a proper Segment Routing configuration.

fast-reroute ti-lfa [node-protection]

  Configured on the router level. Activates TI-LFA for all interfaces.

  Note that so far only P2P interfaces are supported.

## Debugging OSPF

debug ospf [(1-65535)] bfd

  Enable or disable debugging for BFD events. This will show BFD integration library messages and OSPF BFD integration messages that are mostly state transitions and validation problems.

debug ospf [(1-65535)] client-api

  Enable or disable debugging for the OSPF opaque data client API.

debug ospf [(1-65535)] default-information

  Enable or disable debugging of default information origination

debug ospf [(1-65535)] packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail]

  Enable or disable debugging for received and transmitted OSPF packets

debug ospf [(1-65535)] ism [status|events|timers]

  Enable or disable debugging of Interface State Machine

debug ospf [(1-65535)] nsm [status|events|timers]

  Enable or disable debugging of Neighbor State Machine transitions

debug ospf [(1-65535)] event

  Enable or disable debugging of OSPF events

debug ospf [(1-65535)] nssa

  Enable or disable debugging about Not-So-Stubby-Areas (NSSAs)

debug ospf [(1-65535)] ldp-sync

  Enable or disable debugging about LDP-Sync

debug ospf [(1-65535)] lsa [aggregate|flooding|generate|install|refresh]

  Enable or disable detail debugging of Link State Advertisements (LSAs)

debug ospf [(1-65535)] sr

  Enable or disable debugging about Segment Routing

debug ospf [(1-65535)] te

  Enable or disable debugging about MPLS Traffic Engineering LSA

debug ospf [(1-65535)] ti-lfa

  Enable or disable debugging about SR TI-LFA

debug ospf [(1-65535)] zebra [interface|redistribute]

  Enable or disable debugging of ZEBRA API

debug ospf [(1-65535)] graceful-restart

  Enable or disable debugging for OSPF Graceful Restart Helper

show debugging ospf

  Show enabled OSPF debugging options

## Sample Configuration

A simple example, with MD5 authentication enabled:

    !
    interface bge0
     ip ospf authentication message-digest
     ip ospf message-digest-key 1 md5 ABCDEFGHIJK
    !
    router ospf
     network 192.168.0.0/16 area 0.0.0.1
     area 0.0.0.1 authentication message-digest

An ABR router, with MD5 authentication and performing summarisation of networks between the areas:

    !
    password ABCDEF
    log file /var/log/frr/ospfd.log
    service advanced-vty
    !
    interface eth0
     ip ospf authentication message-digest
     ip ospf message-digest-key 1 md5 ABCDEFGHIJK
    !
    interface ppp0
     ip ospf passive
    !
    interface br0
     ip ospf authentication message-digest
     ip ospf message-digest-key 2 md5 XYZ12345
    !
    router ospf
     ospf router-id 192.168.0.1
     redistribute connected
     network 192.168.0.0/24 area 0.0.0.0
     network 10.0.0.0/16 area 0.0.0.0
     network 192.168.1.0/24 area 0.0.0.1
     area 0.0.0.0 authentication message-digest
     area 0.0.0.0 range 10.0.0.0/16
     area 0.0.0.0 range 192.168.0.0/24
     area 0.0.0.1 authentication message-digest
     area 0.0.0.1 range 10.2.0.0/16
    !

A Traffic Engineering configuration, with Inter-ASv2 support.

First, the `zebra.conf` part:

    interface eth0
     ip address 198.168.1.1/24
     link-params
      enable
      admin-grp 0xa1
      metric 100
      max-bw 1.25e+07
      max-rsv-bw 1.25e+06
      unrsv-bw 0 1.25e+06
      unrsv-bw 1 1.25e+06
      unrsv-bw 2 1.25e+06
      unrsv-bw 3 1.25e+06
      unrsv-bw 4 1.25e+06
      unrsv-bw 5 1.25e+06
      unrsv-bw 6 1.25e+06
      unrsv-bw 7 1.25e+06
    !
    interface eth1
     ip address 192.168.2.1/24
     link-params
      enable
      metric 10
      max-bw 1.25e+07
      max-rsv-bw 1.25e+06
      unrsv-bw 0 1.25e+06
      unrsv-bw 1 1.25e+06
      unrsv-bw 2 1.25e+06
      unrsv-bw 3 1.25e+06
      unrsv-bw 4 1.25e+06
      unrsv-bw 5 1.25e+06
      unrsv-bw 6 1.25e+06
      unrsv-bw 7 1.25e+06
      neighbor 192.168.2.2 as 65000
       hostname HOSTNAME
       password PASSWORD
       log file /var/log/zebra.log
       !
       interface eth0
        ip address 198.168.1.1/24
        link-params
         enable
         admin-grp 0xa1
         metric 100
         max-bw 1.25e+07
         max-rsv-bw 1.25e+06
         unrsv-bw 0 1.25e+06
         unrsv-bw 1 1.25e+06
         unrsv-bw 2 1.25e+06
         unrsv-bw 3 1.25e+06
         unrsv-bw 4 1.25e+06
         unrsv-bw 5 1.25e+06
         unrsv-bw 6 1.25e+06
         unrsv-bw 7 1.25e+06
       !
       interface eth1
        ip address 192.168.2.1/24
        link-params
         enable
         metric 10
         max-bw 1.25e+07
         max-rsv-bw 1.25e+06
         unrsv-bw 0 1.25e+06
         unrsv-bw 1 1.25e+06
         unrsv-bw 2 1.25e+06
         unrsv-bw 3 1.25e+06
         unrsv-bw 4 1.25e+06
         unrsv-bw 5 1.25e+06
         unrsv-bw 6 1.25e+06
         unrsv-bw 7 1.25e+06
         neighbor 192.168.2.2 as 65000

Then the `ospfd.conf` itself:

    hostname HOSTNAME
    password PASSWORD
    log file /var/log/ospfd.log
    !
    !
    interface eth0
     ip ospf hello-interval 60
     ip ospf dead-interval 240
    !
    interface eth1
     ip ospf hello-interval 60
     ip ospf dead-interval 240
    !
    !
    router ospf
     ospf router-id 192.168.1.1
     network 192.168.0.0/16 area 1
     ospf opaque-lsa
     mpls-te
     mpls-te router-address 192.168.1.1
     mpls-te inter-as area 1
    !
    line vty

A router information example with PCE advertisement:

    !
    router ospf
     ospf router-id 192.168.1.1
     network 192.168.0.0/16 area 1
     capability opaque
     mpls-te
     mpls-te router-address 192.168.1.1
     router-info area 0.0.0.1
     pce address 192.168.1.1
     pce flag 0x80
     pce domain as 65400
     pce neighbor as 65500
     pce neighbor as 65200
     pce scope 0x80
    !