< Home

Local_Pref

The Local_Pref attribute is used to determine the optimal route when traffic leaves an AS. The Local_Pref attribute is available only to IBGP peers and is not advertised to other ASs.

Table 1 lists two methods to modify the Local_Pref value.

Table 1 Methods to modify the Local_Pref value

Method

Usage Scenario

Run the default local-preference command.

This method sets a default Local_Pref for the routes that the local device advertises to IBGP peers.

Configure an import or export policy and run the apply local-preference command to configure an apply clause for the policy.

This method sets different Local_Pref values for different routes that the local device advertises to IBGP peers.

NOTE:

If both the methods are used, the method with the import policy takes effect if routes match the conditions specified in the apply local-preference command and the policy.

The following example shows how the Local_Pref value is used during route selection. In Figure 1, both ISP1 and ISP2 advertise the routes 10.11.0.0/16 and 10.22.0.0/16 to AS 65001.

Figure 1 Local_Pref application networking

Scenario 1: When no Local_Pref value is configured on Switch A and Switch B, check the BGP routing tables of Switch A and Switch B.

[HUAWEIA] display bgp routing-table
 BGP Local router ID is 192.168.2.3
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 6
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.1.1.0/30        0.0.0.0         0                     0      i
 *>i  10.1.2.0/30        10.1.3.2        0          100        0      i
 *>   10.11.0.0/16       10.1.1.1                              0      100 10i
 * i                     10.1.2.1                   100        0      200 10i
 *>   10.22.0.0/16       10.1.1.1                              0      100 10i
 * i                     10.1.2.1                   100        0      200 10i

The BGP routing table of Switch A shows that Switch A receives the routes 10.11.0.0/16 and 10.22.0.0/16 from ISP1 and Switch B. Check the information about the route 10.11.0.0/16 on Switch A.

[HUAWEIA] display bgp routing-table 10.11.0.0
 BGP local router ID : 192.168.2.3
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.1.1 (192.168.2.5)
 Route Duration: 04h41m03s
 Direct Out-interface: GigabitEthernet1/0/1
 Original nexthop: 10.1.1.1
 Qos information : 0x0
 AS-path 100 10, origin igp, pref-val 0, valid, external, best, select, active, pre 255
 Advertised to such 2 peers:
    10.1.3.2
    10.1.4.2

 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.3.2 (192.168.2.2)
 Route Duration: 01h42m40s
 Relay IP Nexthop: 10.1.3.2
 Relay IP Out-Interface: GigabitEthernet1/0/3
 Original nexthop: 10.1.2.1
 Qos information : 0x0
 AS-path 200 10, origin igp, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for peer type
 Not advertised to any peer yet

The preceding command output shows that the route learned from ISP1 is selected as the optimal route because it is an EBGP route and the route learned from Switch B is an IBGP route. Table 2 shows the route attribute comparison of the routes 10.11.0.0/16 learned from ISP1 and Switch B.

Table 2 Route attribute comparison of the routes 10.11.0.0/16 learned from ISP1 and Switch B

Route Attribute

Route Learned from ISP1

Route Learned from Switch B

Comparison

PrefVal

0

0

The same.

Local_Pref

-

100

The same.

NOTE:

If a route does not carry Local_Pref, the default value 100 takes effect.

Route type

Learned from a peer

Learned from a peer

The same.

AIGP

-

-

The same.

AS_Path

100 10

200 10

The same length.

Origin

IGP

IGP

The same.

MED

-

-

The same.

Peer type

EBGP

IBGP

Route 10.11.0.0/16 learned from ISP1 is optimal.

The route selection process on Switch B is the same as that on Switch A. Then, Switch A and Switch B advertise the optimal routes to Switch C. Check the routing table of Switch C.

[HUAWEIC] display bgp routing-table
 Total Number of Routes: 6

 BGP Local router ID is 192.168.2.1
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.1.0/30        10.1.4.1        0          100        0      i
 *>i  10.1.2.0/30        10.1.5.1        0          100        0      i
 *>i  10.11.0.0/16       10.1.2.1                   100        0      200 10i
 * i                     10.1.1.1                   100        0      100 10i
 *>i  10.22.0.0/16       10.1.2.1                   100        0      200 10i
 * i                     10.1.1.1                   100        0      100 10i

The preceding command output shows that Switch C selects the routes advertised by Switch B.

Check the reason why the routes learned from Switch A are not selected on Switch C. The route 10.11.0.0/16 is used as an example.

[HUAWEIC] display bgp routing-table 10.11.0.0
 BGP local router ID : 192.168.2.1
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.5.1 (192.168.2.2)
 Route Duration: 00h12m46s
 Relay IP Nexthop: 10.1.5.1
 Relay IP Out-Interface: GigabitEthernet1/0/1
 Original nexthop: 10.1.2.1
 Qos information : 0x0
 AS-path 200 10, origin igp, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255
 Not advertised to any peer yet

 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.4.1 (192.168.2.3)
 Route Duration: 00h17m30s
 Relay IP Nexthop: 10.1.4.1
 Relay IP Out-Interface: GigabitEthernet1/0/0
 Original nexthop: 10.1.1.1
 Qos information : 0x0
 AS-path 100 10, origin igp, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for router ID
 Not advertised to any peer yet

The preceding command output shows that Switch C selects the route 10.11.0.0/16 learned from Switch B because the router ID (192.168.2.2) of Switch B is smaller than that (192.168.2.3) of Switch A. Table 3 shows the route attribute comparison of the routes 10.11.0.0/16 learned from Switch A and Switch B.

Table 3 Route attribute comparison of the routes 10.11.0.0/16 learned from Switch A and Switch B

Route Attribute

Route Learned from Switch A

Route Learned from Switch B

Comparison

PrefVal

0

0

The same.

Local_Pref

100

100

The same.

Route type

Learned from a peer

Learned from a peer

The same.

AIGP

-

-

The same.

AS_Path

100 10

200 10

The same length.

Origin

IGP

IGP

The same.

MED

-

-

The same.

Peer type

IBGP

IBGP

The same.

IGP cost

-

-

The same.

Cluster_List

-

-

The same length.

Router ID

192.168.2.3

192.168.2.2

Route 10.11.0.0/16 learned from Switch B is optimal.

Scenario 2: The administrator of AS 65001 requires that ISP1 be active and ISP2 be backup for the traffic to 10.11.0.0/16 and 10.22.0.0/16.

To meet the preceding requirements, run the default local-preference command on Switch A to increase the Local_Pref values of the routes learned from Switch A. This configuration ensures that the routes learned from ISP1 are selected as the optimal routes. Detailed configurations are as follows:

#
bgp 65001
 #
 ipv4-family unicast
  default local-preference 120                 //Set the Local_Pref of the routes to be advertised to 120.
#

Run the display bgp routing-table [ ip-address ] command to check the configurations.

# Display the routing table of Switch A.

[HUAWEIA] display bgp routing-table
 BGP Local router ID is 192.168.2.3
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.1.1.0/30        0.0.0.0         0                     0      i
 *>i  10.1.2.0/30        10.1.3.2        0          100        0      i
 *>   10.11.0.0/16       10.1.1.1                              0      100 10i
 *>   10.22.0.0/16       10.1.1.1                              0      100 10i

The preceding command output shows that Switch A selects the routes learned from ISP1.

# Display the routing table of Switch B.

[HUAWEIB] display bgp routing-table
 BGP Local router ID is 192.168.2.2
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 6
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.1.0/30        10.1.3.1        0          120        0      i
 *>   10.1.2.0/30        0.0.0.0         0                     0      i
 *>i  10.11.0.0/16       10.1.1.1                   120        0      100 10i
 *                       10.1.2.1                              0      200 10i
 *>i  10.22.0.0/16       10.1.1.1                   120        0      100 10i
 *                       10.1.2.1                              0      200 10i

The preceding command output shows that Switch B selects the routes learned from Switch A. Switch B does not advertise the routes learned from ISP2 to its IBGP peers because those routes are not selected.

# Display detailed information about the route 10.11.0.0/16 or 10.22.0.0/16 on Switch B. The route 10.11.0.0/16 is used as an example.

[HUAWEIB] display bgp routing-table 10.11.0.0
 BGP local router ID : 192.168.2.2
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.3.1 (192.168.2.3)
 Route Duration: 00h22m16s
 Relay IP Nexthop: 10.1.3.1
 Relay IP Out-Interface: GigabitEthernet1/0/4
 Original nexthop: 10.1.1.1
 Qos information : 0x0
 AS-path 100 10, origin igp, localpref 120, pref-val 0, valid, internal, best, select, active, pre 255
 Advertised to such 1 peers:
    10.1.2.1

 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.2.1 (192.168.2.4)
 Route Duration: 00h22m23s
 Direct Out-interface: GigabitEthernet1/0/0
 Original nexthop: 10.1.2.1
 Qos information : 0x0
 AS-path 200 10, origin igp, pref-val 0, valid, external, pre 255, not preferred for Local_Pref
 Not advertised to any peer yet  

The preceding command output shows that the Local_Pref value of the route learned from Switch A is greater than that of the route learned from ISP2 and that the route learned from Switch A is selected as the optimal route. Table 4 shows the route attribute comparison of the routes 10.11.0.0/16 learned from Switch A and ISP2.

Table 4 Route attribute comparison of the routes 10.11.0.0/16 learned from Switch A and ISP2

Route Attribute

Route Learned from Switch A

Route Learned from ISP2

Comparison

PrefVal

0

0

The same.

Local_Pref

120

-

Route 10.11.0.0/16 learned from Switch A is optimal.

NOTE:

If a route does not carry Local_Pref, the default value 100 takes effect.

# Display the routing table of Switch C.

[HUAWEIC] display bgp routing-table
 Total Number of Routes: 4

 BGP Local router ID is 192.168.2.1
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.1.0/30        10.1.4.1        0          120        0      i
 *>i  10.1.2.0/30        10.1.5.1        0          100        0      i
 *>i  10.11.0.0/16       10.1.1.1                   120        0      100 10i
 *>i  10.22.0.0/16       10.1.1.1                   120        0      100 10i

Switch C selects the routes advertised by ISP1 because Switch B did not advertise the routes learned from ISP2 to Switch C.

Scenario 3: The requirements of the administrator of AS 65001 are as follows:

  • ISP1 is active and ISP2 is backup for the traffic to 10.11.0.0/16.
  • ISP2 is active and ISP1 is backup for the traffic to 10.22.0.0/16.

To meet the preceding requirements, ensure that AS 65001 selects the route 10.11.0.0/16 learned from Switch A and the route 10.22.0.0/16 learned from Switch B. Detailed configurations are as follows:

Figure 2 Local_Pref-based BGP route selection networking (1)
In this situation, different Local_Pref values are required for the routes learned from the same ISP. To configure different Local_Pref values for the routes learned from the same ISP, configure route-policies. Detailed configurations are as follows:
  • Configurations on Switch A

    #
    bgp 65001
     #
     ipv4-family unicast
      peer 10.1.1.1 route-policy rp1 import                 //Apply import policy named rp1 to the routes learned from 10.1.1.1 and use rp1 to modify the Local_Pref.
     #
    route-policy rp1 permit node 10                         //Define the first node of rp1 and set the Local_Pref value of the route 10.11.0.0/16 to 120.
     if-match ip-prefix addpref
     apply local-preference 120
    #
    route-policy rp1 permit node 20                         //Define the second node of rp1 and set the Local_Pref value of the route 10.22.0.0/16 to 80.
     if-match ip-prefix reducepref
     apply local-preference 80
    #
    route-policy rp1 permit node 30                         //Define the third node of rp1 and allow rp1 to permit all routes.
    #
    ip ip-prefix addpref index 10 permit 10.11.0.0 16         //Configure an IP prefix list to match the route 10.11.0.0/16.
    ip ip-prefix reducepref index 10 permit 10.22.0.0 16      //Configure an IP prefix list to match the route 10.22.0.0/16.
    #
  • Configurations on Switch B

    bgp 65001
     #
     ipv4-family unicast
      peer 10.1.2.1 route-policy rp2 import                 //Apply import policy named rp2 to the routes learned from 10.1.1.1 and use rp2 to modify the Local_Pref.
    #
    route-policy rp2 permit node 10                         //Define the first node of rp2 and set the Local_Pref value of the route 10.22.0.0/16 to 200.
     if-match ip-prefix addpref
     apply local-preference 200
    #
    route-policy rp2 permit node 20                         //Define the second node of rp2 and set the Local_Pref value of the route 10.11.0.0/16 to 60.
     if-match ip-prefix reducepref
     apply local-preference 60
    #
    route-policy rp2 permit node 30                         //Define the third node of rp2 and allow rp2 to permit all routes.
    #
    ip ip-prefix addpref index 10 permit 10.22.0.0 16         //Configure an IP prefix list to match the route 10.22.0.0/16.
    ip ip-prefix reducepref index 10 permit 10.11.0.0 16      //Configure an IP prefix list to match the route 10.11.0.0/16.
    #

Run the display bgp routing-table [ ip-address ] command to check the configurations.

# Display the routing table of Switch A.

[HUAWEIA] display bgp routing-table
 BGP Local router ID is 192.168.2.3
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 5
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.1.1.0/30        0.0.0.0         0                     0      i
 *>i  10.1.2.0/30        10.1.3.2        0          100        0      i
 *>   10.11.0.0/16       10.1.1.1                   120        0      100 10i
 *>i  10.22.0.0/16       10.1.2.1                   200        0      200 10i
 *                       10.1.1.1                   80         0      100 10i

# Display detailed information about the route 10.22.0.0/16 on Switch A.

[HUAWEIA] display bgp routing-table 10.22.0.0
 BGP local router ID : 192.168.2.3
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.22.0.0/16:
 From: 10.1.3.2 (192.168.2.2)
 Route Duration: 00h20m12s
 Relay IP Nexthop: 10.1.3.2
 Relay IP Out-Interface: GigabitEthernet1/0/3
 Original nexthop: 10.1.2.1
 Qos information : 0x0
 AS-path 200 10, origin igp, localpref 200, pref-val 0, valid, internal, best, select, active, pre 255
 Advertised to such 1 peers:
    10.1.1.1

 BGP routing table entry information of 10.22.0.0/16:
 From: 10.1.1.1 (192.168.2.5)
 Route Duration: 00h19m40s
 Direct Out-interface: GigabitEthernet1/0/1
 Original nexthop: 10.1.1.1
 Qos information : 0x0
 AS-path 100 10, origin igp, localpref 80, pref-val 0, valid, external, pre 255, not preferred for Local_Pref
 Not advertised to any peer yet

The preceding command output shows that two routes 10.22.0.0/16 are available in the BGP routing table of Switch A and that the route with next hop address 10.1.2.1 is selected because its Local_Pref (200) is greater than the Local_Pref (80) of the route with next hop address 10.1.1.1.

Table 5 shows the route attribute comparison of the routes 10.22.0.0/16 learned from ISP1 and Switch B.

Table 5 Route attribute comparison of the routes 10.22.0.0/16 learned from ISP1 and Switch B.

Route Attribute

Route Learned from ISP1

Route Learned from Switch B

Comparison

PrefVal

0

0

The same.

Local_Pref

80

200

Route 10.22.0.0/16 learned from Switch B is optimal.

The route with next hop address 10.1.1.1 is not optimal, and therefore, it is not advertised to Switch B and Switch C. In addition, the route 10.11.0.0/16 with next hop address 10.1.2.1 is not optimal on Switch B, and therefore, Switch B does not advertise this route to Switch A and Switch C. As a result, only one route 10.11.0.0/16 with next hop address 10.1.1.1 is available in the BGP routing table of Switch A.

# Display the routing table of Switch B.

[HUAWEIB] display bgp routing-table
 BGP Local router ID is 192.168.2.2
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 5
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.1.0/30        10.1.3.1        0          100        0      i
 *>   10.1.2.0/30        0.0.0.0         0                     0      i
 *>i  10.11.0.0/16       10.1.1.1                   120        0      100 10i
 *                       10.1.2.1                   60         0      200 10i
 *>   10.22.0.0/16       10.1.2.1                   200        0      200 10i

# Display detailed information about the route 10.11.0.0/16 on Switch B.

[HUAWEIB] display bgp routing-table 10.11.0.0
 BGP local router ID : 192.168.2.2
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.3.1 (192.168.2.3)
 Route Duration: 00h40m28s
 Relay IP Nexthop: 10.1.3.1
 Relay IP Out-Interface: GigabitEthernet1/0/4
 Original nexthop: 10.1.1.1
 Qos information : 0x0
 AS-path 100 10, origin igp, localpref 120, pref-val 0, valid, internal, best, select, active, pre 255
 Advertised to such 1 peers:
    10.1.2.1

 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.2.1 (192.168.2.4)
 Route Duration: 00h41m00s
 Direct Out-interface: GigabitEthernet1/0/0
 Original nexthop: 10.1.2.1
 Qos information : 0x0
 AS-path 200 10, origin igp, localpref 60, pref-val 0, valid, external, pre 255, not preferred for Local_Pref
 Not advertised to any peer yet

The preceding command output shows that two routes 10.11.0.0/16 are available in the BGP routing table of Switch B and that the route with next hop address 10.1.1.1 is selected because its Local_Pref (120) is greater than the Local_Pref (60) of the route with next hop address 10.1.2.1. The route with next hop address 10.1.2.1 is not advertised to Switch A and Switch C because it is not optimal.

# Display the routing table of Switch C.

[HUAWEIC] display bgp routing-table
 Total Number of Routes: 4

 BGP Local router ID is 192.168.2.1
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.1.0/30        10.1.4.1        0          100        0      i
 *>i  10.1.2.0/30        10.1.5.1        0          100        0      i
 *>i  10.11.0.0/16       10.1.1.1                   120        0      100 10i
 *>i  10.22.0.0/16       10.1.2.1                   200        0      200 10i

The preceding command output shows that the next hop address of the route 10.11.0.0/16 is 10.1.1.1 and that the next hop address of the route 10.22.0.0/16 is 10.1.2.1.

Scenario 4: The requirements of the administrator of AS 65001 are as follows:
  • ISP1 is active and ISP2 is backup for the traffic from Switch A and Switch C to 10.11.0.0/16 and 10.22.0.0/16.
  • ISP2 is active and ISP1 is backup for the traffic from Switch B to 10.11.0.0/16 and 10.22.0.0/16.

To meet the preceding requirements, ensure that Switch A and Switch C select the routes learned from ISP1. Detailed configurations are as follows:

Figure 3 Local_Pref-based BGP route selection networking (2)
You can perform either of the following operations:
  • Configure an export policy on Switch A to modify the Local_Pref of the routes to be advertised to Switch C.
  • Configure an import policy on Switch C to modify the Local_Pref of the routes learned from Switch A.
The configurations on Switch A are used as an example. Detailed configurations are as follows:
#
bgp 65001
 #
 ipv4-family unicast
  peer 10.1.4.2 route-policy rp2 export                 //Apply the export route-policy rp2 to the route destined for the peer 10.1.4.1 to modify the Local_Pref of the route.
 #
route-policy rp2 permit node 10                         //Define the node index of the route-policy rp2 to 10 and set the Local_Pref to 120.
 apply local-preference 120
#

Run the display bgp routing-table [ ip-address ] command to check the configurations.

# Display the routing table of Switch A.

[HUAWEIA] display bgp routing-table
 BGP Local router ID is 192.168.2.3
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 6
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.1.1.0/30        0.0.0.0         0                     0      i
 *>i  10.1.2.0/30        10.1.3.2        0          100        0      i
 *>   10.11.0.0/16       10.1.1.1                              0      100 10i
 * i                     10.1.2.1                   100        0      200 10i
 *>   10.22.0.0/16       10.1.1.1                              0      100 10i
 * i                     10.1.2.1                   100        0      200 10i

The preceding command output shows that Switch A selects the routes learned from ISP1.

# Display the routing table of Switch B.

[HUAWEIB] display bgp routing-table
 BGP Local router ID is 192.168.2.2
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 6
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.1.0/30        10.1.3.1        0          100        0      i
 *>   10.1.2.0/30        0.0.0.0         0                     0      i
 *>   10.11.0.0/16       10.1.2.1                              0      200 10i
 * i                     10.1.1.1                   100        0      100 10i
 *>   10.22.0.0/16       10.1.2.1                              0      200 10i
 * i                     10.1.1.1                   100        0      100 10i

The preceding command output shows that Switch B selects the routes learned from ISP2.

# Display the routing table of Switch C.

[HUAWEIC] display bgp routing-table
 Total Number of Routes: 6

 BGP Local router ID is 192.168.2.1
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.1.1.0/30        10.1.4.1        0          120        0      i
 *>i  10.1.2.0/30        10.1.5.1        0          100        0      i
 *>i  10.11.0.0/16       10.1.1.1                   120        0      100 10i
 * i                     10.1.2.1                   100        0      200 10i
 *>i  10.22.0.0/16       10.1.1.1                   120        0      100 10i
 * i                     10.1.2.1                   100        0      200 10i

The preceding command output shows that Switch C selects the routes learned from ISP1.

# Display detailed information about the route 10.11.0.0/16 or 10.22.0.0/16 on Switch C. The route 10.11.0.0/16 is used as an example.

[HUAWEIC] display bgp routing-table 10.11.0.0
 BGP local router ID : 192.168.2.1
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.4.1 (192.168.2.3)
 Route Duration: 00h06m26s
 Relay IP Nexthop: 10.1.4.1
 Relay IP Out-Interface: GigabitEthernet1/0/0
 Original nexthop: 10.1.1.1
 Qos information : 0x0
 AS-path 100 10, origin igp, localpref 120, pref-val 0, valid, internal, best, select, active, pre 255
 Not advertised to any peer yet

 BGP routing table entry information of 10.11.0.0/16:
 From: 10.1.5.1 (192.168.2.2)
 Route Duration: 00h08m05s
 Relay IP Nexthop: 10.1.5.1
 Relay IP Out-Interface: GigabitEthernet1/0/1
 Original nexthop: 10.1.2.1
 Qos information : 0x0
 AS-path 200 10, origin igp, localpref 100, pref-val 0, valid, internal, pre 255, not preferred for Local_Pref
 Not advertised to any peer yet

The preceding command output shows that Switch C selects the routes learned from ISP1 because the Local_Pref of the routes learned from ISP1 is greater than that of the route learned from ISP2.

The preceding examples show that the modification of the Local_Pref values affects not only BGP route advertisement but also BGP route selection with an AS. We can configure Local_Pref values as required to control the forwarding path of the traffic that leaves an AS.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >