LoginSignup
3
6

BGPの冗長構成(AS PATH Prepend、Local-Preference)

Last updated at Posted at 2023-11-30

BGPの冗長構成の設計

初学者がBGPによるルーティングの冗長構成の設計と構築でいくつか難しかったポイントがあったので詳しく調べてまとめました。

物理構成図

image.png
環境はCMLで以下のように構成しています。
CSR1000-V(ルータ)×6
Alpine Linux(デスクトップ)×2
※CMLはネットワーク機器のシミュレートをするサービスでCisco社が有償で提供しています。

スタブASであるRT1、RT6の先には、PCを設置します。
PC1(10.1.0.1/24)
PC2(10.2.0.1/24)

イメージ図

image.png
本構成で実現したいこと
①RT1→RT2→RT4→RT6の経路を主系とする
②主系障害時は従系に回り込んだ後、主系側の経路に戻る

BGPはパスアトリビュートを設定することで柔軟に経路を調節できます。
今回は①の要件をAS PATH Prepend、②の要件をローカルプリファレンスで実現するようにしてみました。

①RT1→RT2→RT4→RT6の経路を主系とする

image.png

AS PATH Prepend
従系側のeBGPピア間でAS番号を追加して、主系の経路を優先させる。
image.png

②主系障害時は従系に回り込んだ後、主系側の経路に戻る

image.png
Local-Preference
主系側のLocal-Preferenceの値を高くして、主系側への経路を優先させる。
image.png

基本的なBGPの設定

CMLでは下記のような画面になっています。
※desktop-0をPC1、desktop-1をPC2として設定しています。
image.png

まずは各ルータに基本的なIPアドレスの設定と基本的なBGPの設定を行います。

RT1
RT1(config)# router bgp 100
RT1(config-router)# network 10.1.0.0 mask 255.255.255.0
RT1(config-router)# network 10.10.1.0 mask 255.255.255.0
RT1(config-router)# network 10.10.2.0 mask 255.255.255.0
RT1(config-router)# neighbor 10.10.1.2 remote-as 200
RT1(config-router)# neighbor 10.10.2.2 remote-as 200
RT2
RT2(config)# router bgp 200
RT2(config-router)# network 10.30.1.0 mask 255.255.255.0
RT2(config-router)# neighbor 10.10.1.1 remote-as 100
RT2(config-router)# neighbor 10.20.0.2 remote-as 200
RT2(config-router)# neighbor 10.30.1.2 remote-as 300�
RT3
RT3(config)# router bgp 200
RT3(config-router)# network 10.30.2.0 mask 255.255.255.0
RT3(config-router)# neighbor 10.10.2.1 remote-as 100
RT3(config-router)# neighbor 10.20.0.1 remote-as 200
RT3(config-router)# neighbor 10.30.2.2 remote-as 300�
RT4
RT4(config)# router bgp 300
RT4(config-router)# network 10.50.1.0 mask 255.255.255.0
RT4(config-router)# neighbor 10.30.1.1 remote-as 200
RT4(config-router)# neighbor 10.40.0.2 remote-as 300
RT4(config-router)# neighbor 10.50.1.2 remote-as 400�
RT5
RT5(config)# router bgp 300
RT5(config-router)# network 10.50.2.0 mask 255.255.255.0
RT5(config-router)# neighbor 10.30.2.1 remote-as 200
RT5(config-router)# neighbor 10.40.0.1 remote-as 300
RT5(config-router)# neighbor 10.50.2.2 remote-as 400
RT6
RT6(config)# router bgp 400
RT6(config-router)# network 10.2.0.0 mask 255.255.255.0
RT6(config-router)# neighbor 10.50.1.1 remote-as 300
RT6(config-router)# neighbor 10.50.2.1 remote-as 300

これらの設定を入れることでPC1-PC2までの疎通を確認できます。
経路はPC1-RT1-RT2-RT4-RT6-PC2となります。
下記はBGPがベストパスを選定する上で各要素の比較を行う優先度となります。
優先度が高いアトリビュートから比較が行われ、その過程でベストパスが選択されます。

優先度 内容
1 WEIGHTアトリビュートが最も大きいルート
2 LOCAL_PREFアトリビュートが最も大きいルート
3 ネットワークコマンドで生成したルート
4 AS_PATHアトリビュートが最も短いルート
5 ORIGINアトリビュートが最も小さいルート
6 MEDアトリビュートが最も小さいルート
7 IBGPで学習したルート<EBGPで学習したルート
8 ネクストホップに対して最小のIGPメトリックを持つルート
9 EBGPネイバーから受信したルートのうち最も古いルート
10 ルータIDが最小のBGPピアから受信したルート
11 BGPピアのIPアドレスが最小のルート
RT1
RT1#sh ip bgp 10.2.0.0
BGP routing table entry for 10.2.0.0/24, version 3
Paths: (2 available, best #2, table default)
  Advertised to update-groups:
     1
  Refresh Epoch 1
  200 300 400
    10.10.2.2 from 10.10.2.2 (10.30.2.1)
      Origin IGP, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0
      Updated on Nov 30 2023 01:11:53 UTC
  Refresh Epoch 1
  200 300 400
    10.10.1.2 from 10.10.1.2 (10.30.1.1)
      Origin IGP, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Nov 30 2023 01:11:53 UTC

show ip bgpの結果から、10.2.0.0のセグメント宛の通信は10.10.1.2(RT2)経由でのルートがベストパスになっていることがわかります。今回は特に各パスアトリビュートの設定変更を行っていないため、先にBGPネイバーを確立したRT2から受信した経路情報が優先されます。

上記の設定でRT1のGi1をシャットしてみます。すると、RT2とBGPネイバーが確立できなくなり、RT2から広報されていた10.2.0.0/24の経路情報を失います。

RT1
RT1#sh ip bgp 10.2.0.0
BGP routing table entry for 10.2.0.0/24, version 11
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  200 300 400
    10.10.2.2 from 10.10.2.2 (10.30.2.1)
      Origin IGP, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Nov 30 2023 01:11:53 UTC

show ip bgpの結果から、受信する経路情報はRT3から受け取る経路のみとなり、10.10.2.2(RT3)経由で通信を行うことになります。
Gi1を復旧させて再びRT2から経路を受信します。しかし、今度は先に受信していたRT3からの経路が優先され、ベストパスが変化せずにRT3経由のままになってしまいました。

RT1
RT1#sh ip bgp 10.2.0.0
BGP routing table entry for 10.2.0.0/24, version 11
Paths: (2 available, best #2, table default)
  Advertised to update-groups:
     1
  Refresh Epoch 2
  200 300 400
    10.10.1.2 from 10.10.1.2 (10.30.1.1)
      Origin IGP, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0
      Updated on Nov 30 2023 06:44:20 UTC
  Refresh Epoch 1
  200 300 400
    10.10.2.2 from 10.10.2.2 (10.30.2.1)
      Origin IGP, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Nov 30 2023 01:11:53 UTC

ここまでの設定で、PC1-PC2間の到達性は確保できました。しかし、最初に掲げた要件を満たすことはできていません。
①ではRT2-RT4などの主系側の経路を常に優先する構成に、②では主系側の経路に障害が発生して従系RTを通ることになっても、主系側に回り込むように通信させなければなりません。

①の要件を満たす設定

①の要件を満たすため、今回はAS PATH Prependで従系側の優先度を下げてみます。

image.png

BGPはデフォルトでは宛先となるセグメントに対してASの数が短いルートを優先することで経路を決定しますが、今回は10.2.0.0/24に対して主系側を経由しても、従系側を経由しても必ず同じASを経由するため、ASパスによるベストパスの選択は行われませんでした。
このようなときにAS PATH Prependは経路を広報するときに、あえて自身のASを擬似的に増やした経路情報を送信することにより、今回のようにAct/Standbyにする構成を実現することができます。

RT1
RT1(config)# access-list 1 permit 10.1.0.0 0.0.0.255
RT1(config)# route-map PC1-subnet-PREPEND permit 10
RT1(config-route-map)# match ip address 1
RT1(config-route-map)# set as-path prepend 150
RT1(config-route-map)# exit
RT1(config)# route-map PC1-subnet-PREPEND permit 20
RT1(config-route-map)# exit
RT1(config)# router bgp 100 
RT1(config-router)# neighbor 10.10.2.2 route-map PC1-subnet-PREPEND out
RT3
RT3(config)# access-list 1 permit 10.1.0.0 0.0.0.255
RT3(config)# access-list 2 permit 10.2.0.0 0.0.0.255
RT3(config)# route-map PC1-subnet-PREPEND permit 10
RT3(config-route-map)# match ip address 1
RT3(config-route-map)# set as-path prepend 250
RT3(config-route-map)# exit
RT3(config)# route-map PC1-subnet-PREPEND permit 20
RT3(config-route-map)# exit
RT3(config)# route-map PC2-subnet-PREPEND permit 10
RT3(config-route-map)# match ip address 2
RT3(config-route-map)# set as-path prepend 250
RT3(config-route-map)# exit
RT3(config)# route-map PC2-subnet-PREPEND permit 20
RT3(config-route-map)# exit
RT3(config)# router bgp 200 
RT3(config-router)# neighbor 10.10.2.1 route-map PC2-subnet-PREPEND out
RT3(config-router)# neighbor 10.30.2.2 route-map PC1-subnet-PREPEND out
RT5
RT5(config)# access-list 1 permit 10.1.0.0 0.0.0.255
RT5(config)# access-list 2 permit 10.2.0.0 0.0.0.255
RT5(config)# route-map PC1-subnet-PREPEND permit 10
RT5(config-route-map)# match ip address 1
RT5(config-route-map)# set as-path prepend 350
RT5(config-route-map)# exit
RT5(config)# route-map PC1-subnet-PREPEND permit 20
RT5(config-route-map)# exit
RT5(config)# route-map PC2-subnet-PREPEND permit 10
RT5(config-route-map)# match ip address 2
RT5(config-route-map)# set as-path prepend 350
RT5(config-route-map)# exit
RT5(config)# route-map PC2-subnet-PREPEND permit 20
RT5(config-route-map)# exit
RT5(config)# router bgp 300 
RT5(config-router)# neighbor 10.30.2.1 route-map PC2-subnet-PREPEND out
RT5(config-router)# neighbor 10.50.2.2 route-map PC1-subnet-PREPEND out
RT6
RT6(config)# access-list 1 permit 10.2.0.0 0.0.0.255
RT6(config)# route-map PC2-subnet-PREPEND permit 10
RT6(config-route-map)# match ip address 1
RT6(config-route-map)# set as-path prepend 450
RT6(config-route-map)# exit
RT6(config)# route-map PC2-subnet-PREPEND permit 20
RT6(config-route-map)# exit
RT6(config)# router bgp 400 
RT6(config-router)# neighbor 10.50.2.1 route-map PC2-subnet-PREPEND out

上記の設定で従系側のRTでやり取りされる経路情報にはAS PATH Prependで追加されたASが付与されます。

RT1
RT1#sh ip bgp 10.2.0.0
BGP routing table entry for 10.2.0.0/24, version 16
Paths: (2 available, best #1, table default)
  Advertised to update-groups:
     2
  Refresh Epoch 2
  200 300 400
    10.10.1.2 from 10.10.1.2 (10.30.1.1)
      Origin IGP, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Nov 30 2023 06:44:20 UTC
  Refresh Epoch 1
  200 250 300 400
    10.10.2.2 from 10.10.2.2 (10.30.2.1)
      Origin IGP, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0
      Updated on Nov 30 2023 08:34:56 UTC

RT1のshow ip bgpの結果を見ると、10.2.0.0/24へのネクストホップは、10.10.1.2に変化しています。これで主系側と従系側の経路情報にパスアトリビュートの差が生まれ、RT1は常に、RT2から受信した経路をベストパスに選ぶようになります。また、MEDアトリビュートによってもこのような正副の調整を行うことができます。

②の要件を満たす設計

②の要件を満たすために、Local-Preferenceによって、主系側の優先度を高くします。
image.png

Local-PreferenceはCiscoではWeight属性に次いで優先度の高いアトリビュートでiBGPネイバーには広報されます。ですので、主系側の経路情報をデフォルトの100より高い200に設定することで、従系RTから見た主系側経路の優先度を従系側の経路よりも高くすることが可能です。

RT2
RT2(config)# access-list 1 permit 10.1.0.0 0.0.0.255
RT2(config)# access-list 2 permit 10.2.0.0 0.0.0.255
RT2(config)# route-map PC1-subnet-LP permit 10
RT2(config-route-map)# match ip address 1
RT2(config-route-map)# set local-preference 200
RT2(config-route-map)# exit
RT2(config)# route-map PC1-subnet-LP permit 20
RT2(config-route-map)# exit
RT2(config)# route-map PC2-subnet-LP permit 10
RT2(config-route-map)# match ip address 2
RT2(config-route-map)# set local-preference 200
RT2(config-route-map)# exit
RT2(config)# route-map PC2-subnet-LP permit 20
RT2(config-route-map)# exit
RT2(config)# router bgp 200 
RT2(config-router)# neighbor 10.10.1.1 route-map PC1-subnet-LP in
RT2(config-router)# neighbor 10.30.1.2 route-map PC2-subnet-LP in
RT4
RT4(config)# access-list 1 permit 10.1.0.0 0.0.0.255
RT4(config)# access-list 2 permit 10.2.0.0 0.0.0.255
RT4(config)# route-map PC1-subnet-LP permit 10
RT4(config-route-map)# match ip address 1
RT4(config-route-map)# set local-preference 200
RT4(config-route-map)# exit
RT4(config)# route-map PC1-subnet-LP permit 20
RT4(config-route-map)# exit
RT4(config)# route-map PC2-subnet-LP permit 10
RT4(config-route-map)# match ip address 2
RT4(config-route-map)# set local-preference 200
RT4(config-route-map)# exit
RT4(config)# route-map PC2-subnet-LP permit 20
RT4(config-route-map)# exit
RT4(config)# router bgp 200 
RT4(config-router)# neighbor 10.30.1.1 route-map PC1-subnet-LP in
RT4(config-router)# neighbor 10.50.1.2 route-map PC2-subnet-LP in

これでLocal-Preferenceの設定が完了しました。

RT3
RT3#sh ip bgp
BGP table version is 24, local router ID is 10.30.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path, L long-lived-stale,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i  10.1.0.0/24      10.10.1.1                0    200      0 100 i
 *                     10.10.2.1                0             0 100 150 i
 *>i  10.2.0.0/24      10.30.1.2                0    200      0 300 400 i
 *                     10.30.2.2                              0 300 350 400 i
 * i  10.10.1.0/24     10.10.1.1                0    100      0 100 i
 *>                    10.10.2.1                0             0 100 i
 r i  10.10.2.0/24     10.10.1.1                0    100      0 100 i
 r>                    10.10.2.1                0             0 100 i
 *    10.30.1.0/24     10.30.2.2                              0 300 i
 *>i                   10.20.0.1                0    100      0 i
 *>   10.30.2.0/24     0.0.0.0                  0         32768 i
 *>   10.50.1.0/24     10.30.2.2                              0 300 i
 * i                   10.30.1.2                0    100      0 300 i
     Network          Next Hop            Metric LocPrf Weight Path
 * i  10.50.2.0/24     10.30.1.2                0    100      0 300 i
 *>                    10.30.2.2                0             0 300 i�

RT3のshow ip bgpの結果から主系側のLocal-Preferenceの値が高くなりベストパスとして選択されていることがわかります。
本当に要件通りの経路を通るか確認するためにRT3-RT4間のインターフェースを落として見ます。

PC1:~$ traceroute 10.2.0.1
traceroute to 10.2.0.1 (10.2.0.1), 30 hops max, 46 byte packets
 1  10.1.0.254 (10.1.0.254)  0.721 ms  0.787 ms  0.380 ms
 2  10.10.1.2 (10.10.1.2)  0.841 ms  1.313 ms  1.012 ms
 3  10.20.0.2 (10.20.0.2)  1.094 ms  1.417 ms  1.052 ms
 4  10.30.2.2 (10.30.2.2)  1.628 ms  3.221 ms  1.519 ms
 5  *  *  *
 6  10.50.1.2 (10.50.1.2)  2.715 ms  2.351 ms  2.290 ms
 7  10.2.0.1 (10.2.0.1)  2.351 ms  3.464 ms  2.318 ms�
PC2
PC2:/home/cisco# traceroute 10.1.0.1
traceroute to 10.1.0.1 (10.1.0.1), 30 hops max, 46 byte packets
 1  10.2.0.254 (10.2.0.254)  0.565 ms  0.693 ms  0.407 ms
 2  10.50.2.1 (10.50.2.1)  1.266 ms  1.347 ms  1.135 ms
 3  10.30.2.1 (10.30.2.1)  1.402 ms  1.606 ms  1.271 ms
 4  10.10.2.1 (10.10.2.1)  2.244 ms  2.792 ms  1.790 ms
 5  10.1.0.1 (10.1.0.1)  2.270 ms  5.760 ms  2.739 ms

PC1からtracerouteを打つときちんと想定通りの経路を通ることが確認できました。しかし、PC2からPC1への経路が想定通りにいきません。なぜこのようなことが起こるのか考えてみました。

RT6
RT6#sh ip bgp 10.1.0.0
BGP routing table entry for 10.1.0.0/24, version 17
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     1
  Refresh Epoch 3
  300 350 200 250 100
    10.50.2.1 from 10.50.2.1 (10.50.2.1)
      Origin IGP, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
      Updated on Nov 30 2023 11:13:37 UTC

まず、RT6のshow ip bgpを確認すると、10.1.0.0/24の経路はRT5からしか受信していないことがわかります。

RT4
RT4#sh ip bgp 10.1.0.0
BGP routing table entry for 10.1.0.0/24, version 45
Paths: (1 available, no best path)
  Not advertised to any peer
  Refresh Epoch 1
  200 250 100
    10.30.2.1 (inaccessible) from 10.40.0.2 (10.50.2.1)
      Origin IGP, metric 0, localpref 100, valid, internal
      rx pathid: 0, tx pathid: 0
      Updated on Nov 30 2023 1�
      
RT4#show ip bgp
BGP table version is 47, local router ID is 10.50.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path, L long-lived-stale,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i  10.1.0.0/24      10.30.2.1                0    100      0 200 250 100 i
 *>   10.2.0.0/24      10.50.1.2                0    200      0 400 i
 * i  10.10.1.0/24     10.30.2.1                0    100      0 200 100 i
 * i  10.10.2.0/24     10.30.2.1                0    100      0 200 100 i
 *>   10.30.1.0/24     0.0.0.0                  0         32768 i
 *>i  10.30.2.0/24     10.30.2.1                0    100      0 200 i
 *>   10.50.1.0/24     0.0.0.0                  0         32768 i
 *>i  10.50.2.0/24     10.40.0.2                0    100      0 i

RT4はRT2とのeBGPピアを切断されているため、RT5とRT6以外からは経路を受け取りません。つまり、RT5経由でしか10.1.0.0/24の経路を受け取れない状況ということです。
show ip bgpを確認すると、10.1.0.0/24へのネクストホップは、inaccessible(接続性なし)になっており、受信したもののRT4では使用できないネットワークとなります。BGPでは到達性のないルートを広報することなく、RT6はRT4から経路情報を受信しなくなったということです。
なぜこのようなことが起こるかというと、Ciscoの機器では、ルーティングループの可能性を減らすために、iBGPピアに経路を広報する際、ネクストホップを変更せずに広報するという仕様があるからです。このため、RT5から受け取る経路には、RT4から見て到達性がなく、RT4は受信した経路をRT6へ広報することができないのです。

RT3
RT3#sh ip bgp
BGP table version is 28, local router ID is 10.30.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path, L long-lived-stale,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i  10.1.0.0/24      10.10.1.1                0    200      0 100 i
 *                     10.10.2.1                0             0 100 150 i
 *>   10.2.0.0/24      10.30.2.2                              0 300 350 400 i
 * i  10.10.1.0/24     10.10.1.1                0    100      0 100 i
 *>                    10.10.2.1                0             0 100 i
 r i  10.10.2.0/24     10.10.1.1                0    100      0 100 i
 r>                    10.10.2.1                0             0 100 i
 *>   10.30.1.0/24     10.30.2.2                              0 300 i
 *>   10.30.2.0/24     0.0.0.0                  0         32768 i
 *>   10.50.1.0/24     10.30.2.2                              0 300 i
 *>   10.50.2.0/24     10.30.2.2                0             0 300 i

RT3も同じ理由で渡り経由で転送することができないためこちらの経路は採用されず、到達性のあるRT1に直接転送します。このようにネクストホップが変更されないと渡り経由して通信を行うことができません。

しかし、さきほどのPC1→PC2のtraceroouteの結果では、RT5はRT4との渡りを使って通信できていました。なぜこのときはきちんと通信できていたのでしょうか。

RT5
RT5#sh ip bgp
BGP table version is 24, local router ID is 10.50.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path, L long-lived-stale,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   10.1.0.0/24      10.30.2.1                              0 200 250 100 i
 *>i  10.2.0.0/24      10.50.1.2                0    200      0 400 i
 *                     10.50.2.2                0             0 400 450 i
 *>   10.10.1.0/24     10.30.2.1                              0 200 100 i
 *>   10.10.2.0/24     10.30.2.1                              0 200 100 i
 *>i  10.30.1.0/24     10.40.0.1                0    100      0 i
 r>   10.30.2.0/24     10.30.2.1                0             0 200 i
 *>i  10.50.1.0/24     10.40.0.1                0    100      0 i
 *>   10.50.2.0/24     0.0.0.0                  0         32768 i

これはRT4自身が10.50.1.0/24のセグメントをnetworkコマンドで生成して広報していたからです。RT4はRT6から10.2.0.0/24の経路情報を受信しているため、PC1側からは問題なく想定通りの経路で通信できていたのです。

話を戻して、現在の設定では行きと帰りの経路が異なる非対称通信になってしまっています。これまでのお話で、それぞれのRTが渡りを通れないのは、iBGPでは広報する経路のネクストホップを書き換えずに経路を広報するという制約があるからとわかりました。つまり、iBGP間のBGPピアでは、ネクストホップを自身のIPアドレスに書き換えて広報する設定が必要になるということです。設定は下記のようになります。

RT2
RT2(config)# router bgp 200 
RT2(config-router)# neighbor 10.20.0.2 next-hop-self 
RT3
RT3(config)# router bgp 200 
RT3(config-router)# neighbor 10.20.0.1 next-hop-self 
RT4
RT4(config)# router bgp 300 
RT4(config-router)# neighbor 10.40.0.2 next-hop-self 
RT5
RT5(config)# router bgp 300 
RT5(config-router)# neighbor 10.40.0.1 next-hop-self 

上記の設定を入れることで、受信した経路情報のネクストホップを自身のIPアドレスを書き換えるようになるため、RT2-RT3間、RT4-RT5間の渡りを通って通信ができるようになり、PC2→PC1も正しい経路で転送できるようになりました。

PC2
PC2:/home/cisco# traceroute 10.1.0.1
traceroute to 10.1.0.1 (10.1.0.1), 30 hops max, 46 byte packets
 1  10.2.0.254 (10.2.0.254)  0.676 ms  0.843 ms  0.551 ms
 2  10.50.1.1 (10.50.1.1)  1.035 ms  1.400 ms  0.874 ms
 3  10.40.0.2 (10.40.0.2)  1.467 ms  1.571 ms  1.207 ms
 4  10.30.2.1 (10.30.2.1)  1.887 ms  2.077 ms  1.735 ms
 5  10.20.0.1 (10.20.0.1)  1.907 ms  2.887 ms  2.019 ms
 6  10.10.1.1 (10.10.1.1)  2.626 ms  3.241 ms  2.316 ms
 7  10.1.0.1 (10.1.0.1)  2.688 ms  5.091 ms  2.799 ms
3
6
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
3
6