bgp distance

This command specifies the route selection priority given to internal or external BGP routes compared to other protocols for this router.

Syntax

bgp distance {internal | external} distance
no bgp distance {internal | external}

Parameters

internal distance Specify a distance for routes internal to the AS. Valid values are 1 - 255. Default value is 200.
external distance Specify a distance for routes external to the AS. Valid values are 1 - 255. Default value is 20.

Defaults

None.

Mode

BGP Router Configuration or BGP address family configuration mode.

Usage

The distance command specifies how active routes that are learned from BGP will be selected, compared to other protocols. When a route has been learned from more than one protocol, the active route will be selected from the protocol with the lowest distance (or preference).

The no bgp distance command resets the specified BGP protocol type to the default value. Internal BGP distance defaults to 200. External BGP distance defaults to 20.

Examples

The following example configures the distance (preference) for routes internal to the AS to be 113.

System(su-config)->router bgp 65151
System(su-config-bgp)->bgp router-id 1.2.3.4
System(su-config-bgp)->bgp distance internal 113

The following example resets the distance (preference) distance for routes internal to the AS to the default value of 200.

System(su-config)->router bgp 65151
System(su-config-bgp)->no bgp distance internal