frr icon indicating copy to clipboard operation
frr copied to clipboard

Not correct reason description in bgp bestpath

Open ak503 opened this issue 4 months ago • 3 comments

example topo:

|----------------------     R3          -------- 192.168.199.0/24
|    192.16.3.0/24       RID 1.1.1.3          
|                        AS 65003
|                        MED 150
|
|
|    192.16.2.0/24
R1 --------------------    R2          -------- 192.168.199.0/24
AS 65001                 RID 1.1.1.2
|                        AS 65024
|                        MED 200
|
|
|----------------------     R4          -------- 192.168.199.0/24
    192.16.4.0/24        RID 1.1.1.4
                         AS 65024
                         MED 100

R1:

debug bgp bestpath 192.168.199.0/24

router bgp 65001
 no bgp ebgp-requires-policy
 neighbor 192.168.2.2 remote-as 65024
 neighbor 192.168.3.3 remote-as 65003
 neighbor 192.168.4.4 remote-as 65024
exit

R2:

ip prefix-list ned_pref_out seq 10 permit 192.168.199.0/24

router bgp 65024
 bgp router-id 1.1.1.2
 no bgp ebgp-requires-policy
 neighbor 192.168.2.1 remote-as 65001
 !
 address-family ipv4 unicast
  network 192.168.199.0/24
  neighbor 192.168.2.1 route-map med_rp_out out
 exit-address-family
exit
!
route-map med_rp_out permit 10
 match ip address prefix-list ned_pref_out
 set metric 200
exit

R3:

ip prefix-list med_pref_out seq 10 permit 192.168.199.0/24
!
router bgp 65003
 bgp router-id 1.1.1.3
 no bgp ebgp-requires-policy
 neighbor 192.168.3.1 remote-as 65001
 !
 address-family ipv4 unicast
  network 192.168.199.0/24
  neighbor 192.168.3.1 route-map med_rp_out out
 exit-address-family
exit
!
route-map med_rp_out permit 10
 match ip address prefix-list med_pref_out
 set metric 150
exit

R4:

ip prefix-list med_pref_out seq 10 permit 192.168.199.0/24
!
router bgp 65024
 bgp router-id 1.1.1.4
 no bgp ebgp-requires-policy
 neighbor 192.168.4.1 remote-as 65001
 !
 address-family ipv4 unicast
  network 192.168.199.0/24
  neighbor 192.168.4.1 route-map med_rp_out out
 exit-address-family
exit
!
route-map med_rp_out permit 10
 match ip address prefix-list med_pref_out
 set metric 100
exit

Run R2, then R3, then R4

  1. Run R2 R1 info:
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast start
192.168.199.0/24(VRF default): After path selection, newbest is path 192.168.2.2 oldbest was NONE
192.168.199.0/24(VRF default): path 192.168.2.2 is the bestpath, add to the multipath list
192.168.199.0/24(VRF default): starting mpath update, newbest 192.168.2.2 num candidates 1 old-mpath-count 0 old-cum-bw 0
192.168.199.0/24(VRF default): comparing candidate 192.168.2.2 with existing mpath NONE
192.168.199.0/24(VRF default): New mpath count (incl newbest) 1 mpath-change NO all_paths_lb 0 cum_bw 0
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast, old_select=0x0, new_select=0x1721190
bgp_process_main_one: 192.168.199.0/24 setting SELECTED flag

# do show bgp ipv4 192.168.199.0/24
BGP routing table entry for 192.168.199.0/24, version 6
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.2.2
  65024
    192.168.2.2 from 192.168.2.2 (1.1.1.2)
      Origin IGP, metric 200, valid, external, best (First path received)
      Last update: Wed Sep 25 13:12:45 2024
  1. Run R3 R1 info:
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast start
192.168.199.0/24(VRF default): Comparing path 192.168.3.3 flags Valid Counted Unsorted  with path 192.168.2.2 flags Selected Valid Counted 
192.168.199.0/24: path 192.168.3.3 loses to path 192.168.2.2 due to oldest external
192.168.199.0/24(VRF default): After path selection, newbest is path 192.168.2.2 oldbest was 192.168.2.2
192.168.199.0/24(VRF default): path 192.168.2.2 is the bestpath, add to the multipath list
192.168.199.0/24(VRF default): Comparing path 192.168.3.3 flags Valid Counted  with path 192.168.2.2 flags Selected Valid Counted 

192.168.199.0/24: path 192.168.3.3 loses to path 192.168.2.2 due to oldest external <---------- OK

192.168.199.0/24(VRF default): starting mpath update, newbest 192.168.2.2 num candidates 1 old-mpath-count 0 old-cum-bw 0
192.168.199.0/24(VRF default): comparing candidate 192.168.2.2 with existing mpath NONE
192.168.199.0/24(VRF default): New mpath count (incl newbest) 1 mpath-change NO all_paths_lb 0 cum_bw 0
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast, old_select=0x1721190, new_select=0x1721190

# do show bgp ipv4 192.168.199.0/24
BGP routing table entry for 192.168.199.0/24, version 6
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.2.2 192.168.3.3
  65024
    192.168.2.2 from 192.168.2.2 (1.1.1.2)
      Origin IGP, metric 200, valid, external, best (Older Path)       <---------- OK
      Last update: Wed Sep 25 13:12:45 2024
  65003
    192.168.3.3 from 192.168.3.3 (1.1.1.3)
      Origin IGP, metric 150, valid, external
      Last update: Wed Sep 25 13:15:32 2024
  1. Run R4 R1 info:
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast start
192.168.199.0/24(VRF default): Comparing path 192.168.4.4 flags Valid Counted Unsorted  with path 192.168.2.2 flags Selected Valid Counted 
192.168.199.0/24: path 192.168.4.4 wins over path 192.168.2.2 due to MED 100 < 200
192.168.199.0/24(VRF default): After path selection, newbest is path 192.168.4.4 oldbest was 192.168.2.2
192.168.199.0/24(VRF default): path 192.168.4.4 is the bestpath, add to the multipath list
192.168.199.0/24(VRF default): Comparing path 192.168.2.2 flags Selected Valid Counted  with path 192.168.4.4 flags Valid Counted 

192.168.199.0/24: path 192.168.2.2 loses to path 192.168.4.4 due to MED 200 > 100      <------- OK: 192.168.4.4 is best

192.168.199.0/24(VRF default): Comparing path 192.168.3.3 flags Valid Counted  with path 192.168.4.4 flags Valid Counted 

192.168.199.0/24: path 192.168.3.3 wins over path 192.168.4.4 due to Router-ID comparison <-------- rewrite dest->reason 

192.168.199.0/24(VRF default): starting mpath update, newbest 192.168.4.4 num candidates 1 old-mpath-count 0 old-cum-bw 0
192.168.199.0/24(VRF default): comparing candidate 192.168.4.4 with existing mpath NONE
192.168.199.0/24(VRF default): New mpath count (incl newbest) 1 mpath-change NO all_paths_lb 0 cum_bw 0
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast, old_select=0x1721190, new_select=0x17360a0
bgp_process_main_one: 192.168.199.0/24 setting SELECTED flag

# do show bgp ipv4 192.168.199.0/24
BGP routing table entry for 192.168.199.0/24, version 7
Paths: (3 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.2.2 192.168.3.3 192.168.4.4
  65024
    192.168.4.4 from 192.168.4.4 (1.1.1.4)
      Origin IGP, metric 100, valid, external, best (Router ID) <-- 192.168.4.4 is best via MED, but have dest->reason=router-id
      Last update: Wed Sep 25 13:17:51 2024
  65024
    192.168.2.2 from 192.168.2.2 (1.1.1.2)
      Origin IGP, metric 200, valid, external
      Last update: Wed Sep 25 13:12:45 2024
  65003
    192.168.3.3 from 192.168.3.3 (1.1.1.3)
      Origin IGP, metric 150, valid, external
      Last update: Wed Sep 25 13:15:32 2024

192.168.4.4 is best via MED, but have dest->reason=router-id

ak503 avatar Sep 25 '24 10:09 ak503