preference
Use preference to configure preferences for BGP routes.
Use undo preference to restore the default.
Syntax
preference { external-preference internal-preference local-preference | route-policy route-policy-name }
undo preference
Default
The preferences of external, internal, and local BGP routes are 255, 255, and 130, respectively.
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
external-preference: Specifies a preference for EBGP routes, in the range of 1 to 255.
internal-preference: Specifies a preference for IBGP routes, in the range of 1 to 255.
local-preference: Specifies a preference for local routes, in the range of 1 to 255.
route-policy route-policy-name: Specifies a routing policy by its name, a case-sensitive string of 1 to 63 characters, to set the route preference for matching routes. Routes not matching the routing policy use the default preference.
Usage guidelines
Different routing protocols might find different routes to the same destination. However, not all of those routes are optimal. For route selection, routing protocols, direct routes, and static routes are assigned different preferences. The route with the highest preference is preferred.
Configuring the preferences for BGP routes changes the possibility for the routes to become the optimal route.
To use a routing policy to set the preference, you must configure the preference with the apply preference command in the routing policy in advance. Otherwise, all matching routes use the default preference.
Examples
# In BGP IPv4 unicast address family view, set preferences for EBGP, IBGP, and local routes to 20, 20, and 200, respectively.
<Sysname> system-view [Sysname] bgp 100 [Sysname-bgp-default] address-family ipv4 unicast [Sysname-bgp-default-ipv4] preference 20 20 200