4.8. Configuring OSPF with CLI

This section provides information to configure the Open Shortest Path First (OSPF) protocol using the command line interface.

Topics in this section include:

4.9. OSPF Configuration Guidelines

Configuration planning is essential to organize routers, backbone, non-backbone, stub, NSSA areas, and transit links. OSPF provides essential defaults for basic protocol operability. You can configure or modify most commands and parameters.

The minimal OSPF parameters that are necessary to deploy OSPF are:

  1. router ID
    Each router running OSPF must be configured with a unique router ID. The router ID is used by the OSPF routing protocol to establish adjacencies.
    If a new router ID is defined, the OSPF protocol is not automatically restarted with the new ID. The router must be shut down and restarted in order to initialize the new router ID.
  2. area
    At least one OSPF area must be created. An interface must be assigned to each OSPF area.
  3. interfaces
    An interface is the connection between a router and one of its attached networks. An interface has state information associated with it, which is obtained from the underlying lower-level protocols and the routing protocol. An interface to a network has associated with it a single IP address and mask (unless the network is an unnumbered point-to-point network). An interface is sometimes also referred to as a link.

All configuration applies to both OSPF and OSPFv3 unless specifically noted in the OSPF Command Reference.

4.10. Basic OSPF Configuration

This section provides information to configure OSPF as well as configuration examples of common configuration tasks.

The minimal OSPF parameters that need to be configured are:

  1. a router ID
  2. one or more areas
  3. interfaces (interface "system")

The following is an example of a basic OSPF configuration:

ALU-A>config>router>ospf# info
----------------------------------------------
            area 0.0.0.0
                interface "system"
                exit
            exit
            area 0.0.0.20
                nssa
                exit
                interface "to-104"
                    priority 10
                exit
            exit
            area 0.0.1.1
            exit
----------------------------------------------
ALU-A>config>router>ospf#

4.10.1. Configuring the Router ID

The router ID uniquely identifies the router within an AS. In OSPF, routing information is exchanged between autonomous systems, which are groups of networks that share routing information. The router ID can be set to be the same as the system interface address (loopback address). This is the default setting.

The router ID is derived by one of the following methods:

  1. defining the value using the config>router>router-id ip-address command
  2. defining the system interface using the config>router>interface ip-int-name command (used if the router ID is not specified with the config>router>router-id ip-address command)
  3. inheriting the last 4 bytes of the MAC address

When configuring a new router ID, protocols are not automatically restarted with the new router ID. The next time a protocol is initialized, the new router ID is used. To force the new router ID, issue the shutdown and no shutdown commands for OSPF or restart the entire router.

Use the following CLI syntax to configure a router ID (in the config>router context):

CLI Syntax:
router-id ip-address

The following displays a router ID configuration example:

A:ALU-B>config>router# info
#------------------------------------------
# IP Configuration
#------------------------------------------
        interface "system"
            address 10.10.10.104/32
        exit
        interface "to-103"
            address 10.0.0.104/24
            port 1/1/1
        exit
        router-id 10.10.10.104
...
#------------------------------------------
A:ALU-B>config>router# 

4.10.2. Configuring an OSPF Area

An OSPF area consists of routers configured with the same area ID. To include a router in a specific area, the common area ID must be assigned and an interface identified.

If your network consists of multiple areas, you must also configure a backbone area (0.0.0.0) on at least one router. The backbone contains the area border routers and other routers not included in other areas. The backbone distributes routing information between areas. To maintain backbone connectivity, there must be at least one interface in the backbone area or a virtual link must be configured to another router in the backbone area.

The minimal configuration must include an area ID and an interface. Modifying other command parameters is optional.

Use the following CLI syntax to configure an OSPF area (in the config>router context):

CLI Syntax:
ospf
area area-id
area-range ip-prefix/mask [advertise | not-advertise]
blackhole-aggregate

The following displays an OSPF area configuration example:

A:ALU-A>config>router>ospf# info
----------------------------------------------
            area 0.0.0.0
            exit
            area 0.0.0.20
            exit
----------------------------------------------
ALU-A>config>router>ospf#

4.10.3. Configuring an Interface

In OSPF, an interface can be configured to act as a connection between a router and one of its attached networks. An interface includes state information that was obtained from underlying lower-level protocols and from the routing protocol itself. An interface to a network is associated with a single IP address and mask (unless the network is an unnumbered point-to-point network). If the address is removed from an interface, all OSPF data for the interface is also removed. If the address is merely changed, the OSPF configuration is preserved.

The passive command enables the passive property to and from the OSPF interface where passive interfaces are advertised as OSPF interfaces but do not run the OSPF protocol. By default, only interface addresses that are configured for OSPF are advertised as OSPF interfaces. The passive parameter allows an interface to be advertised as an OSPF interface without running the OSPF protocol. When enabled, the interface will ignore ingress OSPF protocol packets and not transmit any OSPF protocol packets.

Use the following CLI syntax to configure an OSPF interface (in the config>router context):

CLI Syntax:
ospf
area area-id
interface ip-int-name
advertise-subnet
auth-keychain name
authentication-key {authentication-key|hash-key} [hash|hash2]
authentication-type [password | message-digest]
bfd-enable [remain-down-on-failure]
dead-interval seconds
hello-interval seconds
interface-type {broadcast|point-to-point}
message-digest-key key-id md5 [key| hash-key] [hash|hash2]
metric metric
mtu bytes
passive
priority number
retransmit-interval seconds
no shutdown
transit-delay seconds

The following displays an interface configuration example:

A:ALU-49>config>router>ospf# info
----------------------------------------------
            asbr
            overload
            overload-on-boot timeout 60
            traffic-engineering
            export "OSPF-Export"
            exit
            area 0.0.0.0
                virtual-link 1.2.3.4 transit-area 1.2.3.4
                    hello-interval 9
                    dead-interval 40
                exit
                interface "system"
                exit
            exit
            area 0.0.0.20
                stub
                exit
                interface "to-103"
                exit
            exit
            area 0.0.0.25
                nssa
                exit
            exit
            area 1.2.3.4
            exit
----------------------------------------------
A:ALU-49>config>router>ospf#

4.11. Configuring Other OSPF Components

The following sections show the CLI syntax for:

4.11.1. Configuring a Stub Area

Configure stub areas to control external advertisement flooding and to minimize the size of the topological databases on an area’s routers. A stub area cannot also be configured as an NSSA. The area ID cannot be 0.0.0.0 – this address is reserved for the backbone area.

By default, summary route advertisements (type 3 LSAs) are sent into stub areas. The no form of the summary command disables sending summary route advertisements, and only the default route is advertised by the ABR.

Stub areas cannot be used as transit areas. If the area was originally configured as a transit area for a virtual link, existing virtual links are removed when its designation is changed to NSSA or stub.

Use the following CLI syntax to configure a stub area:

CLI Syntax:
ospf
area area-id
stub
default-metric metric
summaries

The following displays a stub configuration example:

ALU-A>config>router>ospf>area># info
----------------------------------------------
...
            area 0.0.0.0
            exit
            area 0.0.0.20
                stub
                exit
            exit

4.11.2. Configuring a Not-So-Stubby Area

NSSAs are similar to stub areas in that no external routes are imported into the area from other OSPF areas. The major difference between a stub area and an NSSA is that an NSSA can flood external routes that it learns throughout its area and from an area border router to the entire OSPF domain. An area cannot be both a stub area and an NSSA. The area ID cannot be 0.0.0.0 – this address is reserved for the backbone area.

NSSAs cannot be used as transit areas. If the area was originally configured as a transit area for a virtual link, existing virtual links are removed when its designation is changed to NSSA or stub.

Use the following CLI syntax to configure NSSAs:

CLI Syntax:
ospf
area area-id
nssa
area-range ip-prefix/mask [advertise| not-advertise]
originate-default-route [type-7]
redistribute-external
summaries

The following displays an NSSA configuration example:

A:ALU-49>config>router>ospf# info
----------------------------------------------          
...
            area 0.0.0.25
                nssa
                exit
            exit
----------------------------------------------
A:ALU-49>config>router>ospf#

4.11.3. Configuring a Virtual Link

The backbone area (area 0.0.0.0) must be contiguous and all other areas must be connected to the backbone area. If it is not possible or practical to connect an area to the backbone, the area border routers must be connected via a virtual link. Two area border routers will form a point-to-point-like adjacency across the transit area. A virtual link can only be configured while in the context of area 0.0.0.0. The transit area cannot be a stub area or an NSSA.

The router-id parameter specified in the virtual-link command must be associated with the virtual neighbor; that is, the router ID of the far-end router must be specified, not the local router ID.

Use the following CLI syntax to configure a virtual link:

CLI Syntax:
ospf
area area-id
virtual-link router-id transit-area area-id
auth-keychain name
authentication-key {authentication-key | hash-key} [hash | hash2]
authentication-type [password | message-digest]
dead-interval seconds
hello-interval seconds
message-digest-key key-id md5 [key | hash-key] [hash | hash2]
retransmit-interval seconds
transit-delay
no shutdown

The following displays a virtual link configuration example:

A:ALU-49>config>router>ospf# info
----------------------------------------------
...
            area 0.0.0.0
                virtual-link 1.2.3.4 transit-area 1.2.3.4
                    hello-interval 9
                    dead-interval 40
                exit
            exit
            area 0.0.0.20
                stub
                exit
            exit
            area 0.0.0.25
                nssa
                exit
            exit
            area 1.2.3.4
            exit

4.11.4. Configuring Authentication

Authentication must be explicitly configured and can be done using two separate mechanisms:

  1. configuration of an explicit authentication key and algorithm using the authentication-key and authentication-type commands at the interface level or the virtual link level
  2. configuration of an authentication keychain using the auth-keychain command in the config>system>security>keychain context and associating the keychain with the interface or virtual link

Either the authentication-key command or the auth-keychain command can be used by OSPF, but both cannot be supported at the same time. If both commands are configured, the auth-keychain configuration will be applied and the authentication-key command will be ignored.

Use the following CLI syntax to configure authentication:

CLI Syntax:
ospf
area area-id
interface ip-int-name
authentication-key {authentication-key | hash-key} [hash | hash2]
authentication-type [password | message-digest]
message-digest-key key-id md5 [key | hash-key] [hash | hash2]
virtual-link router-id transit-area area-id
authentication-key {authentication-key | hash-key} [hash|hash2]
authentication-type [password | message-digest]
message-digest-key key-id md5 [key | hash-key] [hash | hash2]

The following displays authentication configuration examples:

A:ALU-49>config>router>ospf# info
----------------------------------------------
...
            
            area 0.0.0.40
                interface "test1"
                    authentication-type password
                    authentication-key "3WErEDozxyQ" hash
                exit
            exit
            area 1.2.3.4
            exit
----------------------------------------------
A:ALU-49>config>router>ospf#
 
A:ALU-49>config>router>ospf# info
----------------------------------------------
...
            
            area 0.0.0.0
                virtual-link 10.0.0.1 transit-area 0.0.0.1
                    authentication-type message-digest
                    message-digest-key 2 md5 "Mi6BQAFi3MI" hash
                exit
                virtual-link 1.2.3.4 transit-area 1.2.3.4
                    hello-interval 9
                    dead-interval 40
                exit
                interface "system"
                exit
            exit
----------------------------------------------
A:ALU-49>config>router>ospf#

Use the following CLI syntax to associate an interface or virtual link with an authentication keychain. The keychain must already be defined in the system>security>keychain context.

CLI Syntax:
ospf
area area-id
interface ip-int-name
auth-keychain name
virtual-link router-id transit-area area-id
auth-keychain name

4.11.5. Assigning a Designated Router

The designated router is responsible for flooding network link advertisements on a broadcast network to describe the routers attached to the network. A router uses Hello packets to advertise its priority. The router with the highest-priority interface becomes the designated router. If routers have the same priority, the designated router is elected based on the highest router ID. A router with priority 0 is not eligible to be a designated router or a backup designated router. At least one router on each logical IP network or subnet must be eligible to be the designated router. By default, routers have a priority value of 1.

When a router starts up, it checks for a current designated router. If a designated router is present, the router accepts that designated router, regardless of its own priority designation. If the designated and backup designated routers fail, new designated and backup routers are elected according to their priority numbers or router IDs (in case of a priority tie).

Designated routers are used only in multi-access (broadcast) networks.

Use the following CLI syntax to configure the designated router:

CLI Syntax:
ospf
area area-id
interface ip-int-name
priority number

The following displays a priority designation example:

A:ALU-49>config>router>ospf# info
----------------------------------------------
...
            
            area 0.0.0.25
                nssa
                exit
                interface "if2"
                    priority 100
                exit
            exit
----------------------------------------------
A:ALU-49>config>router>ospf#

4.11.6. Configuring Route Summaries

ABRs send summary advertisements (type 3 LSAs) into a stub area or NSSA to describe the routes to other areas. This command is particularly useful in order to reduce the size of the link-state database within the stub or NSSA.

By default, summary route advertisements are sent into the stub area or NSSA. The no form of the summaries command disables sending summary route advertisements and, in stub areas, the default route is advertised by the area border router.

Use the following CLI syntax to configure a route summary:

CLI Syntax:
ospf
area area-id
stub
summaries
nssa
summaries

The following displays a stub route summary configuration example:

A:ALU-49>config>router>ospf# info
----------------------------------------------
...
            area 0.0.0.20
                stub
                    summaries
                exit
                interface "to-103"
                exit
            exit
----------------------------------------------
A:ALU-49>config>router>ospf# 
 

4.11.7. Configuring Route Preferences

A router can learn routes from different protocols and distribute them into OSPF, in which case, the costs are not comparable. When this occurs, the preference value is used to decide which route is installed in the forwarding table and used as the path to the destination. The route with the lowest preference value is selected.

The 7705 SAR supports the redistribution of static routes and routes from directly attached and aggregated networks into OSPF.

Different protocols should not be configured with the same preference. If this occurs, the tiebreaker is based on the default preferences as defined in Table 31.

If multiple routes are learned with an identical preference using the same protocol, the lowest-cost route is used. If multiple routes are learned with an identical preference using the same protocol and the costs (metrics) are equal, the decision of what route to use is determined by the configuration of ECMP in the config>router context. Refer to the 7705 SAR Router Configuration Guide for information on ECMP.

Table 31:  Route Preference Defaults by Route Type 

Route Type

Preference

Configurable

Direct attached

0

No

Static routes

5

Yes

OSPF internal

10

Yes

IS-IS level 1 internal

15

Yes

IS-IS level 2 internal

18

Yes

OSPF external

150

Yes

IS-IS level 1 external

160

Yes

IS-IS level 2 external

165

Yes

Note:

To configure a preference for static routes, use the config>router>static-route command. Refer to the 7705 SAR Router Configuration Guide, “IP Router Command Reference”, for information.

Use the following CLI syntax to configure a route preference for OSPF internal and external routes:

CLI Syntax:
ospf
preference preference
external-preference preference

The following displays a route preference configuration example:

A:ALU-49>config>router>ospf# info
----------------------------------------------
            asbr
            overload
            overload-on-boot timeout 60
            traffic-engineering
            preference 9
            external-preference 140
            exit
----------------------------------------------
A:ALU-49>config>router>ospf#

4.12. OSPF Configuration Management Tasks

This section discusses the following OSPF configuration management tasks:

4.12.1. Modifying a Router ID

Because the router ID is defined in the config>router context, not in the OSPF configuration context, the protocol instance is not aware of changes to the ID value. Changing the router ID on a device could cause configuration inconsistencies if associated values are not also modified.

After you have changed a router ID, manually shut down and restart the protocol using the shutdown and no shutdown commands in order for the changes to be incorporated.

Use the following CLI syntax to change a router ID number:

CLI Syntax:
config>router# router-id ip-address

The following displays an NSSA router ID modification example:

A:ALU-49>config>router# info
------------------------------------------
IP Configuration
------------------------------------------
        interface "system"
            address 10.10.10.104/32
        exit
        interface "to-103"
            address 10.0.0.103/24
            port 1/1/1
        exit
        router-id 10.10.10.104
------------------------------------------
A:ALU-49>config>router#

4.12.2. Deleting a Router ID

You can modify a router ID, but you cannot delete the parameter. If the no router router-id command is issued, the router ID reverts to the default value, the system interface address (which is also the loopback address). If a system interface address is not configured, the last 4 bytes of the chassis MAC address are used as the router ID.

4.12.3. Modifying OSPF Parameters

You can change or remove existing OSPF parameters in the CLI. The changes are applied immediately.

The following example displays an OSPF modification in which an interface is removed and another interface added.

Example:
config>router# ospf
config>router>ospf# area 0.0.0.20
config>router>ospf>area# no interface "to-103"
config>router>ospf>area# interface "to-HQ"
config>router>ospf>area>if$ priority 50
config>router>ospf>area>if# exit
config>router>ospf>area# exit

The following example displays the OSPF configuration with the modifications entered in the previous example:

A:ALU-49>config>router>ospf# info
----------------------------------------------
            asbr
            external-preference 140
            export "OSPF-Export"
            overload
            overload-on-boot timeout 60
            preference 9
            traffic-engineering
            exit
            area 0.0.0.0
                virtual-link 10.0.0.1 transit-area 0.0.0.1
                    authentication-type message-digest
                    message-digest-key 2 md5 "Mi6BQAFi3MI" hash
                exit
                virtual-link 1.2.3.4 transit-area 1.2.3.4
                    hello-interval 9
                    dead-interval 40
                exit
                interface "system"
                exit
            exit
            area 0.0.0.1
            exit
            area 0.0.0.20
                stub
                exit
                interface "to-HQ"
                    priority 50
                exit
            exit
----------------------------------------------
A:ALU-49>config>router>ospf#