DynagenでCCIEを目指す
20100617 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 f1/0 = R3 f1/0 [[ROUTER R2]] [[ROUTER R3]]
- 初期設定 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 ! interface FastEthernet1/0 ip address 192.168.13.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
- 初期設定 R3
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface FastEthernet1/0 ip address 192.168.13.3 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の設定
BGP neighborの設定を行います。
R1(config)#router bgp 1 R1(config-router)#neighbor 192.168.12.2 remote-as 2 R1(config-router)#neighbor 192.168.13.3 remote-as 3 R1(config-router)#network 1.1.1.1 mask 255.255.255.255 R2(config)#router bgp 2 R2(config-router)#neighbor 192.168.12.1 remote-as 1 2(config-router)#network 2.2.2.2 mask 255.255.255.255 R3(config)#router bgp 3 R3(config-router)#neighbor 192.168.13.1 remote-as 1 R3(config-router)#network 3.3.3.3 mask 255.255.255.255
- BGP neighborの確認
BGPテーブルなどから、eBGP neighborが確立され経路が交換された事を確認します。
R1#show ip bgp BGP table version is 4, local router ID is 1.1.1.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 *> 1.1.1.1/32 0.0.0.0 0 32768 i *> 2.2.2.2/32 192.168.12.2 0 0 2 i *> 3.3.3.3/32 192.168.13.3 0 0 3 i R1#
- ネットワークの再現
R1に接続されているネットワークを再現します。再現したルートはBGPで他のルータに通知します。
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.16.0.0 mask 255.255.255.0 R1(config-router)#network 172.16.1.0 mask 255.255.255.0 R1(config-router)#network 172.16.2.0 mask 255.255.255.0 R1(config-router)#network 172.16.3.0 mask 255.255.255.0
- 再現したネットワークの確認
再現したネットワークがR2, R3に伝わっている事を確認します。
R2#show ip bgp BGP table version is 8, local router ID is 2.2.2.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 *> 1.1.1.1/32 192.168.12.1 0 0 1 i *> 2.2.2.2/32 0.0.0.0 0 32768 i *> 3.3.3.3/32 192.168.12.1 0 1 3 i *> 172.16.0.0/24 192.168.12.1 0 0 1 i *> 172.16.1.0/24 192.168.12.1 0 0 1 i *> 172.16.2.0/24 192.168.12.1 0 0 1 i *> 172.16.3.0/24 192.168.12.1 0 0 1 i R2#
検証2 経路集約の設定
- 経路集約の設定
経路集約の設定をR1に投入します。
R1(config)#router bgp 1 R1(config-router)#aggregate-address 172.16.0.0 255.255.252.0
- 経路の確認
集約したルートがどのように通知されるのかを確認します。集約前のルートが全て通知されている事を確認します。
R2#show ip bgp BGP table version is 9, local router ID is 2.2.2.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 *> 1.1.1.1/32 192.168.12.1 0 0 1 i *> 2.2.2.2/32 0.0.0.0 0 32768 i *> 3.3.3.3/32 192.168.12.1 0 1 3 i *> 172.16.0.0/24 192.168.12.1 0 0 1 i <- 集約前のルート *> 172.16.0.0/22 192.168.12.1 0 0 1 i *> 172.16.1.0/24 192.168.12.1 0 0 1 i <- 集約前のルート *> 172.16.2.0/24 192.168.12.1 0 0 1 i <- 集約前のルート *> 172.16.3.0/24 192.168.12.1 0 0 1 i <- 集約前のルート R2#
検証3 suppress-map
- suppress-mapの設定
suppress-mapによって、集約前のルートを通知するかどうかを定義します。紛らわしい仕様ですが、route-mapで許可されたルートが拒否される仕様になっています。
「suppressは“抑制する”の意なので、route-mapで拒否したいルートを定義する」と覚えれば、自然に頭に入ると思います。
「suppressは“抑制する”の意なので、route-mapで拒否したいルートを定義する」と覚えれば、自然に頭に入ると思います。
R1(config)#ip prefix-list SUPP_LIST seq 10 permit 172.16.0.0/24 R1(config)#ip prefix-list SUPP_LIST seq 20 permit 172.16.1.0/24 R1(config)# R1(config)#route-map SUPP_MAP permit 10 R1(config-route-map)#match ip address prefix-list SUPP_LIST R1(config-route-map)#exit R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#aggregate-address 172.16.0.0 255.255.252.0 suppress-map SUPP-MAP
- 抑制されたルートの確認
172.16.0.0/24および172.16.1.0/24が通知されなくなった事を確認します。
R2#show ip bgp BGP table version is 29, local router ID is 2.2.2.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 *> 1.1.1.1/32 192.168.12.1 0 0 1 i *> 2.2.2.2/32 0.0.0.0 0 32768 i *> 3.3.3.3/32 192.168.12.1 0 1 3 i *> 172.16.0.0/22 192.168.12.1 0 0 1 i *> 172.16.2.0/24 192.168.12.1 0 0 1 i *> 172.16.3.0/24 192.168.12.1 0 0 1 i R2#
検証4 unsuppress-map
- unsuppress-mapの設定
unsuppress-mapによって、“抑制しない”経路を定義します。紛らわしい仕様ですが、route-mapで許可されたルートが通知される仕様になります。また、suppress-mapと異なり、neighbor毎の設定が可能です。
R1(config)#ip prefix-list UNSUPP_R2_LIST seq 10 permit 172.16.0.0/24 R1(config)#ip prefix-list UNSUPP_R2_LIST seq 20 permit 172.16.3.0/24 R1(config)# R1(config)#ip prefix-list UNSUPP_R3_LIST seq 10 permit 172.16.1.0/24 R1(config)#ip prefix-list UNSUPP_R3_LIST seq 20 permit 172.16.2.0/24 R1(config)# R1(config)# R1(config)#route-map UNSUPP_R2_MAP permit 10 R1(config-route-map)#match ip address prefix-list UNSUPP_R2_LIST R1(config-route-map)#exit R1(config)# R1(config)#route-map UNSUPP_R3_MAP permit 10 R1(config-route-map)#match ip address prefix-list UNSUPP_R3_LIST R1(config-route-map)#exit R1(config)# R1(config)#router bgp 1 R1(config-router)#neighbor 192.168.12.2 unsuppress-map UNSUPP_R2_MAP R1(config-router)#neighbor 192.168.13.3 unsuppress-map UNSUPP_R3_MAP
- 経路の確認
unsuppress-mapは“抑制しない”経路の定義ですので、必ずsummary-onlyによって経路を“抑制”した後に使用します。そうしないと全ての経路が通知されてしまいます。
現在の状態ではsummary-onlyが投入されていないので、unsuppress-mapが効いていません。
現在の状態ではsummary-onlyが投入されていないので、unsuppress-mapが効いていません。
R2#show ip bgp BGP table version is 29, local router ID is 2.2.2.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 *> 1.1.1.1/32 192.168.12.1 0 0 1 i *> 2.2.2.2/32 0.0.0.0 0 32768 i *> 3.3.3.3/32 192.168.12.1 0 1 3 i *> 172.16.0.0/22 192.168.12.1 0 0 1 i *> 172.16.2.0/24 192.168.12.1 0 0 1 i *> 172.16.3.0/24 192.168.12.1 0 0 1 i R2# R3#show ip bgp BGP table version is 29, local router ID is 3.3.3.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 *> 1.1.1.1/32 192.168.13.1 0 0 1 i *> 2.2.2.2/32 192.168.13.1 0 1 2 i *> 3.3.3.3/32 0.0.0.0 0 32768 i *> 172.16.0.0/22 192.168.13.1 0 0 1 i *> 172.16.2.0/24 192.168.13.1 0 0 1 i *> 172.16.3.0/24 192.168.13.1 0 0 1 i R3#
- summary-onlyの投入
R1で経路集約する際にsummary-onlyのオプションを付加します。
R1(config)#router bgp 1 R1(config-router)#aggregate-address 172.16.0.0 255.255.252.0 summary-only R1(config-router)#do show run | b ^router bgp router bgp 1 no synchronization bgp log-neighbor-changes network 1.1.1.1 mask 255.255.255.255 network 172.16.0.0 mask 255.255.255.0 network 172.16.1.0 mask 255.255.255.0 network 172.16.2.0 mask 255.255.255.0 network 172.16.3.0 mask 255.255.255.0 aggregate-address 172.16.0.0 255.255.252.0 summary-only neighbor 192.168.12.2 remote-as 2 neighbor 192.168.12.2 unsuppress-map UNSUPP_R2_MAP neighbor 192.168.13.3 remote-as 3 neighbor 192.168.13.3 unsuppress-map UNSUPP_R3_MAP no auto-summary !
- 経路の再確認
summayr-only投入後は、unsuppress-mapの設定が反映されている事が確認できます。
R2#show ip bgp BGP table version is 31, local router ID is 2.2.2.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 *> 1.1.1.1/32 192.168.12.1 0 0 1 i *> 2.2.2.2/32 0.0.0.0 0 32768 i *> 3.3.3.3/32 192.168.12.1 0 1 3 i *> 172.16.0.0/24 192.168.12.1 0 0 1 i *> 172.16.0.0/22 192.168.12.1 0 0 1 i *> 172.16.3.0/24 192.168.12.1 0 0 1 i R2# R3#show ip bgp BGP table version is 31, local router ID is 3.3.3.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 *> 1.1.1.1/32 192.168.13.1 0 0 1 i *> 2.2.2.2/32 192.168.13.1 0 1 2 i *> 3.3.3.3/32 0.0.0.0 0 32768 i *> 172.16.0.0/22 192.168.13.1 0 0 1 i *> 172.16.1.0/24 192.168.13.1 0 0 1 i *> 172.16.2.0/24 192.168.13.1 0 0 1 i R3#
添付ファイル