BGP: It is easy to implement route backup, but it is not easy to implement equal-cost load balancing.

 1. Conclusion:

1. BGP can only establish backup routes, but cannot establish equal-cost routes.

2. BGP optimizes routes according to the following rules.

BGP Route Selection Policy

When there are multiple routes to the same destination, BGP compares the following attributes in order to select the route:

  1. The route with the highest protocol preference value (PrefVal) is preferred.

    The protocol preference value (PrefVal) is a unique attribute of Huawei devices, which is only valid locally.

  2. The route with the highest local priority (Local_Pref) is preferred.

    If a route does not have a local priority, the route is processed according to the default local priority of 100 during BGP route selection.

  3. The manual aggregation route, the automatic aggregation route, the route imported by the network command, the route imported by the import-route command, and the route learned from the peer are preferred in sequence.

  4. The route with the shortest AS path (AS_Path) is preferred.

  5. Routes whose origin types are IGP, EGP, and Incomplete are preferred in sequence.

  6. For routes from the same AS, the route with the lowest MED value is preferred.

  7. Select EBGP routes, IBGP routes, LocalCross routes, and RemoteCross routes in sequence.

    The ERT of the VPNv4 route of a VPN instance on the PE matches the IRT of other VPN instances and is copied to the VPN instance, which is called LocalCross; the ERT of the VPNv4 route learned from the remote PE matches the IRT of a VPN instance and then copied to the VPN instance. VPN instance, called RemoteCross.

  8. The route with the smallest IGP metric to the BGP next hop is preferred.
    illustrate:

    In IGP, for different routes reaching the same destination address, IGP calculates the metric value of the route according to its own routing algorithm.

  9. The route with the shortest Cluster_List is preferred.

  10. The route advertised by the device with the smallest Router ID is preferred.

    If the route carries the Originator_ID attribute, the size of the Originator_ID will be compared during the route selection process (the Router ID will no longer be compared), and the route with the smallest Originator_ID will be preferred.

  11. The route learned from the peer with the smallest IP Address is preferred.

3. BGP load sharing

When there are multiple equal-cost routes to the same destination address, BGP equal-cost load balancing can be used to balance traffic. The condition for BGP equal-cost load sharing is that the attributes to be compared in rules 1 to 8 in "BGP Route Selection Policy" are exactly the same.

 

 

Second, the network diagram:

 

 

3. Key configuration:

1. All neighbors are EBGP neighbors.

2. There is one PC on the left and two PCs on the right. In order to verify whether the traffic always goes to a router on the intermediate network, rather than load balancing.

 

4. Measured results:

 1. Traffic from left to right or from right to left always goes to the router above. without going to the router below.

tracert result on PC1:

 

tracert result on PC2:

 

tracert result on PC3:

 

 

Do another experiment and change the AS number of the router above to 65010, which is larger than the AS number of the router below. The results are as follows:

Let’s talk about the conclusion first: BGP still selects an optimal path without load sharing. The optimal route selected is still the same as above.

 

 

Below is the routing table seen on AR9.

 

 The result of tracert on PC1, it can be seen that the above path is still taken.

 

 The result of tracert on PC2 also shows that the above path is taken, as follows:

 

The result of tracert on PC3 also shows that the above path is taken, as follows:

 

Paste configuration information for all devices:

The AR9 router is configured as follows:

<Huawei>dis curr
[V200R003C00]
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface Vlanif1
 ip address 10.0.0.1 255.255.255.0
#
interface Ethernet0/0/0
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface GigabitEthernet0/0/0
 ip address 20.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 30.0.0.1 255.255.255.0
#
interface NULL0
#
bgp 65001
 peer 20.0.0.2 as-number 65010
 peer 30.0.0.2 as-number 65003
 #
 ipv4-family unicast
  undo synchronization
  network 10.0.0.0 255.255.255.0
  network 20.0.0.0 255.255.255.0
  network 30.0.0.0 255.255.255.0
  peer 20.0.0.2 enable
  peer 30.0.0.2 enable
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
<Huawei>

 

The configuration of the AR4 router is as follows:

<Huawei>dis curr
[V200R003C00]
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 20.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 40.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
bgp 65010
 peer 20.0.0.1 as-number 65001
 peer 40.0.0.2 as-number 65004
 #
 ipv4-family unicast
  undo synchronization
  peer 20.0.0.1 enable
  peer 40.0.0.2 enable
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
<Huawei>  

 

The configuration of the AR5 router is as follows:

<Huawei>dis curr
[V200R003C00]
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface GigabitEthernet0/0/0
 ip address 30.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 50.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
bgp 65003
 peer 30.0.0.1 as-number 65001
 peer 50.0.0.2 as-number 65004
 #
 ipv4-family unicast
  undo synchronization
  peer 30.0.0.1 enable
  peer 50.0.0.2 enable
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
<Huawei>

 

The configuration of the AR10 router is as follows:

<Huawei>dis curr
[V200R003C00]
#
 snmp-agent local-engineid 800007DB03000000000000
 snmp-agent
#
 clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
 drop illegal-mac alarm
#
 set cpu-usage threshold 80 restore 75
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
 local-user admin service-type http
#
firewall zone Local
 priority 15
#
interface Vlanif1
 ip address 90.0.0.1 255.255.255.0
#
interface Ethernet0/0/0
#
interface Ethernet0/0/1
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface GigabitEthernet0/0/0
 ip address 40.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 50.0.0.2 255.255.255.0
#
interface NULL0
#
bgp 65004
 peer 40.0.0.1 as-number 65010
 peer 50.0.0.1 as-number 65003
 #
 ipv4-family unicast
  undo synchronization
  network 40.0.0.0 255.255.255.0
  network 50.0.0.0 255.255.255.0
  network 90.0.0.0 255.255.255.0
  peer 40.0.0.1 enable
  peer 50.0.0.1 enable
#
user-interface con 0
 authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
<Huawei>

 

Failover:

1. Simulate the failure of the primary link, and it can be seen that the traffic is immediately switched to the backup link.

Shut down the port of AR4 to simulate the failure:

 

2. PC1 keeps pinging PC2, it can be seen that there is a packet loss in the middle, and then it returns to normal.

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324745144&siteId=291194637