Octet

Two paths tie on everything down to MED. How does the router decide from there?

Show the answer

Say this first

Next it prefers eBGP over iBGP, then the path whose next hop is closest by IGP metric (hot potato). If multipath is configured it installs the tied paths. Then it keeps the oldest eBGP path for stability, then picks the lowest router ID (the ORIGINATOR_ID for reflected routes), then the shortest cluster list, and finally the lowest neighbor address.

Go deeper

Example

R2 in AS 64500 has its own eBGP session to ISP1 at 192.0.2.5, and also hears the same prefix over iBGP from R1:

Output
R2# show ip bgp 198.51.100.0
BGP routing table entry for 198.51.100.0/24, version 31
Paths: (2 available, best #2, table default)
  Advertised to update-groups:
     2
  Refresh Epoch 1
  64496
    10.255.0.1 (metric 3) from 10.255.0.1 (10.255.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 1
  64496
    192.0.2.5 from 192.0.2.5 (192.0.2.253)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0

Same local preference, same AS path length, same origin, same MED from the same AS. Step 7 decides: external beats internal. The (metric 3) is the IGP cost to R1's loopback, used at step 8 if both were internal. The address in parentheses after from is the peer's router ID, used at step 11.

Why each step exists

  • eBGP over iBGP: an external path leaves the AS right here instead of crossing it.
  • IGP metric: hand the traffic to the other AS at the nearest exit (hot potato).
  • Oldest path: do not flap the best path every time an equal new one appears.
  • Router ID, cluster list, neighbor address: deterministic tie breakers. The neighbor address matters when two sessions go to the same router, for example two links to one ISP router.

Traps

  • Comparing the local router's own router ID. The step compares the router IDs of the peers that sent the paths.
How did you do?Book 4.1 Global Internet