DynagenでCCIEを目指す
20100615 BGP 経路集約 基本設定
最終更新:
it_certification
-
view
目的
- BGPにおける経路集約の基本的な設定方法を確認します。
構成
- 設定概要
- R1, R2の間はEIGRPによってルーティングします。
- 構成図

- 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]] f1/0 = ISP10 f1/0 [[ROUTER ISP10]]
- 初期設定 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 172.17.0.1 255.255.255.0 secondary ip address 172.17.1.1 255.255.255.0 secondary ip address 172.17.2.1 255.255.255.0 secondary ip address 172.17.3.1 255.255.255.0 secondary ip address 172.18.0.1 255.255.255.0 secondary ip address 172.18.1.1 255.255.255.0 secondary ip address 172.18.2.1 255.255.255.0 secondary ip address 172.18.3.1 255.255.255.0 secondary 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 ! router eigrp 1 network 172.17.0.0 network 172.18.0.0 network 192.168.12.0 no auto-summary ! 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 172.16.0.2 255.255.255.0 secondary ip address 172.16.1.2 255.255.255.0 secondary ip address 172.16.2.2 255.255.255.0 secondary ip address 172.16.3.2 255.255.255.0 secondary 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 ! interface FastEthernet1/0 ip address 192.168.100.2 255.255.255.0 duplex auto speed auto ! router eigrp 1 network 192.168.12.0 auto-summary ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- 初期設定 ISP10
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname ISP10 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 10.10.10.10 255.255.255.255 ! interface FastEthernet1/0 ip address 192.168.100.10 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 1 R2(config)#router bgp 1 R2(config-router)#neighbor 192.168.12.1 remote-as 1 R2(config-router)#neighbor 192.168.12.1 next-hop-self R2(config-router)#neighbor 192.168.100.10 remote-as 2 ISP10(config)#router bgp 2 ISP10(config-router)#neighbor 192.168.100.2 remote-as 1 ISP10(config-router)#network 10.10.10.10 mask 255.255.255.255
- ルーティングの確認
上記で設定したBGPによってルートが交換できているかを確認します。
R1#show ip route bgp 10.0.0.0/32 is subnetted, 1 subnets B 10.10.10.10 [200/0] via 192.168.12.2, 00:02:21 R1#
検証2 自動集約による経路集約
- 自動集約による経路集約
R2に直接つながっているルートをBGPに再配送し、そのルートを自動集約します。
R2(config)#router bgp 1 R2(config-router)#redistribute connected R2(config-router)#auto-summary
- 自動集約の確認
自動集約を行った場合は、メジャーネットの境界で集約されます。172.16.X.0/24を集約した場合は、172.16.0.0/16になります。自動集約された事はISP10のBGPテーブルから確認できます。
ISP10#show ip bgp BGP table version is 7, local router ID is 10.10.10.10 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 *> 2.0.0.0 192.168.100.2 0 0 1 ? *> 10.10.10.10/32 0.0.0.0 0 32768 i *> 172.16.0.0 192.168.100.2 0 0 1 ? *> 192.168.12.0 192.168.100.2 0 0 1 ? r> 192.168.100.0 192.168.100.2 0 0 1 ? ISP10# ISP10# ISP10#show ip bgp 172.16.0.0 BGP routing table entry for 172.16.0.0/16, version 4 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 1 192.168.100.2 from 192.168.100.2 (2.2.2.2) Origin incomplete, metric 0, localpref 100, valid, external, best ISP10#
- 設定削除
検証2で投入した設定を削除し、削除された事をISP10のBGPテーブルから確認します。
R2(config)#router bgp 1 R2(config-router)#no auto-summary R2(config-router)#no redistribute connected R2(config-router)#^Z R2# *Mar 1 00:23:08.143: %SYS-5-CONFIG_I: Configured from console by console R2#clear ip bgp 192.168.100.10 out R2# ISP10#show ip bgp BGP table version is 11, local router ID is 10.10.10.10 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 *> 10.10.10.10/32 0.0.0.0 0 32768 i ISP10#
検証3 networkコマンドによる集約
- static routeの設定
networkコマンドを用いた経路集約の方法を確認します。
networkコマンドで指定した経路がBGP neighborに伝わる前提条件として、「BGPによって伝えたい経路がルーティングテーブルに載っている事」が挙げられます。
集約したいルートをルーティングテーブルに載せます。ここではルーティングループを防止するために、宛先はNull 0にします。
networkコマンドで指定した経路がBGP neighborに伝わる前提条件として、「BGPによって伝えたい経路がルーティングテーブルに載っている事」が挙げられます。
集約したいルートをルーティングテーブルに載せます。ここではルーティングループを防止するために、宛先はNull 0にします。
R2(config)#ip route 172.17.0.0 255.255.0.0 Null 0 R2(config)# R2(config)# R2(config)#do show ip route | i 172.17 172.17.0.0/16 is variably subnetted, 5 subnets, 2 masks D 172.17.1.0/24 [90/156160] via 192.168.12.1, 00:32:38, FastEthernet0/0 D 172.17.0.0/24 [90/156160] via 192.168.12.1, 00:32:38, FastEthernet0/0 S 172.17.0.0/16 is directly connected, Null0 <- 集約したいルートがある事を確認します D 172.17.3.0/24 [90/156160] via 192.168.12.1, 00:32:38, FastEthernet0/0 D 172.17.2.0/24 [90/156160] via 192.168.12.1, 00:32:38, FastEthernet0/0 R2(config)#
- networkコマンドの投入
集約したいルートをnetworkコマンドを用いて指定します。
R2(config)#router bgp 1 R2(config-router)#network 172.17.0.0 mask 255.255.0.0
- ルーティングの確認
集約されたルートがISP10に伝わった事を確認します。
ISP10#show ip bgp BGP table version is 12, local router ID is 10.10.10.10 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 *> 10.10.10.10/32 0.0.0.0 0 32768 i *> 172.17.0.0 192.168.100.2 0 0 1 i ISP10# ISP10# ISP10#show ip bgp 172.17.0.0 BGP routing table entry for 172.17.0.0/16, version 12 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 1 192.168.100.2 from 192.168.100.2 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, external, best ISP10#
検証4 aggregate-addressコマンドによる経路集約
- BGPテーブルの確認
aggregate-addressによる経路集約の方法を確認します。
この方法を使う場合の前提条件は、「集約する前のルートがBGPテーブルに載っている事」です。集約前のルートをBGPテーブルに載せます。
この方法を使う場合の前提条件は、「集約する前のルートがBGPテーブルに載っている事」です。集約前のルートをBGPテーブルに載せます。
R2(config)#router bgp 1 R2(config-router)#network 172.18.0.0 mask 255.255.255.0 R2(config-router)#network 172.18.1.0 mask 255.255.255.0 R2(config-router)#network 172.18.2.0 mask 255.255.255.0 R2(config-router)#network 172.18.3.0 mask 255.255.255.0 R2#show ip bgp BGP table version is 15, 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 *> 10.10.10.10/32 192.168.100.10 0 0 2 i *> 172.17.0.0 0.0.0.0 0 32768 i *> 172.18.0.0/24 192.168.12.1 156160 32768 i *> 172.18.1.0/24 192.168.12.1 156160 32768 i *> 172.18.2.0/24 192.168.12.1 156160 32768 i *> 172.18.3.0/24 192.168.12.1 156160 32768 i R2#
- 経路集約の設定
aggregate-addressコマンドを用いて、経路集約の設定を投入します。
すると、ISP10のBGPテーブルからは集約されたルートが確認できます。
すると、ISP10のBGPテーブルからは集約されたルートが確認できます。
R2(config)#router bgp 1 R2(config-router)#aggregate-address 172.18.0.0 255.255.252.0 ISP10#show ip bgp BGP table version is 17, local router ID is 10.10.10.10 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 *> 10.10.10.10/32 0.0.0.0 0 32768 i *> 172.17.0.0 192.168.100.2 0 0 1 i *> 172.18.0.0/24 192.168.100.2 156160 0 1 i <- 集約前のルートも伝えられる *> 172.18.0.0/22 192.168.100.2 0 0 1 i *> 172.18.1.0/24 192.168.100.2 156160 0 1 i <- 集約前のルートも伝えられる *> 172.18.2.0/24 192.168.100.2 156160 0 1 i <- 集約前のルートも伝えられる *> 172.18.3.0/24 192.168.100.2 156160 0 1 i <- 集約前のルートも伝えられる ISP10# ISP10# ISP10#show ip bgp 172.18.0.0 255.255.252.0 BGP routing table entry for 172.18.0.0/22, version 17 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 1, (aggregated by 1 2.2.2.2) 192.168.100.2 from 192.168.100.2 (2.2.2.2) <- 集約されたルートにはatomic-aggregateという属性が付与されます Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best ISP10#
- 集約前のルートを伝えない設定
上記の方法では、集約前のルートも伝わってしまうためメモリ・CPUの節約にはなりません。summary-onlyというオプションをつける事によって、集約前のルートが伝わらないようになります。
R2(config)#router bgp 1 R2(config-router)#no aggregate-address 172.18.0.0 255.255.252.0 R2(config-router)#aggregate-address 172.18.0.0 255.255.252.0 summary-only R2(config-router)#^Z R2# *Mar 1 00:42:55.807: %SYS-5-CONFIG_I: Configured from console by console R2# R2#clear ip bgp 192.168.100.10 out R2# ISP10#show ip bgp BGP table version is 23, local router ID is 10.10.10.10 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 *> 10.10.10.10/32 0.0.0.0 0 32768 i *> 172.17.0.0 192.168.100.2 0 0 1 i *> 172.18.0.0/22 192.168.100.2 0 0 1 i ISP10# ISP10# ISP10#show ip bgp 172.18.0.0 255.255.252.0 BGP routing table entry for 172.18.0.0/22, version 23 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Not advertised to any peer 1, (aggregated by 1 2.2.2.2) 192.168.100.2 from 192.168.100.2 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best ISP10#
検証5 通信断時の挙動
- 通信断の再現
R1 f0/0がダウンした場合の挙動を確認します。R1 f0/0に対しshutdownを投入します。
R1(config)#interface FastEthernet 0/0 R1(config-if)#shutdown R1(config-if)# *Mar 1 00:44:20.323: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 192.168.12.2 (FastEthernet0/0) is down: interface down *Mar 1 00:44:22.311: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down *Mar 1 00:44:23.311: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down R1(config-if)#
- 経路の確認
ISP10のルーティングテーブルを確認します。aggregate-addressで設定した172.18.0.0/22は消えましたが、networkコマンドで設定した172.17.0.0/16は依然残ったままです。aggregate-addressはBGPに集約前のルートがない場合は他のルータに経路を通知しない仕様になっているため、aggregate-addressのみが消えるという挙動になります。
ISP10#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set B 172.17.0.0/16 [20/0] via 192.168.100.2, 00:15:42 10.0.0.0/32 is subnetted, 1 subnets C 10.10.10.10 is directly connected, Loopback0 C 192.168.100.0/24 is directly connected, FastEthernet1/0 ISP10# ISP10# ISP10#show ip bgp BGP table version is 24, local router ID is 10.10.10.10 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 *> 10.10.10.10/32 0.0.0.0 0 32768 i *> 172.17.0.0 192.168.100.2 0 0 1 i ISP10#
添付ファイル