distance (OSPF)

Use this command to configure the administrative distance for OSPFv3 routes.

Syntax

distance [ospf {external | intra-area}] weight
no distance [ospf {external | intra-area}]

Parameters

ospf external | intra-area (Optional) Applies the specified distance value to external (type 5 and type 7) or to intra-area routes.

The value for intra-area distance must be less than or equal to the value for external distance.

weight Specifies an administrative distance for OSPF routes. Valid values are 1-255. Default: 110.

Defaults

If route type is not specified using the ospf option, the distance value specified will be applied to all OSPF routes.

Mode

OSPFv3 router configuration.

Usage

If several routes (coming from different protocols) are presented to the Route Table Manager (RTM), the protocol with the lowest administrative distance will be chosen for route installation. The distance for inter-area routes is fixed at 110. By default, OSPF administrative distance is set to 110 for all OSPF routes. The distance command can be used to change this value, resetting OSPF‘s route preference in relation to other routes as shown in the table below.

Route Source Default Distance
Connected 0
Static 1
BGP (S-, 7100-Series) 20 - Routes external to the AS

200 - Routes internal to the AS

OSPF 110
RIP 120
Unknown (The router will not use the route) 255

The distance command applies the value to the specified route type.

The “no” form of this command resets OSPF administrative distance to the default value of 110.

Example

This example shows how to change the default administrative distance for external OSPF routes to 100:

System(rw-config)->ipv6 router ospf 1
System(rw-config-ospfv3)->distance ospf external 100