Configuring AIGP value on a Route-Policy

BGP prefers the route with the smallest AIGP value during BGP route selection.

The Accumulated Interior Gateway Protocol Metric (AIGP) attribute is an optional non-transitive Border Gateway Protocol (BGP) path attribute. After the AIGP attribute is configured in an AIGP administrative domain, BGP selects paths based on costs in the same manner as an IGP, and all devices in the domain forward data along the optimal routes. During BGP route selection, the AIGP attribute is used as follows:

The AIGP attribute can be added to routes only through route-policies. You can configure an apply clause for a route-policy using the apply aigp { cost | inherit-cost } command to modify the AIGP value during BGP route import, acceptance, or advertisement. If no AIGP value is configured, the IGP routes imported by BGP do not carry the AIGP attribute.

In Figure 1, OSPF runs in AS 65002, an EBGP peer relationship is established between Device A and Device E and between Device B and Device E. Device A and Device B are configured to import OSPF routes in AS 65002 and advertise the routes to AS 65001.

Figure 1 AIGP application networking

Run the display bgp routing-table [ ip-address ] command on Device E to check the configurations. The route 10.1.4.0/30 is used in this example.

# Display the routing table of Device E.

[DeviceE] display bgp routing-table
 BGP Local router ID is 10.1.1.1
 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.2.0/30        10.1.1.2        0                     0      65002?
 *                       10.1.3.2        3                     0      65002?
 *>   10.1.4.0/30        10.1.1.2        2                     0      65002?
 *                       10.1.3.2        2                     0      65002?
 *>   10.1.5.0/30        10.1.3.2        0                     0      65002?
 *                       10.1.1.2        3                     0      65002?
[DeviceE] display bgp routing-table 10.1.4.0
 BGP local router ID : 10.1.1.1
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.1.4.0/30:
 From: 10.1.1.2 (10.1.1.2)
 Route Duration: 00h02m29s
 Direct Out-interface: GigabitEthernet0/1/0
 Original nexthop: 10.1.1.2
 Qos information : 0x0
 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, best, select, active, pre 255
 Advertised to such 2 peers:
    10.1.1.2
    10.1.3.2
 BGP routing table entry information of 10.1.4.0/30:
 From: 10.1.3.2 (10.1.5.1)
 Route Duration: 00h03m58s
 Direct Out-interface: GigabitEthernet0/1/8
 Original nexthop: 10.1.3.2
 Qos information : 0x0
 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, pre 255, not preferred for router ID
 Not advertised to any peer yet

The command output shows that DeviceE selects the route learned from DeviceA because the AIGP attribute has not been configured and the router ID of DeviceA is smaller than that of Device B. To change the route selection on DeviceE, perform the following operations to configure the AIGP attribute.

Configurations on Device A:

#
bgp 65002
 #
 ipv4-family unicast
  import-route ospf 1 route-policy aigp_policy          //Apply route-policy named aigp_policy to locally imported OSPF routes and use aigp_policy to modify the AIGP value.
  peer 10.1.1.1 aigp                                    //Enable AIGP on the local device and the peer 10.1.1.1.
#
route-policy aigp_policy permit node 10                 //Define the first node of aigp_policy and set the AIGP value of the route 10.1.4.0/30 to 10.
 if-match ip-prefix prefix1
 apply aigp 10
#
route-policy aigp_policy permit node 20                 //Define the second node of aigp_policy and allow aigp_policy to permit all routes.
#
ip ip-prefix prefix1 index 10 permit 10.1.4.0 30        //Configure IP prefix list named prefix1 to match the route 10.1.4.0/30.
#

Configurations on Device B:

bgp 65002
 peer 10.1.3.1 as-number 65001
 #
 ipv4-family unicast
  import-route ospf 1 route-policy aigp_policy1         //Apply route-policy named aigp_policy1 to locally imported OSPF routes and use aigp_policy1 to modify the AIGP value.
  peer 10.1.3.1 aigp                                    //Enable AIGP on the local device and the peer 10.1.3.1.
#
route-policy aigp_policy1 permit node 10                //Define the first node of aigp_policy1 and set the AIGP value of the route 10.1.4.0/30 to 5.
 if-match ip-prefix prefix2
 apply aigp 5
#
route-policy aigp_policy1 permit node 20                //Define the second node of aigp_policy1 and allow aigp_policy1 to permit all routes.
#
ip ip-prefix prefix2 index 10 permit 10.1.4.0 30        //Configure IP prefix list named prefix2 to match the route 10.1.4.0/30.
#

Configurations on Device E:

#
bgp 65001
 #
 ipv4-family unicast
  peer 10.1.1.2 aigp                                    //Enable AIGP on the local device and the peer 10.1.1.2.
  peer 10.1.3.2 aigp                                    //Enable AIGP on the local device and the peer 10.1.3.2.
#

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

# Display the routing table of Device E.

[DeviceE] display bgp routing-table
 BGP Local router ID is 10.1.1.1
 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.2.0/30        10.1.1.2        0                     0      65002?
 *                       10.1.3.2        3                     0      65002?
 *>   10.1.4.0/30        10.1.3.2        2                     0      65002?
 *                       10.1.1.2        2                     0      65002?
 *>   10.1.5.0/30        10.1.3.2        0                     0      65002?
 *                       10.1.1.2        3                     0      65002?
[DeviceE] display bgp routing-table 10.1.4.0
 BGP local router ID : 10.1.1.1
 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.1.4.0/30:
 From: 10.1.3.2 (10.1.5.1)
 Route Duration: 00h00m14s
 Direct Out-interface: GigabitEthernet0/1/0
 Original nexthop: 10.1.3.2
 Qos information : 0x0
 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, best, select, active, pre 255, AIGP 5
 Advertised to such 2 peers:
    10.1.1.2
    10.1.3.2
 BGP routing table entry information of 10.1.4.0/30:
 From: 10.1.1.2 (10.1.1.2)
 Route Duration: 01h01m15s
 Direct Out-interface: GigabitEthernet0/1/8
 Original nexthop: 10.1.1.2
 Qos information : 0x0
 AS-path 65002, origin incomplete, MED 2, pref-val 0, valid, external, pre 255, AIGP 10, not preferred for AIGP
 Not advertised to any peer yet

The preceding command output shows that Device E selects the route 10.1.4.0/30 learned from Device B because its AIGP value is smaller than that of the route learned from Device A.

Table 1 shows the attribute comparison of the routes 10.1.4.0/30 learned from DeviceA and DeviceB.
Table 1 Attribute comparison of the routes 10.1.4.0/30 learned from Device A and Device B.

Route Attribute

Route Learned from Device A

Route Learned from Device B

Comparison

PrefVal

0

0

The same.

Local_Pref

-

-

The same.

Route type

Learned from a peer

Learned from a peer

The same.

AIGP

10

5

The different.

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