DynagenでCCIEを目指す
20100619 BGP プレフィックス数の制限
最終更新:
it_certification
-
view
目的
- BGPにおけるエントリ数を制限する方法を確認します。
- 設定ミス等でエントリ数増大によるメモリ枯渇を防止する方法を確認します。
構成
- 設定概要
- 初期設定はip addressのみです
- 構成図

- netファイル
model = 3620 [localhost] [[3620]] image = C:\Program Files\Dynamips\images\c3620-j1s3-mz.123-18.bin ram = 128 [[ROUTER R1]] f0/0 = R2 f0/0 [[ROUTER R2]]
- 初期設定 R1
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface FastEthernet0/0 ip address 192.168.12.1 255.255.255.0 duplex auto speed auto ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- 初期設定 R2
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R2 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface FastEthernet0/0 ip address 192.168.12.2 255.255.255.0 duplex auto speed auto ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
検証1 環境構築
- BGP neighborの設定
R1(config)#router bgp 1 R1(config-router)#neighbor 192.168.12.2 remote-as 2 R2(config)#router bgp 2 R2(config-router)#neighbor 192.168.12.1 remote-as 1
- BGP neighborの確認
BGP neighborが確立された事を確認します。
R1#show ip bgp summary <- State/PfxRcdに数値が記入されている場合は、neighborが確立されたと判断できます。 BGP router identifier 1.1.1.1, local AS number 1 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.168.12.2 4 2 4 4 1 0 0 00:00:31 0 R1#
検証2 maximum-prefixによる警告
- maximum-prefix
ルータが受信できるBGPのプレフィックス数を制限します。
R2(config)#router bgp 2 R2(config-router)#neighbor 192.168.12.1 maximum-prefix 4
- ルートの生成
R1でルートを生成し、そのルートをR2に通知します。
R1(config)#interface Loopback 0 R1(config-if)#ip address 172.16.0.1 255.255.255.0 secondary R1(config-if)#ip address 172.16.1.1 255.255.255.0 secondary R1(config-if)#ip address 172.16.2.1 255.255.255.0 secondary R1(config-if)#ip address 172.16.3.1 255.255.255.0 secondary R1(config-if)#exit R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#network 172.168.0.0 mask 255.255.255.0 R1(config-router)#network 172.168.1.0 mask 255.255.255.0 R1(config-router)#network 172.168.2.0 mask 255.255.255.0 R1(config-router)#network 172.168.3.0 mask 255.255.255.0
- 警告メッセージの確認
maximum-prefixはデフォルトで、制限数の75%を超えると警告のメッセージを発生させます。現在のR2は最大4つまでのプレフィックスを扱えますので、警告メッセージはプレフィックスが3つを超えた場合に発生します。
R2# *Mar 1 00:11:09.423: %BGP-4-MAXPFX: No. of prefix received from 192.168.12.1 (afi 0) reaches 4, max 4
検証3 maximum-prefixによるneighbor断
- ルートの生成
R1でルートを生成し、そのルートをR2に通知します。
R1(config)#interface Loopback 0 R1(config-if)#ip address 172.16.4.1 255.255.255.0 secondary R1(config-if)#exit R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#network 172.168.4.0 mask 255.255.255.0
- エラーメッセージの確認
プレフィックスが制限数を超過した場合は、NOTIFICATIONというメッセージを送信しneighborを意図的に切断します。
R2# *Mar 1 00:14:31.255: %BGP-5-ADJCHANGE: neighbor 192.168.12.1 Down BGP Notification sent *Mar 1 00:14:31.255: %BGP-3-NOTIFICATION: sent to neighbor 192.168.12.1 3/1 (update malformed) 0 bytes FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0034 0200 0000 1940 0101 0040 0204 0201 0001 4003 04C0 A80C 0180 0404 0000 0000 18AC 1004
- パケットキャプチャによる確認
172.168.4.0/24のプレフィックスを送信したupdateメッセージの直後に、notificationメッセージでneighborを切断している様子が読み取れます。

- neighborの状態確認
プレフィックス数超過によるneighbor断が生じた場合のneihgborの状態を確認します。R2はIdle (PfxCt)という特殊な表記になっている事が確認できます。
R2#show ip bgp summary BGP router identifier 2.2.2.2, local AS number 2 BGP table version is 9, main routing table version 9 5 network entries using 505 bytes of memory 0 path entries using 0 bytes of memory 0 BGP path attribute entries using 60 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 589 total bytes of memory BGP activity 5/0 prefixes, 5/5 paths, scan interval 60 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.168.12.1 4 1 20 17 0 0 0 00:00:41 Idle (PfxCt) R2# R1#show ip bgp summary BGP router identifier 1.1.1.1, local AS number 1 BGP table version is 6, main routing table version 6 5 network entries using 505 bytes of memory 5 path entries using 240 bytes of memory 1 BGP path attribute entries using 60 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 805 total bytes of memory BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.168.12.2 4 2 17 20 0 0 0 00:01:34 Active R1#
検証4 warning-onlyオプション
- warning-onlyオプション
warning-onlyを付加すると、プレフィックス数超過の状態になってもneighbor断せずに警告メッセージを生成するようになります。
R2(config)#router bgp 2 R2(config-router)#neighbor 192.168.12.1 maximum-prefix 4 warning-only R2(config-router)#^Z R2# *Mar 1 00:34:28.683: %SYS-5-CONFIG_I: Configured from console by console R2#clear ip bgp * R2# R2# *Mar 1 00:36:31.955: %BGP-5-ADJCHANGE: neighbor 192.168.12.1 Up *Mar 1 00:36:32.107: %BGP-4-MAXPFX: No. of prefix received from 192.168.12.1 (afi 0) reaches 4, max 4 *Mar 1 00:36:32.111: %BGP-3-MAXPFXEXCEED: No. of prefix received from 192.168.12.1 (afi 0): 5 exceed limit 4 R2#