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.
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
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.
|
- |
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,
|
- |
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.
|
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. |
- |
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.
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:
Injecting an IBGP route into the OSPF routing table may cause a routing loop. Exercise caution when you perform this step.
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:
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.