Summary: Two methods for routing preference to BGP when both static routes and BGP exist

in conclusion:

Method 1: Configure the external priority of the BGP protocol to be higher than the priority of the static route, preferably BGP.

              Advantages: Simple configuration.

              Disadvantage: It takes effect globally. If the user wants to increase the priority of a static route and is not affected by the dynamic route, the priority needs to be artificially increased for each static route.

 

Method 2: Configure the external priority of the specified static route to be the same as the priority of the BGP protocol. Then, because the internal priority of EBGP is higher than that of the static route, the EBGP protocol is preferred.

              Corresponding to the advantages and disadvantages of method one.

 

Network diagram:

 

 

 

Configuration method:

Method 1: Configure BGP to take precedence over static routes.

Step 1: Check the priority of the destination network segment

 

 

Step 2: Modify the protocol priority of BGP to 50, which is higher than the static route

[branch-bgp]dis this
[V200R003C00]
#
bgp 65003
timer keepalive 20 hold 60
peer 40.0.0.1 as-number 65002
#
ipv4-family unicast
undo synchronization
preference 50 50 50
network 40.0.0.0 255.255.255.0
network 70.0.0.0 255.255.255.0
peer 40.0.0.1 enable
#
return
[branch-bgp]

 

Step 3: Check the priority of the destination network segment

 

 

Method 2: When the external priority is the same, the EBGP priority is higher than the static route

Step 1: Check the priority of the destination network segment

 

Step 2: Configure the priority of the static route to 255

ip route-static 192.168.0.0 255.255.255.0 50.0.0.2 preference 255

 

Step 3: Check the priority of the destination network segment

 

 

  Comments: The router first compares the external priorities of the routing protocols, and the routes learned by the protocols with higher external priorities are preferentially added to the routing table.

If the external priorities are the same, then the internal priorities of the protocols are compared, and the routes learned by the protocols with higher internal priorities are preferentially added to the routing table.

 

 

Guess you like

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