Tutorial: Setting preferences for prefixes

"Preference" is an optional BGP attribute used to set preferred paths to certain prefixes. The device prefers a path with a higher preference over a path with a lower preference.

Within an AS, the iBGP neighbors exchange the BGP attribute LOCAL_PREFERENCE. The eBGP neighbors in neighboring ASs do not transmit this attribute.

There are two ways to configure preferences:
  • By address family
  • By policy

This example explains how to configure the prioritization of the prefix from a BGP neighbor with the preference "200" over the prefix from another BGP neighbor with the preference "100".

Note: The default setting for preferences is "100". In this case all you have to do is configure the neighbor that requires preferential treatment with the preference "200".
  1. Navigate to Routing protocols > BGP > BGP policy > Basic and add a new entry to the manipulation of basic attributes of the NLRI (in this case the basic attribute LOCAL_PREFERENCE).




    Give the entry a descriptive name.

    Under Set local preference enter the value "200" for the new local preference.

  2. Under Routing protocols > BGP > Actions add a new action.




    Give the action a descriptive name.

    Under Basic you select the basic entry you created previously.

  3. Add a new filter under Routing protocols > BGP > BGP policy > Filters.




    Give the filter a descriptive name.

    Under Address family you select the protocol used for connections to the BGP neighbors. With the setting "Permit" in the field Policy you specify that the device should modify the outbound NLRI. Under Action you select the action you created previously.

  4. Under Routing protocols > BGP > Neighbors you add a new entry for a BGP neighbor.




    Give the neighbor a descriptive name and configure its IP address along with the number of the remote AS where it is located.

    If you have not created a dedicated neighbor profile for this BGP neighbor, use the "Default" profile.

    Under Inbound policy you select the filter you created previously.

  5. To check the configuration, open a terminal connection to the device.

    The command show bgp-policy Filter_1 displays the current setting for the policy "Filter_1".

    > show bgp-policy Filter_1
    Traverse chain "Filter_1"
       Inspect filter of priority 0
          Match IPv4 routes
          Execute action "Action_1"
             No AS-path override configured
             Apply basic override "LOCAL_PREF"
                Set local preference to 200
             No community override configured
          Permit route
    > _

    The command show bgp-v4-adj-rib-in displays the routing information base (RIB).

    > show bgp-v4-adj-rib-in
    IPv4 Unicast Adj-RIB-In
    
     192.168.1.177, Rtg-Tag 0
     
      Prefix            Next Hop       Local-Pref  Weight  MED AS Path      
      ----------------------------------------------------------------
      192.168.210.0/24  192.168.1.177         200       0    0 AS sequence: 200  
      192.168.211.0/24  192.168.1.177         200       0    0 AS sequence: 200  
                
    > _

www.lancom-systems.com

LANCOM Systems GmbH | A Rohde & Schwarz Company | Adenauerstr. 20/B2 | 52146 Wuerselen | Germany | E‑Mail info@lancom.de

LANCOM Logo