概要

コンフェデレーションとプレフィクスリストによるルートフィルタの設定ミスについて、切り分けと修正を行います。

ネットワーク構成

下記のネットワーク構成で、AS123はAS4とAS5内の特定のネットワークのパケットをルーティングできるようにします。

図 BGP 設定ミスの切り分けと修正 Part3
図 BGP 設定ミスの切り分けと修正 Part3

AS123内ではコンフェデレーションを利用しています。R1、R2、R3がそれぞれコンフェデレーションASを構成しています。また、R1、R3のOutでプレフィクスリストによるルートフィルタを行っています。R1はAS5内の5.5.1.0/24、5.5.3.0/24のルートをdenyします。R3はAS4内の4.4.0.0/24、4.4.2.0/24のルートをdenyします。

設定概要

各ルータのBGPに関する設定は次の通りです。これらの設定には、一部設定ミスがあります。

R1

interface Loopback0
 ip address 192.168.0.1 255.255.255.255
!
interface Ethernet0/0
 ip address 172.16.14.1 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.12.1 255.255.255.0
!
router ospf 1
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0
!
router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 bgp confederation identifier 123
 bgp confederation peers 65002
 neighbor 172.16.14.4 remote-as 4
 neighbor 172.16.14.4 prefix-list AS5 out
 neighbor 192.168.0.2 remote-as 65002
 neighbor 192.168.0.2 ebgp-multihop 255
 neighbor 192.168.0.2 update-source Loopback0
 neighbor 192.168.0.2 next-hop-self
 no auto-summary
!
ip prefix-list AS5 seq 5 deny 5.5.1.0/24
ip prefix-list AS5 seq 10 deny 5.5.3.0/24
ip prefix-list AS5 seq 15 permit 0.0.0.0/0

R2

interface Loopback0
 ip address 192.168.0.2 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.12.2 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.23.2 255.255.255.0
!
router ospf 1
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0
!
router bgp 65002
 no synchronization
 bgp log-neighbor-changes
 bgp confederation identifier 123
 bgp confederation peers 65001 65003
 neighbor 192.168.0.1 remote-as 65001
 neighbor 192.168.0.1 ebgp-multihop 255
 neighbor 192.168.0.1 update-source Loopback0
 neighbor 192.168.0.3 remote-as 65003
 neighbor 192.168.0.3 ebgp-multihop 255
 neighbor 192.168.0.3 update-source Loopback0
 no auto-summary

R3

interface Loopback0
 ip address 192.168.0.3 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.23.3 255.255.255.0
!
interface Ethernet0/1
 ip address 172.16.35.3 255.255.255.0
!
router ospf 1
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0
!
router bgp 65003
 no synchronization
 bgp log-neighbor-changes
 bgp confederation identifier 123
 neighbor 172.16.35.5 remote-as 5
 neighbor 172.16.35.5 prefix-list AS4 out
 neighbor 192.168.0.2 remote-as 65002
 neighbor 192.168.0.2 ebgp-multihop 255
 neighbor 192.168.0.2 update-source Loopback0
 neighbor 192.168.0.2 next-hop-self
 no auto-summary
!
ip prefix-list AS4 seq 5 deny 4.4.0.0/24
ip prefix-list AS4 seq 10 deny 4.4.2.0/24
ip prefix-list AS4 seq 15 permit 0.0.0.0/0 le 32

R4

interface Loopback0
 ip address 4.4.1.4 255.255.255.0 secondary
 ip address 4.4.2.4 255.255.255.0 secondary
 ip address 4.4.3.4 255.255.255.0 secondary
 ip address 4.4.0.4 255.255.255.0
!
interface Ethernet0/0
 ip address 172.16.14.4 255.255.255.0
!
router bgp 4
 no synchronization
 bgp log-neighbor-changes
 network 4.4.0.0 mask 255.255.255.0
 network 4.4.1.0 mask 255.255.255.0
 network 4.4.2.0 mask 255.255.255.0
 network 4.4.3.0 mask 255.255.255.0
 neighbor 172.16.14.1 remote-as 123
 no auto-summary

R5

interface Loopback0
 ip address 5.5.1.5 255.255.255.0 secondary
 ip address 5.5.2.5 255.255.255.0 secondary
 ip address 5.5.3.5 255.255.255.0 secondary
 ip address 5.5.0.5 255.255.255.0
!
interface Ethernet0/0
 ip address 172.16.35.5 255.255.255.0
!
router bgp 5
 no synchronization
 bgp log-neighbor-changes
 network 5.5.0.0 mask 255.255.255.0
 network 5.5.1.0 mask 255.255.255.0
 network 5.5.2.0 mask 255.255.255.0
 network 5.5.3.0 mask 255.255.255.0
 neighbor 172.16.35.3 remote-as 123
 no auto-summary

トラブルの症状

現在の設定では、意図したとおりにAS4、AS5間の通信をAS123経由で行うことができません。R4、R5でBGPテーブルを確認すると、次のようになっています。

R4 show ip bgp

R4#show ip bgp
BGP table version is 9, local router ID is 4.4.0.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.0.0/24       0.0.0.0                  0         32768 i
*> 4.4.1.0/24       0.0.0.0                  0         32768 i
*> 4.4.2.0/24       0.0.0.0                  0         32768 i
*> 4.4.3.0/24       0.0.0.0                  0         32768 i

R5 show ip bgp

R5#show ip bgp
BGP table version is 9, local router ID is 5.5.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.1.0/24       172.16.35.3                            0 123 65002 4 i
*> 4.4.3.0/24       172.16.35.3                            0 123 65002 4 i
*> 5.5.0.0/24       0.0.0.0                  0         32768 i
*> 5.5.1.0/24       0.0.0.0                  0         32768 i
*> 5.5.2.0/24       0.0.0.0                  0         32768 i
*> 5.5.3.0/24       0.0.0.0                  0         32768 i

R4とR5のBGPテーブルを確認すると、R4にはAS5内のルートが届いていません。R5にはAS4内のルート4.4.1.0/24、4.4.3.0/24が届いていますが、AS_PATHが不正です。本来、コンフェデレーションASのAS番号は外のASから見えないはずですが、AS_PATHにコンフェデレーションASの65002が含まれてしまっています。

R4、R5の設定には間違いがないことがわかっています。そこで、R1、R2、R3で切り分けのために、次のshowコマンドを実行しました。

R1/R3
show ip protocols
show ip bgp summary
show ip bgp
show ip prefix-list

R2
show ip protocols
show ip bgp summary
show ip bgp

R1 showコマンドの結果

R1#show ip protocols
Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 192.168.0.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.0.0 0.0.255.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.0.2          110      00:44:16
    192.168.0.3          110      00:44:16
  Distance: (default is 110)
 
Routing Protocol is "bgp 65001"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  BGP confederation consists of ASs: 65002
 
  BGP confederation advertised as AS 123
  IGP synchronization is disabled
  Automatic route summarization is disabled
  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    172.16.14.4
    192.168.0.2
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.0.2          200      00:35:16
    172.16.14.4           20      00:40:24
  Distance: external 20 internal 200 local 200
 
R1#show ip bgp summary
BGP router identifier 192.168.0.1, local AS number 65001
BGP table version is 13, main routing table version 13
4 network entries using 468 bytes of memory
4 path entries using 208 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 948 total bytes of memory
BGP activity 8/4 prefixes, 8/4 paths, scan interval 60 secs
 
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.14.4     4     4      46      47       13    0    0 00:40:58        4
192.168.0.2     4 65002      56      52       13    0    0 00:45:55        0
R1#show ip bgp
BGP table version is 13, local router ID is 192.168.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.0.0/24       172.16.14.4              0             0 4 i
*> 4.4.1.0/24       172.16.14.4              0             0 4 i
*> 4.4.2.0/24       172.16.14.4              0             0 4 i
*> 4.4.3.0/24       172.16.14.4              0             0 4 i
R1#show ip prefix-list
ip prefix-list AS5: 3 entries
   seq 5 deny 5.5.1.0/24
   seq 10 deny 5.5.3.0/24
   seq 15 permit 0.0.0.0/0

R2 showコマンドの結果

R2#show ip protocols
Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 192.168.0.2
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.0.0 0.0.255.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.0.1          110      00:44:48
    192.168.0.3          110      00:44:48
  Distance: (default is 110)
 
Routing Protocol is "bgp 65002"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  BGP confederation consists of ASs: 65001 65003
 
  BGP confederation advertised as AS 123
  IGP synchronization is disabled
  Automatic route summarization is disabled
  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    192.168.0.1
    192.168.0.3
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.0.1          200      00:40:56
    192.168.0.3          200      00:35:48
  Distance: external 20 internal 200 local 200
 
R2#show ip bgp summary
BGP router identifier 192.168.0.2, local AS number 65002
BGP table version is 13, main routing table version 13
4 network entries using 468 bytes of memory
4 path entries using 208 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 948 total bytes of memory
BGP activity 8/4 prefixes, 8/4 paths, scan interval 60 secs
 
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.0.1     4 65001      53      57       13    0    0 00:46:27        4
192.168.0.3     4 65003      53      57       13    0    0 00:44:02        0
R2#show ip bgp
BGP table version is 13, local router ID is 192.168.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.0.0/24       192.168.0.1              0    100      0 (65001) 4 i
*> 4.4.1.0/24       192.168.0.1              0    100      0 (65001) 4 i
*> 4.4.2.0/24       192.168.0.1              0    100      0 (65001) 4 i
*> 4.4.3.0/24       192.168.0.1              0    100      0 (65001) 4 i

R3 showコマンドの結果

R3#show ip protocols
Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 192.168.0.3
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    192.168.0.0 0.0.255.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.0.1          110      00:45:24
    192.168.0.2          110      00:45:24
  Distance: (default is 110)
 
Routing Protocol is "bgp 65003"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  BGP confederation advertised as AS 123
  IGP synchronization is disabled
  Automatic route summarization is disabled
  Neighbor(s):
    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap
    172.16.35.5
    192.168.0.2
  Maximum path: 1
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.0.2          200      00:34:43
    172.16.35.5           20      00:36:24
  Distance: external 20 internal 200 local 200
 
R3#show ip bgp summary
BGP router identifier 192.168.0.3, local AS number 65003
BGP table version is 13, main routing table version 13
8 network entries using 936 bytes of memory
8 path entries using 416 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
2 BGP AS-PATH entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1772 total bytes of memory
BGP activity 8/0 prefixes, 8/0 paths, scan interval 60 secs
 
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.35.5     4     5      46      46       13    0    0 00:38:20        4
192.168.0.2     4 65002      57      53       13    0    0 00:44:38        4
R3#show ip bgp
BGP table version is 13, local router ID is 192.168.0.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.0.0/24       192.168.0.1              0             0 65002 4 i
*> 4.4.1.0/24       192.168.0.1              0             0 65002 4 i
*> 4.4.2.0/24       192.168.0.1              0             0 65002 4 i
*> 4.4.3.0/24       192.168.0.1              0             0 65002 4 i
*> 5.5.0.0/24       172.16.35.5              0             0 5 i
*> 5.5.1.0/24       172.16.35.5              0             0 5 i
*> 5.5.2.0/24       172.16.35.5              0             0 5 i
*> 5.5.3.0/24       172.16.35.5              0             0 5 i
R3#show ip prefix-list
ip prefix-list AS4: 3 entries
   seq 5 deny 4.4.0.0/24
   seq 10 deny 4.4.2.0/24
   seq 15 permit 0.0.0.0/0 le 32

問題

  • なぜ外のASにコンフェデレーションASのAS番号が漏れてしまっているのですか?また、なぜAS4にAS5のルートが正しく伝わっていないのですか?
  • 上記の問題を解消するためには、どのように設定を修正すればよいですか?ただし、ルートのフィルタ方法や方向を変更してはいけません。

解答

なぜ外のASにコンフェデレーションASのAS番号が漏れてしまっているのですか?また、なぜAS4にAS5のルートが正しく伝わっていないのですか?

R3でbgp confederation peersの設定が抜けているため、IEBGPネイバーR2のコンフェデレーションASを正しく認識できていない。そのため、外部ASにルートをアドバタイズするときに削除するべきコンフェデレーションAS 65002を削除していない。また、R3はR2を通常のEBGPネイバーと扱ってしまうため、R3からR2にルートをアドバタイズするときにAS123をプリペンドする。その結果、R2はAS番号が重複しているものとしてルートを破棄する。

さらに、R1でのプレフィクスリストの最後のエントリが間違っている。すべてのルートを許可するエントリではなくデフォルトルート「0.0.0.0/0」だけを許可するエントリとなっている。

上記の問題を解消するためには、どのように設定を修正すればよいですか?ただし、ルートのフィルタ方法や方向を変更してはいけません。

R1

no ip prefix-list AS5 
ip prefix-list AS5 seq 5 deny 5.5.1.0/24
ip prefix-list AS5 seq 10 deny 5.5.3.0/24
ip prefix-list AS5 seq 15 permit 0.0.0.0/0 le 32

R3

router bgp 65003
 bgp confederation peers 65002

ワンポイント

  • bgp confederation peersコマンドでIEBGPネイバーのコンフェデレーションASを指定する
  • プレフィクスリストですべてpermitのエントリは「permit 0.0.0.0/0 le 32」

解説

コンフェデレーションとプレフィクスリストのよくありがちな設定ミスについてです。コンフェデレーションとプレフィクスリストの設定ミスによって、問題にしている症状が引き起こされています。それぞれの設定ミスについて具体的に見ていきましょう。

【コンフェデレーションの設定ミス】

コンフェデレーションは1つのASを複数のコンフェデレーションASに分割します。これにより、IBGPネイバーのフルメッシュの必要性を緩和します。コンフェデレーションAS間のネイバーはIEBGPネイバーとなり、コンフェデレーションAS番号はAS_PATH上では( )にリストされます。また、通常のEBGPネイバーにBGPルートをアドバタイズするときには( )内のコンフェデレーションASを本来のAS番号に置き換えます。

コンフェデレーションの設定では、本来のAS番号とIEBGPネイバーのコンフェデレーションAS番号を設定しなければいけません。そのためのコマンドは次の通りです。

  • bgp confederation identifier
    本来のAS番号を指定します。
  • bgp confederation peers
    IEBGPネイバーのコンフェデレーションAS番号をリストします。

R1ではどちらも正しく設定しているのですが、R3ではbgp confederation peersの設定が抜けています。

R3ではbgp confederation peers 65002の設定をしたあと、その設定を削除してBGPルートの再送信を行っています。はじめからbgp confederation peersの設定が抜けているとR2とR3間のネイバーを確立できません。

そのため、R3はR2を通常のEBGPネイバーとして扱いします。そして、R3からR5へルートをアドバタイズするときに、削除しなければいけないコンフェデレーションAS番号がそのままになってしまっています。また、R3からR2へルートをアドバタイズするとき通常のEBGPネイバー扱いなので本来のAS番号123をプリペンドします。R2はAS_PATHにAS123が含まれていると、ループしているものとみなしてルートを破棄してしまいます。これを解決するためには、R3で次のように設定します。

R3

router bgp 65003
 bgp confederation peers 65002

R3でこの設定をしたあと、clear ip bgp * inでR2からBGPアップデートを再度受信します。そして、R5でBGPテーブルを見ると、コンフェデレーションASが正しく削除されて、本来のAS123がAS_PATHにリストされていることがわかります。

R5 show ip bgp

R5#show ip bgp
BGP table version is 17, local router ID is 5.5.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.1.0/24       172.16.35.3                            0 123 4 i
*> 4.4.3.0/24       172.16.35.3                            0 123 4 i
*> 5.5.0.0/24       0.0.0.0                  0         32768 i
*> 5.5.1.0/24       0.0.0.0                  0         32768 i
*> 5.5.2.0/24       0.0.0.0                  0         32768 i
*> 5.5.3.0/24       0.0.0.0                  0         32768 i

また、R2でもR3からのルートを正常に受信できるようになっていることがわかります。

R2 show ip bgp

R2#show ip bgp
BGP table version is 25, local router ID is 192.168.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.0.0/24       192.168.0.1              0    100      0 (65001) 4 i
*> 4.4.1.0/24       192.168.0.1              0    100      0 (65001) 4 i
*> 4.4.2.0/24       192.168.0.1              0    100      0 (65001) 4 i
*> 4.4.3.0/24       192.168.0.1              0    100      0 (65001) 4 i
*> 5.5.0.0/24       192.168.0.3              0    100      0 (65003) 5 i
*> 5.5.1.0/24       192.168.0.3              0    100      0 (65003) 5 i
*> 5.5.2.0/24       192.168.0.3              0    100      0 (65003) 5 i
*> 5.5.3.0/24       192.168.0.3              0    100      0 (65003) 5 i


コンフェデレーションの設定について、以下の記事を参照してください。


【プレフィクスリストの設定ミス】

プレフィクスリストにもアクセスリストと同じく「暗黙のdeny」があります。そのため、プレフィクスリストでdenyだけのエントリだと暗黙のdenyによって結局すべてのルートがdenyされてしまいます。暗黙のdenyを回避するためのエントリが必要です。ここで注意するべきポイントがプレフィクスリストでのanyの表現方法です。すべてのプレフィクスを表すのは、「0.0.0.0/0 le 32」です。

ところがR1では、プレフィクスリストの最後のエントリが「permit 0.0.0.0/0」となってしまっています。これでは、デフォルトルート(0.0.0.0/0)のみpermitされることになります。そのため、R1からR4へは一切ルートがアドバタイズされなくなってしまいます。R1で、次のようにプレフィクスリストを修正します。

R1

no ip prefix-list AS5 
ip prefix-list AS5 seq 5 deny 5.5.1.0/24
ip prefix-list AS5 seq 10 deny 5.5.3.0/24
ip prefix-list AS5 seq 15 permit 0.0.0.0/0 le 32

その後、R1からBGPルートを再送信してR4のBGPテーブルを確認すると、次のようになります。

R4 show ip bgp

R4#show ip bgp
BGP table version is 11, local router ID is 4.4.0.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
 
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.0.0/24       0.0.0.0                  0         32768 i
*> 4.4.1.0/24       0.0.0.0                  0         32768 i
*> 4.4.2.0/24       0.0.0.0                  0         32768 i
*> 4.4.3.0/24       0.0.0.0                  0         32768 i
*> 5.5.0.0/24       172.16.14.1                            0 123 5 i
*> 5.5.2.0/24       172.16.14.1                            0 123 5 i


プレフィクスリストの設定について、以下の記事を参照してください。


【まとめ】

次の図は、今回のトラブルのコンフェデレーションとプレフィクスリストの設定ミスについてまとめたものです。

図 BGP 設定ミスの切り分けと修正 Part3 設定ミスのまとめ
図 BGP 設定ミスの切り分けと修正 Part3 設定ミスのまとめ


BGPの仕組み