Skip to content
The XG Series hardware appliances will reach end-of-life (EOL) on March 31, 2025. Click here to see the XG to XGS migration documentation.

Configure OSPF on the CLI

Learn how to configure OSPF (Open Shortest Path First) routing through the command-line interface. Find out how to enter OSPF configuration mode, specify a unique router ID, define networks and areas, and apply optional settings, such as adjacency change logging.

Note

When you apply Global configuration settings through the web admin console, the firewall removes any CLI configurations that conflict with those settings.

Configure OSPF

To configure OSPF, do as follows:

  1. To enter the OSPF configuration mode, enter the following options:

    1. For Route configuration: 3
    2. For Configure unicast routing: 1
    3. For OSPF: 2
  2. Run the following commands:

    1. Enter the global configuration mode: enable
    2. Enter the OSPF configuration mode: conf t or configure terminal
    3. Start the OSPF configuration: router ospf
    4. (Optional) Enter the router ID: ospf router-id <number or IP address>.

      • Use the IPv4 address format, for example, 12.13.14.15.
      • It doesn't need to be a valid IP address in your routing domain.
      • It must be unique within your routing domain.
      • You can't use 0.0.0.0.

      Note

      If you don't enter a value, the firewall uses the highest interface IP address.

    5. Configure the network address, its netmask, and the area: network <ip-address/netmask> area <area-id>

      The area ID defines an area in the network. On the CLI, you can use one of the following options:

      • A number from 0 to 4294967295
      • IP address format, for example, 1.2.3.4

      Note

      OSPF is turned on for the interfaces belonging to the network's subnets, and adjacency with neighbors is established.

      The firewall stores the IP address based on the netmask you specify. For example, if you enter 11.11.11.11/24, it's stored as 11.11.11.0/24.

    6. (Optional) To generate logs when a neighbor becomes available or unavailable without turning on debug mode: log-adjacency-changes

      When you configure OSPF from the web admin console, this command is applied by default.

    7. To save the configuration: write

    8. To see the OSPF configuration: show running-config
    9. To exit the router configuration mode: end
    10. To go back to the router management menu: exit

      Example
      ospf> enable
      ospf# conf t
      ospf(config)# router ospf 
      ospf(config-router)# ospf router-id 12.13.14.15
      ospf(config-router)# network 11.11.11.11/24 area 1000
      ospf(config-router)# log-adjacency-changes
      ospf(config-router)# exit
      ospf(config)# write