0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AIGP(Accumulated IGP)によるBGP経路選択の挙動を確認してみた

Posted at

先日のLocally originatedに引き続きAIGPによるBGP経路選択も実際に見たことないなと思い挙動を確認してみた

構成

・xr1、xr2、xr3はIOS-XR(XRd 25.2.1)
・xe4、xe5、xe6はIOS-XE(c8000v 17.11.01a)
・IGPはOSFP。OSPFでloopbackを学習し、loopback addressにてiBGP接続
・構成図内の数字はospf cost
・xr1、xe6はそれぞれ11.11.11.11/32、66.66.66.66/32の経路広報を行い、それぞれ構成図の上下から経路を学習
image.png

config

xr1

interface Loopback0
 ipv4 address 1.1.1.1 255.255.255.255
!
interface Loopback1
 ipv4 address 11.11.11.11 255.255.255.255
!
interface GigabitEthernet0/0/0/0
 ipv4 address 192.168.12.1 255.255.255.0
!
interface GigabitEthernet0/0/0/1
 ipv4 address 192.168.13.1 255.255.255.0
!
router ospf 1
 router-id 1.1.1.1
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   network point-to-point
  !
  interface GigabitEthernet0/0/0/1
   cost 100
   network point-to-point
  !
 !
!
router bgp 100
 bgp router-id 1.1.1.1
 address-family ipv4 unicast
  network 11.11.11.11/32
 !
 neighbor 2.2.2.2
  remote-as 100
  update-source Loopback0
  address-family ipv4 unicast
  !
 !
 neighbor 3.3.3.3
  remote-as 100
  update-source Loopback0
  address-family ipv4 unicast
  !
 !
!

xr2

interface Loopback0
 ipv4 address 2.2.2.2 255.255.255.255
!
interface GigabitEthernet0/0/0/0
 ipv4 address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/0/0/1
 ipv4 address 192.168.24.2 255.255.255.0
!
route-policy PASS
  pass
end-policy
!
router ospf 1
 router-id 2.2.2.2
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/0
   network point-to-point
  !
 !
!
router bgp 100
 bgp router-id 2.2.2.2
 address-family ipv4 unicast
 !
 neighbor 1.1.1.1
  remote-as 100
  update-source Loopback0
  address-family ipv4 unicast
   next-hop-self
  !
 !
 neighbor 192.168.24.4
  remote-as 200
  address-family ipv4 unicast
   route-policy PASS in
   route-policy PASS out
  !
 !
!

xr3

interface Loopback0
 ipv4 address 3.3.3.3 255.255.255.255
!
interface GigabitEthernet0/0/0/0
 ipv4 address 192.168.35.3 255.255.255.0
!
interface GigabitEthernet0/0/0/1
 ipv4 address 192.168.13.3 255.255.255.0
!
route-policy PASS
  pass
end-policy
!
router ospf 1
 router-id 3.3.3.3
 area 0
  interface Loopback0
   passive enable
  !
  interface GigabitEthernet0/0/0/1
   cost 100
   network point-to-point
  !
 !
!
router bgp 100
 bgp router-id 3.3.3.3
 address-family ipv4 unicast
 !
 neighbor 1.1.1.1
  remote-as 100
  update-source Loopback0
  address-family ipv4 unicast
   next-hop-self
  !
 !
 neighbor 192.168.35.5
  remote-as 200
  address-family ipv4 unicast
   route-policy PASS in
   route-policy PASS out
  !
 !
!

xe4

interface Loopback0
 ip address 4.4.4.4 255.255.255.255
 ip ospf 1 area 0
!
interface GigabitEthernet2
 ip address 192.168.24.4 255.255.255.0
!
interface GigabitEthernet3
 ip address 192.168.46.4 255.255.255.0
 ip ospf 1 area 0
 ip ospf cost 200
!
router ospf 1
 router-id 4.4.4.4
 passive-interface Loopback0
!
router bgp 200
 bgp router-id 4.4.4.4
 bgp log-neighbor-changes
 neighbor 6.6.6.6 remote-as 200
 neighbor 6.6.6.6 update-source Loopback0
 neighbor 6.6.6.6 next-hop-self
 neighbor 192.168.24.2 remote-as 100
!

xe5

interface Loopback0
 ip address 5.5.5.5 255.255.255.255
 ip ospf 1 area 0
!
interface GigabitEthernet2
 ip address 192.168.35.5 255.255.255.0
!
interface GigabitEthernet4
 ip address 192.168.56.5 255.255.255.0
 ip ospf 1 area 0
!
router ospf 1
 router-id 5.5.5.5
 passive-interface Loopback0
!
router bgp 200
 bgp router-id 5.5.5.5
 bgp log-neighbor-changes
 neighbor 6.6.6.6 remote-as 200
 neighbor 6.6.6.6 update-source Loopback0
 neighbor 6.6.6.6 next-hop-self
 neighbor 192.168.35.3 remote-as 100
!

xe6

interface Loopback0
 ip address 6.6.6.6 255.255.255.255
 ip ospf 1 area 0
!
interface Loopback1
 ip address 66.66.66.66 255.255.255.255
!
interface GigabitEthernet3
 ip address 192.168.46.6 255.255.255.0
 ip ospf 1 area 0
 ip ospf cost 200
!
interface GigabitEthernet4
 ip address 192.168.56.6 255.255.255.0
 ip ospf 1 area 0
!
router ospf 1
 router-id 6.6.6.6
 passive-interface Loopback0
!
router bgp 200
 bgp router-id 6.6.6.6
 bgp log-neighbor-changes
 network 66.66.66.66 mask 255.255.255.255
 neighbor 4.4.4.4 remote-as 200
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 5.5.5.5 remote-as 200
 neighbor 5.5.5.5 update-source Loopback0
!

AIGP無しの挙動

AIGP無しの場合、今回の構成ではIGPメトリックによるBGP経路選択が行われる

xr1→xe6

xr3との接続がcost 100となっているため、xr2からの経路(上経路)がベストパスとなる
metric 2:xr2と101:xr3との勝負でxr2選択

RP/0/RP0/CPU0:xr1#show bgp 66.66.66.66/32 bestpath-compare | b Paths
Sat Aug 30 09:37:47.136 UTC
Paths: (2 available, best #1)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Flags: 0x2000000001060005+0x00, import: 0x020
  Not advertised to any peer
  200
    2.2.2.2 (metric 2) from 2.2.2.2 (2.2.2.2), if-handle 0x00000000
      Origin IGP, localpref 100, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 34
      best of AS 200, Overall best
  Path #2: Received by speaker 0
  Flags: 0x2000000000020005+0x00, import: 0x020
  Not advertised to any peer
  200
    3.3.3.3 (metric 101) from 3.3.3.3 (3.3.3.3), if-handle 0x00000000
      Origin IGP, localpref 100, valid, internal
      Received Path ID 0, Local Path ID 0, version 0
      Higher IGP metric than best path (path #1)


RP/0/RP0/CPU0:xr1#traceroute 66.66.66.66 source 11.11.11.11

 1  192.168.12.2 2 msec  2 msec  1 msec 
 2  192.168.24.4 2 msec  2 msec  2 msec 
 3  192.168.46.6 3 msec  *  3 msec 

image.png

xe6→xr1

xe4との接続がcost 200となっているため、xr5(下経路)がベストパスとなる
metric 201:xe4と2:xe5との勝負でxe5選択

xe6#show bgp 11.11.11.11/32 best-path-reason | b Paths
Paths: (2 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  100
    5.5.5.5 (metric 2) from 5.5.5.5 (5.5.5.5)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Aug 30 2025 09:39:54 UTC
      Best Path Evaluation: Overall best path
  Refresh Epoch 1
  100
    4.4.4.4 (metric 201) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, internal
      rx pathid: 0, tx pathid: 0
      Updated on Aug 30 2025 09:39:54 UTC
      Best Path Evaluation: Higher IGP metric

image.png

それぞれのAS内にてIGPメトリック制御している場合にはこのように非対称ルーティングとなるケースが存在する

AIGPありの挙動

このようなホットポテトルーティングによる最適でないパスが選択されることを回避するための仕組みとしてAIGPが存在する。AIGPを使用することでEnd-to-EndのIGPメトリック制御を可能とし、最適なパスを選択することができる
利用ケースとしては、単一管理下において複数のASに分割しており、なおかつそれぞれのAS内にて同一のIGPを利用している場合にはAIGPによる経路制御が有効的となる
AIGPによる経路選択は先日確認した3番目のLocally originatedと4番目のAS-PATHの間の優先度となっているため、結構強めの経路制御方法となる(ただし利用ケースとしては比較的限定的)

AIGPのアトリビュートはOptional non-transitiveとなるため、AIGPを利用する場合は、経路上の全てのRouterにてAIGPを有効化する必要がある
それぞれのRouterにて以下設定追加

xr1

route-policy AIGP
  set aigp-metric igp-cost
end-policy
!
router bgp 100
 address-family ipv4 unicast
  network 11.11.11.11/32 route-policy AIGP
 !
 neighbor 2.2.2.2
  address-family ipv4 unicast
   aigp
  !
 !
 neighbor 3.3.3.3
  address-family ipv4 unicast
   aigp
  !
 !
!

xr2

router bgp 100
 neighbor 1.1.1.1
  address-family ipv4 unicast
   aigp
  !
 !
 neighbor 192.168.24.4
  address-family ipv4 unicast
   aigp
  !
 !
!

xr3

router bgp 100
 neighbor 1.1.1.1
  address-family ipv4 unicast
   aigp
  !
 !
 neighbor 192.168.35.5
  address-family ipv4 unicast
   aigp
  !
 !
!

xe4

router bgp 200
 neighbor 6.6.6.6 aigp
 neighbor 192.168.24.2 aigp
!

xe5

router bgp 200
 neighbor 6.6.6.6 aigp
 neighbor 192.168.35.3 aigp
!

xe6

route-map AIGP permit 10 
 set aigp-metric igp-metric
!
router bgp 200
 network 66.66.66.66 mask 255.255.255.255 route-map AIGP
 neighbor 4.4.4.4 aigp
 neighbor 5.5.5.5 aigp
!

xr1→xe6

config投入後にxr1にて経路確認してみると、先ほどまでxr2経由(上経路)だったがxr3経由(下経路)となった
経路情報に新しくaigp metricとTotal AIGP metricが追加された
reasonにもHigher AIGP metric than best pathと表示されていることからAIGPメトリックがIGPメトリックより優先されて経路選択されたことになる
Total AIGP metricはAS200におけるIGPメトリック201とAS100におけるIGPメトリック2が足されて203となっている
AS200内は、loopback costの1とip ospf cost 200で設定した200を足して201
AS100内は、loopback costの1とgigainterface default costの1を足して2
(2.2.2.2の隣に記載されている(metric 2)がIGPメトリック値)
AS100内でのloopback costは66.66.66.66/32のnexthopである2.2.2.2となり、gigainterface default costは2.2.2.2宛の際に通過するxr1-xr2間のIF costとなる
AIGP metric 203:xr2と103:xr3との勝負でxr3選択

RP/0/RP0/CPU0:xr1#show bgp 66.66.66.66/32 bestpath-compare | b Paths
Sat Aug 30 10:19:36.875 UTC
Paths: (2 available, best #2)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Flags: 0x2000000000020005+0x00, import: 0x020
  Not advertised to any peer
  200
    2.2.2.2 (metric 2) from 2.2.2.2 (2.2.2.2), if-handle 0x00000000
      Origin IGP, localpref 100, aigp metric 201, valid, internal
      Received Path ID 0, Local Path ID 0, version 0
      Total AIGP metric 203
      Higher AIGP metric than best path (path #2)
  Path #2: Received by speaker 0
  Flags: 0x2000000001060005+0x00, import: 0x020
  Not advertised to any peer
  200
    3.3.3.3 (metric 101) from 3.3.3.3 (3.3.3.3), if-handle 0x00000000
      Origin IGP, localpref 100, aigp metric 2, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 41
      Total AIGP metric 103
      best of AS 200, Overall best

RP/0/RP0/CPU0:xr1#traceroute 66.66.66.66 source 11.11.11.11
Sat Aug 30 10:26:55.849 UTC

 1  192.168.13.3 1 msec  2 msec  2 msec 
 2  192.168.35.5 2 msec  2 msec  2 msec 
 3  192.168.56.6 3 msec  *  3 msec 

xe6→xr1

こちらも同様にHigher AIGP valueによってベストパス選択が行われている
このEnd-to-EndによるIGPメトリック制御を行うことで非対称ルーティングが解消された

xe6#show bgp 11.11.11.11/32 best-path-reason | b Paths
Paths: (2 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  100
    5.5.5.5 (metric 2) from 5.5.5.5 (5.5.5.5)
      Origin IGP, aigp-metric 101, metric 0, localpref 100, valid, internal, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Aug 30 2025 10:10:54 UTC
      Best Path Evaluation: Overall best path
  Refresh Epoch 1
  100
    4.4.4.4 (metric 201) from 4.4.4.4 (4.4.4.4)
      Origin IGP, aigp-metric 2, metric 0, localpref 100, valid, internal
      rx pathid: 0, tx pathid: 0
      Updated on Aug 30 2025 10:10:54 UTC
      Best Path Evaluation: Higher AIGP value

xe6#traceroute 11.11.11.11 source 66.66.66.66
Type escape sequence to abort.
Tracing the route to 11.11.11.11
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.56.5 0 msec 1 msec 1 msec
  2 192.168.35.3 2 msec 2 msec 2 msec
  3 192.168.13.1 3 msec 3 msec * 

image.png

パケット確認

xe6から広報された66.66.66.66/32がどのようにAIGP metricをつけてxr1まで広報されていくかパケットをみてみる
まずはxe6からxe4
image.png
Path AttributeにAIGPが追加されている
この時点ではAIGP metricは0

続いてxe4からxe2
image.png
このタイミングでAIGPメトリックに201が設定されている
この201はxe4における66.66.66.66/32経路のIGPメトリックであり、このbgpにおけるIGPメトリックはnexthopへのIGPメトリック、今回だと6.6.6.6/32のIGPメトリックになるので201となる

xe4#show bgp 66.66.66.66/32 | b Path
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     13        
  Refresh Epoch 1
  Local
    6.6.6.6 (metric 201) from 6.6.6.6 (6.6.6.6)
      Origin IGP, aigp-metric 0, metric 0, localpref 100, valid, internal, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Aug 30 2025 10:17:32 UTC
xe4#show ip route ospf | i 6.6.6.6  
O        6.6.6.6 [110/201] via 192.168.46.6, 04:45:15, GigabitEthernet3

そして最後にxr2からxr1
image.png

このような形でAIGPメトリック値が伝わっていく
Optional non-transitiveなのでneighborに対するaigp設定がない場合には、そのneighborに対するUPDATE messageからAIGP Path Attributeが削除される形となる

AIGPがMEDより優先されることの確認

本当はAS-PATHより優先されることを確認しようと思ったが構成変更が必要なので構成変更の必要のないMEDでとりあえず比較してみる
以下configをxr3に追加

xr3

route-policy MED
  set med 100
end-policy
!
router bgp 100
 !
 neighbor 1.1.1.1
  address-family ipv4 unicast
   route-policy MED out
  !
 !
!

設定後に経路を確認してみると、xr2経由がmed 0、xr3経由がmed 100にもかかわらずxr3経由がベストパス選択されている。確かにMEDよりも優先されてAIGP比較が行われている

RP/0/RP0/CPU0:xr1#show bgp 66.66.66.66/32 bestpath-compare | b Path
Sat Aug 30 11:20:01.550 UTC
Paths: (2 available, best #2)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Flags: 0x2000000000020005+0x00, import: 0x020
  Not advertised to any peer
  200
    2.2.2.2 (metric 2) from 2.2.2.2 (2.2.2.2), if-handle 0x00000000
      Origin IGP, localpref 100, aigp metric 201, valid, internal
      Received Path ID 0, Local Path ID 0, version 0
      Total AIGP metric 203
      Higher AIGP metric than best path (path #2)
  Path #2: Received by speaker 0
  Flags: 0x2000000001060005+0x00, import: 0x020
  Not advertised to any peer
  200
    3.3.3.3 (metric 101) from 3.3.3.3 (3.3.3.3), if-handle 0x00000000
      Origin IGP, metric 100, localpref 100, aigp metric 2, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 42
      Total AIGP metric 103
      best of AS 200, Overall best

今回はAIGPの挙動確認と合わせてIGPメトリックの考え方も整理できたので確認してみて良かった

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?