DynagenでCCIEを目指す
20100622 BGP 条件つきアドバタイズ
最終更新:
it_certification
-
view
目的
- BPGで、条件毎にルーティングを制御する方法を確認します
- inject-mapに関しては検証失敗です。失敗原因が分かり次第、修正版に差し替えます。
構成
- 設定概要
- 初期設定は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 = ISP10 f1/0 [[ROUTER R2]] [[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 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.100.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.0 ! 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
- 初期設定 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の設定
BGP neighborの設定を投入します。R1, R2間はiBGP neighborとし、R1, ISP10間はeBGP neighborとします。
R1(config)#ip route 2.2.2.2 255.255.255.255 192.168.12.2 R1(config)#ip route 10.10.10.10 255.255.255.255 192.168.100.10 R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#neighbor 2.2.2.2 remote-as 1 R1(config-router)#neighbor 2.2.2.2 update-source Loopback 0 R1(config-router)#neighbor 2.2.2.2 next-hop-self R1(config-router)# R1(config-router)#neighbor 10.10.10.10 remote-as 10 R1(config-router)#neighbor 10.10.10.10 update-source Loopback 0 R1(config-router)#neighbor 10.10.10.10 ebgp-multihop R1(config-router)#exit R2(config)#ip route 1.1.1.1 255.255.255.255 192.168.12.1 R2(config)# R2(config)# R2(config)#router bgp 1 R2(config-router)#neighbor 1.1.1.1 remote-as 1 R2(config-router)#neighbor 1.1.1.1 update-source Loopback 0 ISP10(config)#ip route 1.1.1.1 255.255.255.255 192.168.100.1 ISP10(config)# ISP10(config)# ISP10(config)#router bgp 10 ISP10(config-router)#neighbor 1.1.1.1 remote-as 1 ISP10(config-router)#neighbor 1.1.1.1 update-source Loopback 0 ISP10(config-router)#neighbor 1.1.1.1 ebgp-multihop
- BGP neighborの確認
BGP neighborが確立された事を確認します。
R1#show ip bgp summary 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 2.2.2.2 4 1 6 6 1 0 0 00:02:20 0 10.10.10.10 4 10 4 4 1 0 0 00:00:51 0 R1#
- ネットワークのエミュレート
ISP10に接続されているネットワークをエミュレートします。
ISP10(config)#interface Loopback 1 ISP10(config-if)#ip address 172.16.1.10 255.255.255.0 ISP10(config-if)#exit ISP10(config)# ISP10(config)#interface Loopback 2 ISP10(config-if)#ip address 172.16.2.10 255.255.255.0 ISP10(config-if)#exit ISP10(config)# ISP10(config)#interface Loopback 3 ISP10(config-if)#ip address 172.16.3.10 255.255.255.0 ISP10(config-if)#exit ISP10(config)# ISP10(config)# ISP10(config)#router bgp 10 ISP10(config-router)#network 172.16.1.0 mask 255.255.255.0 ISP10(config-router)#network 172.16.2.0 mask 255.255.255.0 ISP10(config-router)#network 172.16.3.0 mask 255.255.255.0
- エミュレートの確認
エミュレートされたネットワークがR2まで伝わっているかどうかを確認します。
R2#show ip route bgp 172.16.0.0/24 is subnetted, 3 subnets B 172.16.1.0 [200/0] via 1.1.1.1, 00:01:37 B 172.16.2.0 [200/0] via 1.1.1.1, 00:01:37 B 172.16.3.0 [200/0] via 1.1.1.1, 00:01:37 R2#
検証2 advertise-mapによる条件付きルート
- advertise-mapの設定
advertise-mapによって、条件によりルートを通知するかどうかを制御します。このシナリオで使用する条件をまとめると以下の通りです。
条件 | 通知するルート |
---|---|
BGPテーブルに172.16.1.0/24が存在する | 172.17.1.0/24 |
BGPテーブルに172.16.2.0/24が存在しない | 172.17.2.0/24 |
投入する設定は以下の通りです。
R1(config)#ip prefix-list LIST_CONDITION_EXIST permit 172.16.1.0/24 R1(config)#ip prefix-list LIST_CONDITION_NONEXIST permit 172.16.2.0/24 R1(config)#ip prefix-list LIST_ADV_EXIST permit 172.17.1.0/24 R1(config)#ip prefix-list LIST_ADV_NONEXIST permit 172.17.2.0/24 R1(config)# R1(config)# R1(config)#route-map MAP_CONDITION_EXIST permit 10 R1(config-route-map)#match ip address prefix-list LIST_CONDITION_EXIST R1(config-route-map)#exit R1(config)# R1(config)#route-map MAP_CONDITION_NONEXIST permit 10 R1(config-route-map)#match ip address prefix-list LIST_CONDITION_NONEXIST R1(config-route-map)#exit R1(config)# R1(config)#route-map MAP_ADV_EXIST permit 10 R1(config-route-map)#match ip address prefix-list LIST_ADV_EXIST R1(config-route-map)#exit R1(config)# R1(config)#route-map MAP_ADV_NONEXIST permit 10 R1(config-route-map)#match ip address prefix-list LIST_ADV_NONEXIST R1(config-route-map)#exit R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#neighbor 2.2.2.2 advertise-map MAP_ADV_EXIST exist-map MAP_CONDITION_EXIST R1(config-router)#neighbor 2.2.2.2 advertise-map MAP_ADV_NONEXIST non-exist-map MAP_CONDITION_NONEXIST
- 通知するルートの確認
R2に通知しているルートを確認します。
現状では、上記で設定したadvertise-mapは効いていません。advertise-mapで通知されるルートはBGPテーブルに載っているルートのみです。
現状では、上記で設定したadvertise-mapは効いていません。advertise-mapで通知されるルートはBGPテーブルに載っているルートのみです。
R1#show ip bgp neighbors 2.2.2.2 advertised-routes 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 *> 172.16.1.0/24 10.10.10.10 0 0 10 i *> 172.16.2.0/24 10.10.10.10 0 0 10 i *> 172.16.3.0/24 10.10.10.10 0 0 10 i R1#
- BGPテーブルへの追加
advertise-mapで使用するルートをBGPテーブルに載せます
R1(config)#ip route 172.17.1.0 255.255.255.0 Null 0 R1(config)#ip route 172.17.2.0 255.255.255.0 Null 0 R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#network 172.17.1.0 mask 255.255.255.0 R1(config-router)#network 172.17.2.0 mask 255.255.255.0
- 通知するルートの確認
R2に通知しているルートを確認します。advertise-mapの条件を満たしている172.17.1.0/24は通知されていますが、advertise-mapの条件を満たしていない172.17.2.0/24は通知されていない事が確認できます。
R1#show ip bgp neighbors 2.2.2.2 advertised-routes BGP table version is 6, 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 *> 172.16.1.0/24 10.10.10.10 0 0 10 i *> 172.16.2.0/24 10.10.10.10 0 0 10 i *> 172.16.3.0/24 10.10.10.10 0 0 10 i *> 172.17.1.0/24 0.0.0.0 0 32768 i R1#
- 経路切り替わりの確認
advertise-mapが条件によって、ルートを通知したり通知しなくなったりする事を確認します。まずは、ISP10の以下のI/Fをshutdownさせます。
ISP10(config)#interface Loopback 1 ISP10(config-if)#shutdown ISP10(config-if)# *Mar 1 00:37:39.619: %LINK-5-CHANGED: Interface Loopback1, changed state to administratively down ISP10(config-if)#exit ISP10(config)# ISP10(config)# ISP10(config)#interface Loopback 2 ISP10(config-if)#shutdown ISP10(config-if)# *Mar 1 00:37:49.623: %LINK-5-CHANGED: Interface Loopback2, changed state to administratively down ISP10(config-if)#
- 通知するルートの確認
上記shutdownによって通知されるルートが変わった事を確認します。
R1#show ip bgp neighbors 2.2.2.2 advertised-routes BGP table version is 10, 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 *> 172.16.3.0/24 10.10.10.10 0 0 10 i *> 172.17.2.0/24 0.0.0.0 0 32768 i R1#
検証3 inject-mapによる条件付きルート (検証失敗)
2010/02/15 IOS不具合のである事が判明。IOSのバージョン変更で成功。要シナリオ書きなおし。
bgp injext-map exit-mapコマンドを使用する事で、特定のneighborから学習したルートについて、より詳細なルートを生成する事ができます。このシナリオでは、172.16.3.0/24のより詳細なルート(172.16.3.0/25, 172.16.3.128/25)を生成します。
R1(config)#ip prefix-list ISP10 permit 10.10.10.10/32 R1(config)#ip prefix-list LIST_CONDITION_SPECIFIC permit 172.16.3.0/24 R1(config)#ip prefix-list LIST_ADV_SPECIFIC seq 10 permit 172.16.3.0/25 R1(config)#ip prefix-list LIST_ADV_SPECIFIC seq 20 permit 172.16.3.128/25 R1(config)# R1(config)#route-map MAP_CONDITION_SPECIFIC permit 10 R1(config-route-map)#match ip address prefix-list LIST_CONDTION_SPECIFIC R1(config-route-map)#match ip route-source prefix-list ISP10 R1(config-route-map)#exit R1(config)# R1(config)# R1(config)#route-map MAP_ADV_SPECIFIC permit 10 R1(config-route-map)#set ip address prefix-list LIST_ADV_SPECIFIC R1(config-route-map)#exit R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#bgp inject-map MAP_ADV_SPECIFIC exist-map MAP_CONDITION_SPECIFIC
- injectの確認
詳細はルートはshow ip bgp injected-pathsで確認できます。念のためclear ip bgp *を行ってから、showコマンドで確認しましたが、設定は反映されていないようです。
R1#clear ip bgp * R1# *Mar 1 00:14:25.451: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down User reset *Mar 1 00:14:25.455: %BGP-5-ADJCHANGE: neighbor 10.10.10.10 Down User reset R1# R1#show ip bgp injected-paths R1#
補足 inject-mapについて試した事
- match ip route-sourceの削除
ルートの送信元アドレスが間違っている可能性を疑い、match ip route-sourceを削除してみました。
R1(config)#no route-map MAP_CONDITION_SPECIFIC R1(config)#route-map MAP_CONDITION_SPECIFIC permit 10 R1(config-route-map)#match ip address prefix-list LIST_CONDTION_SPECIFIC R1(config-route-map)# R1(config-route-map)#do show run | b ^route-map route-map MAP_ADV_SPECIFIC permit 10 set ip address prefix-list LIST_ADV_SPECIFIC ! route-map MAP_CONDITION_SPECIFIC permit 10 match ip address prefix-list LIST_CONDTION_SPECIFIC R1#clear ip bgp * R1# *Mar 1 00:19:01.907: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down User reset *Mar 1 00:19:01.911: %BGP-5-ADJCHANGE: neighbor 10.10.10.10 Down User reset *Mar 1 00:19:28.239: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Up *Mar 1 00:19:41.975: %BGP-5-ADJCHANGE: neighbor 10.10.10.10 Up R1# R1# 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 *> 172.16.3.0/24 10.10.10.10 0 0 10 i *> 172.17.1.0/24 0.0.0.0 0 32768 i *> 172.17.2.0/24 0.0.0.0 0 32768 i R1# R1# R1#show ip bgp injected-paths R1#
- BGPテーブルに載せる
「BGPテーブルに載っている詳細なルートしか通知されないのでは?」と疑い、BGPテーブルに載せてみました。
R1(config)#ip route 172.16.3.0 255.255.255.128 Null 0 R1(config)#ip route 172.16.3.128 255.255.255.128 Null 0 R1(config)# R1(config)# R1(config)#do 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 C 192.168.12.0/24 is directly connected, FastEthernet0/0 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 2.0.0.0/32 is subnetted, 1 subnets S 2.2.2.2 [1/0] via 192.168.12.2 172.17.0.0/24 is subnetted, 2 subnets S 172.17.1.0 is directly connected, Null0 S 172.17.2.0 is directly connected, Null0 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks S 172.16.3.128/25 is directly connected, Null0 S 172.16.3.0/25 is directly connected, Null0 B 172.16.3.0/24 [20/0] via 10.10.10.10, 00:02:06 10.0.0.0/32 is subnetted, 1 subnets S 10.10.10.10 [1/0] via 192.168.100.10 C 192.168.100.0/24 is directly connected, FastEthernet1/0 R1(config)# R1(config)#router bgp 1 R1(config-router)#network 172.16.3.0 mask 255.255.255.128 R1(config-router)#network 172.16.3.128 mask 255.255.255.128 R1#show ip bgp BGP table version is 8, 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 *> 172.16.3.0/25 0.0.0.0 0 32768 i *> 172.16.3.0/24 10.10.10.10 0 0 10 i *> 172.16.3.128/25 0.0.0.0 0 32768 i *> 172.17.1.0/24 0.0.0.0 0 32768 i *> 172.17.2.0/24 0.0.0.0 0 32768 i R1# R1# R1#show ip bgp injected-paths R1#
添付ファイル