< Home

default-route-advertise (OSPF)

Function

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

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

By default, OSPF devices in a common OSPF area do not generate 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

Generates and advertises an LSA that describes the default route, regardless of whether there are active default routes of other OSPF processes in the routing table of the host.

  • If always is configured, the switch does not calculate the default routes from other switches.
  • If always is not configured, an LSA for advertising a default route can be generated only when there are active default routes of other OSPF processes in the routing table of the local device.

-

permit-calculate-other

Generates and advertises an ASE LSA that describes the default route only when there are active default routes of other OSPF processes in the routing table of the local device. The device still calculates the default routes from other devices.

NOTE:

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

  • When there are active default routes of other OSPF processes in the routing table of the local device, the device does not calculate the default routes from other devices.
  • When there are no active default routes of other OSPF processes in the routing table of the local device, the device still calculates the default routes from other devices.

-

cost cost

Specifies the cost of the ASE LSA.

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

type type

Specifies the type of the external routes.

The value is 1 or 2. The default value is 2.
  • 1: Type 1 external route
  • 2: Type 2 external route

route-policy route-policy-name

Specifies the name of a routing policy. The device advertises default routes according to the parameters of the configured routing policy when there are matched default routes of other OSPF processes in the routing table of the device.

The name is a string of 1 to 40 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.

summary

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

-

match-any

Indicates that a device matches the routing entry in the routing table against a routing policy and then advertises the default route according to 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. Running the default-route-advertise command on an ASBR can advertise a non-OSPF default route in a common OSPF area.

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 remain 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. It describes a default route only when the local routing table contains an activated non-OSPF default route (except BGP route).

    If the local routing table contains an activated 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 activated default EBGP route into the OSPF routing table, run the default-route-advertise command. To inject an activated 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 activated 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 activated default EBGP route into the OSPF routing table, run the default-route-advertise command. To inject an activated 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 optimal route selection are as follows:
  1. A route configured with type takes precedence over that not configured with type. A route configured with a smaller type value takes precedence over that configured with a larger type value.
  2. A route configured with cost takes precedence over that not configured with cost. 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. 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 the priority of the static default route. The priority must be 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 to a common OSPF area. In a stub, totally stub, or totally NSSA area, default routes are advertised automatically. In an NSSA, 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 OSPF process exists in the local routing table.

If the default-route-advertise command is used in multiple OSPF processes to generate default routes, routing loops tend to occur. To prevent this issue, you are advised to configure route-policies to filter routes so that default routes will not be learned from these OSPF processes.

Example

# Configure an ASBR to advertise the ASE LSA of the default route to common OSPF areas when it has no default route.

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