< Home

default-route-advertise (OSPF)

Function

The default-route-advertise command advertises default routes in a common OSPF area.

The undo default-route-advertise command disables advertisement of default routes in a common OSPF area.

By default, OSPF devices in a common OSPF area do not advertise default routes.

Format

default-route-advertise [ [ always | permit-calculate-other ] | cost cost | type type | route-policy route-policy-name [ match-any ] ] *

default-route-advertise summary cost cost

undo default-route-advertise

Parameters

Parameter Description Value

always

Enables the device to generate and advertise an LSA that describes a default route, regardless of whether the local device has active default routes learned from a non-local OSPF process.

-

permit-calculate-other

Enables the device to generate and advertise an ASE LSA that describes a default route only when the local device has active default routes learned from a non-local OSPF process. In this case, the device still calculates default routes from other devices.

NOTE:

If neither always nor permit-calculate-other is configured,

  • If the local device has active default routes learned from a non-local OSPF process, the device no longer calculates the default routes from other devices.
  • If the local device does not have active default routes learned from a non-local OSPF process, the device still calculates the default routes from other devices.

-

cost cost

Specifies the cost of the external routes.

  • The cost of a Type 1 external route equals the cost of the route from the FW to the related ASBR plus the cost of the route from the ASBR to the destination.

  • The cost of a Type 2 external route equals the cost of the route from the ASBR to the destination.

The value is an integer ranging from 0 to 16777214. The default value is 1.

type type

Specifies the type of the external routes.

The value is an integer ranging from 1 to 2.

  • 1: Type 1 external route
  • 2: Type 2 external route

By default, it is 2.

route-policy route-policy-name

Specifies the name of a routing policy, according to whose parameters the device advertises default routes when there are matched default OSPF routes generated by a non-local OSPF process.

The value must be the name of an existing routing policy.

summary

Advertises the Type-3 summary LSA of the specified default route. Before specifying this parameter, ensure that VPN is enabled. Otherwise, routes cannot be advertised.

-

match-any

Indicates that a device matches the routing entry in the routing table by using a routing policy and then advertises the default route based on the parameters set through the routing policy.

-

Views

OSPF view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The import-route (OSPF) command cannot be used to import a default route from another AS. To advertise a non-OSPF default route in a common OSPF area, run the default-route-advertise command on an ASBR.

If the ASBR has a default route, the default-route-advertise command enables the ASBR to advertise the default route 0.0.0.0 to the OSPF area.

If the ASBR has no default route, the default-route-advertise always command or the default-route-advertise command can be used:

  • With always configured: The ASBR can advertise the default route 0.0.0.0 even if there is no default route. This allows the default route to retain in the routing table and prevents the ASBR from using a default route sent by another device.

  • Without always configured: The ASBR generates an LSA that describes a default route only when the local routing table contains an active default route learned from a non-local OSPF (excluding BGP) process.

    If the local routing table contains an active default BGP route, the default route can be injected to the OSPF routing table based on the following situations:
    • Whether the ospf process-id vpn-instance vpn-instance-name command is run together with the vpn-instance-capability simple command:
      • If the two commands are executed together, to inject an active default EBGP route into the OSPF routing table, run the default-route-advertise command. To inject an active default IBGP route to the OSPF routing table, run the import-route bgp permit-ibgp command before you run the default-route-advertise command.
      • If only the ospf process-id vpn-instance vpn-instance-name command is run, to inject an active default EBGP or IBGP route into the OSPF routing table, run the default-route-advertise command.
    • If the ospf process-id vpn-instance vpn-instance-name command is not run, to inject an active default EBGP route into the OSPF routing table, run the default-route-advertise command. To inject an active default IBGP route to the OSPF routing table, run the import-route bgp permit-ibgp command before you run the default-route-advertise command.

    Injecting an IBGP route into the OSPF routing table may cause a routing loop. Exercise caution when you perform this step.

If a routing policy is configured with match-any, and multiple routes match the policy, a default LSA will be generated based on the optimal route. The principles for select an optimal route are as follows:
  1. A route configured with type takes precedence over that not configured with type, and a route configured with a smaller type value takes precedence over that configured with a larger cost-type value.
  2. A route configured with cost takes precedence over that not configured with cost, and a route configured with a smaller cost value takes precedence over that configured with a larger cost value.
  3. A route configured with tag takes precedence over that not configured with tag, and a route configured with a smaller tag value takes precedence over that configured with a larger tag value.

Prerequisites

Before advertising a default route, OSPF compares the priorities of default routes in an OSPF area and then advertises a default route with the highest priority. If a static default route is configured on an OSPF device, check that the priority of the static default route is lower than that of the default route to be advertised by OSPF. This ensures that the default route advertised by OSPF will be added to the routing table of the OSPF device.

Configuration Impact

After the default-route-advertise command is configured on the ASBR, the ASBR will generate a Type-5 ASE LSA with a link state ID of 0.0.0.0 and mask of 0.0.0.0. In addition, it will advertise the ASE LSA in an entire OSPF area.

If a routing policy is configured, default routes are advertised based on the following principles:

  • If a default route matches the routing policy, a default route is generated on an OSPF device based on the parameters configured in the routing policy. Parameters, such as cost, tag, and type, can be configured in the routing policy.
  • If the default route does not match the routing policy, and always is configured, the default route is still advertised.
    • If always is not configured, the OSPF device will not advertise the default route.
    • If always is configured, OSPF devices will advertise the default route. In addition, only always configured in the default-route-advertise command takes effect on advertisement of default routes.

Precautions

In different OSPF areas, OSPF advertises default routes using different modes. This default-route-advertise command can be used to advertise default routes in a common OSPF area. In the STUB, Totally STUB, or Totally NSSA area, default routes are advertised automatically. In an NSSA area, the nssa default-route-advertise command is used to advertise default routes.

Creating a route-policy before it is referenced is recommended. By default, nonexistent route-policies cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent route-policy is referenced using the current command, the device advertises the default route as long as a default route that is not generated by the current IS-IS process exists in the local routing table.

Example

# Advertise the ASE LSA of the default route in the OSPF area on the local router that does not have the default route.

<sysname> system-view
[sysname] ospf 1
[sysname-ospf-1] default-route-advertise always
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >