Cisco BGP-4 Command and Configuration Handbook

 < Free Open Study > 

3-3 bgp bestpath med confed

Syntax Description:

This command has no arguments.

Purpose: If multiple BGP routes to the same destination exist, BGP selects the best path based on the route attributes in the following order:

  1. Ignore a route if the next hop is not known.

  2. Ignore IBGP routes that are not synchronized.

  3. Prefer the route with the largest weight.

  4. Prefer the route with the largest local preference.

  5. Prefer the route that was locally originated.

  6. Prefer the route with the shortest AS path.

    If you're using bgp bestpath as-path ignore, skip this step. When you use the as-set option for aggregated routes, as_set counts as 1 regardless of the number of AS entries in the set. Confederation sub-AS numbers are not used to determine the AS-path length.

  7. Prefer the route with the lowest origin (IGP < EGP < Incomplete).

  8. Prefer the route with the lowest MED.This comparison is only between routes advertised by the same external AS.

    If you're using bgp always-compare-med , compare MEDs for all paths. If used, this command needs to be configured on every BGP router in the AS.

    NOTE

    If you're using bgp bestpath med-confed, the MEDs are compared only for routes that have an AS confederation sequence in their AS-path attribute.

    If a prefix is received with no MED value, the prefix is assigned a MED value of 0. If you're using bgp bestpath med missing-as-worst, a prefix with a missing MED value is assigned a MED value of 4,294,967,294.

  9. Prefer EBGP routes to IBGP routes.

  10. Prefer the route with the nearest IGP neighbor.

  11. Prefer the oldest route.

  12. Prefer the path received from the router with the lowest router ID.

This command allows the comparison of MEDs from BGP routers in a confederation.

Cisco IOS Software Release: 12.0

Configuration Example: BGP MED Comparison in a Confederation

In Figure 3-3, Router B is learning about network 150.150.150.0/24 from Routers A and D.

Figure 3-3. Using MEDs with a BGP Confederation

Router A interface ethernet0 ip address 150.150.150.1 255.255.255.0 ! interface Serial0 ip address 193.16.0.2 255.255.255.252 ! router bgp 65530 bgp confederation identifier 1 bgp confederation peers 65531 network 150.150.150.0 mask 255.255.255.0 neighbor 193.16.0.1 remote-as 65531 ! ___________________________________________________________________________ Router B interface Ethernet1/0 ip address 172.16.0.1 255.255.255.252 ! interface Ethernet1/2 ip address 172.16.0.17 255.255.255.252 ! interface Serial2/0 ip address 193.16.0.1 255.255.255.252 clockrate 64000 ! router bgp 65531 bgp confederation identifier 1 bgp confederation peers 65530 65532 neighbor 172.16.0.2 remote-as 65531 neighbor 172.16.0.18 remote-as 65532 neighbor 193.16.0.2 remote-as 65530 ___________________________________________________________________________ Router D interface Ethernet1/0 ip address 172.16.0.14 255.255.255.252 ! interface Ethernet1/2 ip address 172.16.0.18 255.255.255.252 ! interface Ethernet1/3 ip address 150.150.150.2 255.255.255.0 ! interface Serial2/0 ip address 193.16.0.9 255.255.255.252 clockrate 64000 ! router bgp 65532 bgp confederation identifier 1 bgp confederation peers 65531 network 150.150.150.0 mask 255.255.255.0 neighbor 172.16.0.13 remote-as 65532 neighbor 172.16.0.17 remote-as 65531

Router B is receiving an advertisement for network 150.150.150.0/24 from Routers A and D:

rtrB# show ip bgp BGP table version is 6, local router ID is 172.16.88.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 150.150.150.0/24 172.16.0.18 0 100 0 (65532) i * 193.16.0.2 0 100 0 (65530) i

The best-path algorithm has selected the route from Router D as the best. In order to demonstrate the comparison of MED values in a confederation, set the MED for routes from Router D to 20:

Router D router bgp 65532 neighbor 172.16.0.17 route-map setmed out ! route-map setmed permit 10 set metric 20

At this point, the MED values are not used in the best-path determination. Verify that the new MED value has been configured.

rtrB# show ip bgp BGP table version is 6, local router ID is 172.16.88.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 150.150.150.0/24 172.16.0.18 20 100 0 (65532) i * 193.16.0.2 0 100 0 (65530) i

Now modify the BGP configuration on Router B so that the MEDs from the confederation will be compared when determining the best path:

Router B router bgp 2 bgp bestpath med confed

Verification

Verify that the best-path algorithm has selected the route from Router A as the best due to a lower MED value:

rtrB# show ip bgp BGP table version is 6, local router ID is 172.16.88.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 150.150.150.0/24 172.16.0.18 20 100 0 (65532) i *> 193.16.0.2 0 100 0 (65530) i

Troubleshooting

Step 1. Verify that the BGP neighbors are in the Established state using the show ip bgp neighbors command.

If the neighbor relationship is not in the Established state, see section 8-23.

Step 2. If the command bgp bestpath med confed does not produce the desired result, check the other path attributes, such as weight and local preference. The other attributes might be selecting the best path before MED values are compared.

 < Free Open Study > 

Категории