peer preferred-value

Use peer preferred-value to set a preferred value for routes received from a peer or peer group.

Use undo peer preferred-value to remove the configuration.

Syntax

In BGP IPv4 unicast address family view/BGP-VPN IPv4 unicast address family view/BGP IPv4 multicast address family view:

peer { group-name | ipv4-address [ mask-length ] } preferred-value value

undo peer { group-name | ipv4-address [ mask-length ] } preferred-value

In BGP IPv6 unicast address family view:

peer { group-name | ipv6-address [ prefix-length ] } preferred-value value

undo peer { group-name | ipv6-address [ prefix-length ] } preferred-value

In BGP-VPN IPv6 unicast address family view/BGP IPv6 multicast address family view:

peer { group-name | ipv6-address [ prefix-length ] } preferred-value value

undo peer { group-name | ipv6-address [ prefix-length ] } preferred-value

Default

The preferred value is 0 for routes received from a peer or peer group.

Views

BGP IPv4 unicast address family view

BGP-VPN IPv4 unicast address family view

BGP IPv6 unicast address family view

BGP-VPN IPv6 unicast address family view

BGP IPv4 multicast address family view

BGP IPv6 multicast address family view

Predefined user roles

network-admin

Parameters

group-name: Specifies a peer group by its name, a case-sensitive string of 1 to 47 characters. The peer group must have been created.

ipv4-address: Specifies a peer by its IPv4 address. The peer must have been created.

mask-length: Specifies a mask length in the range of 0 to 32. You can use the ipv4-address and mask-length arguments together to specify a subnet. If you specify a subnet, this command specifies a preferred value for routes received from all dynamic peers in the subnet.

ipv6-address: Specifies a peer by its IPv6 address. The peer must have been created.

prefix-length: Specifies a prefix length in the range of 0 to 128. You can use the ipv6-address and prefix-length arguments together to specify a subnet. If you specify a subnet, this command specifies a preferred value for routes received from all dynamic peers in the subnet.

value: Specifies a preferred value in the range of 0 to 65535.

Usage guidelines

If multiple routes that have the same destination are learned from different peers, you can specify different preferred values for the routes as needed to control BGP path selection. The one with the greatest preferred value is selected as the optimal route to the destination.

The preferred value is used for route selection on the local router and is not advertised to the peer. It has only local significance.

You can also use the apply preferred-value command in a routing policy to configure the preferred value for BGP routes. If both the peer preferred-value and apply preferred-value commands are configured, the apply preferred-value command applies. If the preferred value is not set in the routing policy or no routing policy is configured, the peer preferred-value command applies.

Examples

# In BGP IPv4 unicast address family view, set the preferred value to 50 for routes from peer 1.1.1.1.

<Sysname> system-view
[Sysname] bgp 100
[Sysname-bgp-default] address-family ipv4 unicast
[Sysname-bgp-default-ipv4] peer 1.1.1.1 preferred-value 50

Related commands

apply preferred-value

route-policy