5000 Series Layer 2/3 Managed Data Center Switch CLI Reference Guide
1040
11-26 distance (BGP Router Config)
Use this command to set the preference (also known as administrative distance) of BGP routes to specific
destinations. You may enter up to 128 instances ofthis command. Two instances ofthis command may
not have the same prefix and wildcard mask. If a distance command is configured that matches an
existing distance Command’s prefix and wildcard mask, the new command replaces the existing
command. There can be overlap between the prefix and mask configured for different commands. When
there is overlap, the command whose prefix and wildcard mask are the longest match for a neighbor
address is applied to routes from that neighbor.
An ECMP route‘s distance is determined by applying distance commands to the neighbor that provided
the best path.
The distance command is not applied to existing routes. To apply configuration changes to the distance
command itself or the prefix list to which a distance command applies, you must force a hard reset of
affected neighbors.
Use the
no
command to set the preference of BGP routes to the default.
distance distance [prefix wildcard-mask [prefix-list]]
no distance distance [prefix wildcard-mask [prefix-list]]
Parameters
distance
The preference value for matching routes. The range is 1 to 255.
prefix wildcard-mask
(Optional) Routes learned from BGP peers whose address falls within
this prefix are assigned the configured distance value.The wildcard-
mask is an inverted network mask whose 1 bits indicate the don’t care
portion of the prefix.
prefix-list
(Optional) A prefix list can optionally be specified to limit the distance
value to a specific set of destination prefixes learned from matching
neighbors.
Default
The default is as follows: BGP assigns preference values according to the
distance bgp
command,
unless overridden for specific neighbors or prefixes.
Command Mode
BGP Router Config
Example
The following shows examples of the command.
To set the preference value of the BGP route to 100.0.0.0/8 from neighbor 10.1.1.1, use the following
distance command.
(Routing)(Config)#ip prefix-list pfx-listl permit 100.0.0.0/8
(Routing)(Config)#router bgp 1
(Routing)(Config-router)#distance 25 10.1.1.1 0.0.0.0 pfx-list1