Route Type

BGP prefers locally imported routes to the routes learned from peers during BGP route selection.

BGP routes can be locally imported or learned from peers. The locally imported routes take precedence over the routes learned from peers during BGP route selection. It is unusual for locally imported routes and the routes learned from peers to carry the same destination IP address and coexist in the routing table. Generally, locally imported routes can be the routes imported using the network or import-route command and the automatically and manually summary routes. Precedences of these routes are described as follows:

  1. Summary routes take precedence over non-summary routes.

  2. Summary routes that are manually generated using the aggregate command take precedence over summary routes that are automatically generated based on the summary automatic command settings.

  3. The routes imported using the network command take precedence over the routes imported using the import-route command.

In Figure 1, Device A and Device B are EBGP peers, and Device B, Device C, and Device D are IBGP peers.

Figure 1 Networking

The configurations on Device C are as follows:

#
bgp 65001
 #
 ipv4-family unicast
  network 10.1.2.0 255.255.255.252                       //Advertise the route 10.1.2.0/30.
  network 10.1.4.0 255.255.255.252                       //Advertise the route 10.1.4.0/30.
  import-route direct                                    //Import direct routes.
#

The configurations on Device D are as follows:

#
bgp 65001
 #
 ipv4-family unicast
  network 10.1.3.0 255.255.255.252                       //Advertise the route 10.1.3.0/30.
  network 10.1.4.0 255.255.255.252                       //Advertise the route 10.1.4.0/30.
  import-route direct                                    //Import direct routes.
#

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

# Display the routing table of Device D.

[~DeviceD] display bgp routing-table
 BGP Local router ID is 10.1.3.2

 Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 RPKI validation codes: V - valid, I - invalid, N - not-found

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

 *>i  10.1.2.0/30        10.1.4.2        0          100        0      i
 *>   10.1.3.0/30        0.0.0.0         0                     0      i
 *                       0.0.0.0         0                     0      ?
 *>   10.1.3.2/32        0.0.0.0         0                     0      ?
 *>   10.1.4.0/30        0.0.0.0         0                     0      i
 *                       0.0.0.0         0                     0      ?
   i                     10.1.4.2        0          100        0      ?
 *>   10.1.4.1/32        0.0.0.0         0                     0      ?
 *>   127.0.0.0          0.0.0.0         0                     0      ?
 *>   127.0.0.1/32       0.0.0.0         0                     0      ?

The preceding command output shows that three routes 10.1.4.0/30 are available in the routing table. The route with the next hop address 10.1.4.2 is learned from a peer (Device C). Therefore, BGP first excludes this route from route selection.

[~DeviceD] display bgp routing-table 10.1.4.0 30
 BGP local router ID : 10.1.3.2

 Local AS number : 65001
 Paths:   3 available, 1 best, 1 select
 BGP routing table entry information of 10.1.4.0/30:
 Network route.
 From: 0.0.0.0 (0.0.0.0)
 Route Duration: 00h03m51s
 Direct Out-interface: GigabitEthernet0/1/4
 Original nexthop: 10.1.4.1
 Qos information : 0x0
 AS-path Nil, origin igp, MED 0, pref-val 0, valid, local, best, select, pre 0
 Advertised to such 2 peers:
    10.1.3.1
    10.1.4.2
 BGP routing table entry information of 10.1.4.0/30:
 Imported route.
 From: 0.0.0.0 (0.0.0.0)
 Route Duration: 00h04m10s
 Direct Out-interface: GigabitEthernet0/1/4
 Original nexthop: 10.1.4.1
 Qos information : 0x0
 AS-path Nil, origin incomplete, MED 0, pref-val 0, valid, local, pre 0, not preferred for route type
 Not advertised to any peer yet

 BGP routing table entry information of 10.1.4.0/30:
 From: 10.1.4.2 (10.1.2.2)
 Route Duration: 00h02m24s
 Relay IP Nexthop: 0.0.0.0
 Relay IP Out-Interface: GigabitEthernet0/1/4
 Original nexthop: 10.1.4.2
 Qos information : 0x0
 AS-path Nil, origin incomplete, MED 0, localpref 100, pref-val 0, internal, pre 255
 Not advertised to any peer yet

The preceding command output shows that the route imported using the network command is selected as the optimal route.

The configurations on Device B are as follows:

bgp 65001
 #
 ipv4-family unicast
  summary automatic
  aggregate 10.0.0.0 255.0.0.0
  import-route direct
#

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

# Display the routing table of Device B.

[~DeviceB] display bgp routing-table
 BGP Local router ID is 10.1.1.2

 Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 RPKI validation codes: V - valid, I - invalid, N - not-found

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

 *>   10.0.0.0           127.0.0.1                             0      ?
 *                       127.0.0.1                             0      ?
 s>   10.1.1.0/30        0.0.0.0         0                     0      ?
 *>   10.1.1.2/32        0.0.0.0         0                     0      ?
 s>   10.1.2.0/30        0.0.0.0         0                     0      ?
   i                     10.1.2.2        0          100        0      i
 *>   10.1.2.1/32        0.0.0.0         0                     0      ?
 s>   10.1.3.0/30        0.0.0.0         0                     0      ?
   i                     10.1.3.2        0          100        0      i
 *>   10.1.3.1/32        0.0.0.0         0                     0      ?
 *>i  10.1.4.0/30        10.1.3.2        0          100        0      i
 * i                     10.1.2.2        0          100        0      ?
 *>   127.0.0.0          0.0.0.0         0                     0      ?
 *>   127.0.0.1/32       0.0.0.0         0                     0      ?

The preceding command output shows that two summary routes 10.0.0.0 are available in the routing table.

[~DeviceB] display bgp routing-table 10.0.0.0
 BGP local router ID : 10.1.1.2

 Local AS number : 65001
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.0.0.0/8:
 Aggregated route.
 Route Duration: 00h17m04s
 Direct Out-interface: NULL0
 Original nexthop: 127.0.0.1
 Qos information : 0x0
 AS-path Nil, origin incomplete, pref-val 0, valid, local, best, select, active, pre 255
 Aggregator: AS 65001, Aggregator ID 10.1.1.2
 Advertised to such 3 peers:
    10.1.1.1
    10.1.3.2
    10.1.2.2
 BGP routing table entry information of 10.0.0.0/8:
 Summary automatic route
 Route Duration: 00h17m04s
 Direct Out-interface: NULL0
 Original nexthop: 127.0.0.1
 Qos information : 0x0
 AS-path Nil, origin incomplete, pref-val 0, valid, local, pre 255, not preferred for route type
 Aggregator: AS 65001, Aggregator ID 10.1.1.2
 Not advertised to any peer yet

The preceding command output shows that the route generated using the aggregate command is selected as the optimal route.

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