DynagenでCCIEを目指す
20100602 BGP iBGP neighbor
最終更新:
it_certification
-
view
目的
- iBGP neighborの確立方法について確認します
- iBGPにおける、next-hop到達性の問題について確認します。
構成
- 設定概要
- AS 1内はOSPFによってルーティングします。
- R1, R2間でiBGP neighborを確立します(検証1)
- R2, ISP10間でeBGP neighborを確立します(検証2)
- 構成図

- 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 1.1.1.1 255.255.255.255 ! interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes network 1.1.1.1 0.0.0.0 area 0 network 192.168.1.1 0.0.0.0 area 0 ! 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.1.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/0 ip address 192.168.2.2 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes network 2.2.2.2 0.0.0.0 area 0 network 192.168.1.2 0.0.0.0 area 0 ! 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.2.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 iBGP neighborの設定
- BGP neighborの設定
R1, R2間でiBGP neighborを確立できるよう設定します。
R1(config)#router bgp 1 R1(config-router)#neighbor 2.2.2.2 remote-as 1 R2(config)#router bgp 1 R2(config-router)#neighbor 1.1.1.1 remote-as 1
- neighborの確認
上記の設定だけでは、neighborを確立する事はできません。showコマンドで確認すると、Stateはいつまで待っても、依然Activeのままです。
これは、neighborで指定したIP addressと送信元のIP addressが異なるためです。具体的に言えば、R1で指定したneighborが2.2.2.2であるのに対し、R2が送信した情報の送信元アドレスが192.168.1.2であるからです。デバッグメッセージを表示されると、neighbor確立が拒否されている様子が確認できます。
これは、neighborで指定したIP addressと送信元のIP addressが異なるためです。具体的に言えば、R1で指定したneighborが2.2.2.2であるのに対し、R2が送信した情報の送信元アドレスが192.168.1.2であるからです。デバッグメッセージを表示されると、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 0 0 0 0 0 never Active R1# R1#debug ip bgp events BGP events debugging is on R1# *Mar 1 00:17:21.259: BGP: Import timer expired. Walking from 1 to 1 *Mar 1 00:17:29.967: BGP: 2.2.2.2 open active, local address 192.168.1.1 *Mar 1 00:17:30.115: BGP: 2.2.2.2 open failed: Connection refused by remote host
- update sourceの設定
neighborが確立できるよう、送信元IP addressを定義します。
R1(config)#router bgp 1 R1(config-router)#neighbor 2.2.2.2 update-source Loopback 0 R2(config)#router bgp 1 R2(config-router)#neighbor 1.1.1.1 update-source Loopback 0
- neighborの再確認
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 5 5 1 0 0 00:01:57 0 R1#
検証2 eBGP neighborの設定
- eBGP neighborの設定を行います
R2, ISP10間で、eBGP neighborを確立します。
R2(config)#router bgp 1 R2(config-router)#neighbor 192.168.2.10 remote-as 2 ISP10(config)#router bgp 2 ISP10(config-router)#neighbor 192.168.2.2 remote-as 1 ISP10(config-router)#network 10.10.10.10 mask 255.255.255.255
- ルーティングテーブルの確認
ISP10のルートである10.10.10.10はR2へ伝わっていますが、R1へは伝わっていません。
R2#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 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/2] via 192.168.1.1, 00:27:24, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 10.0.0.0/32 is subnetted, 1 subnets B 10.10.10.10 [20/0] via 192.168.2.10, 00:01:00 C 192.168.1.0/24 is directly connected, FastEthernet0/0 C 192.168.2.0/24 is directly connected, FastEthernet1/0 R2# R1#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 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 O 2.2.2.2 [110/2] via 192.168.1.2, 00:27:33, FastEthernet0/0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 R1#
検証3 next-hop到達性の問題
- next-hopの確認
R1に10.10.10.10が伝わっていな原因を確認します。show ip bgpコマンドを見ると、ベストパスである「>」の表記がありません。また、show ip bgp 10.10.10.10を見ると、192.168.2.10 (inaccessible)と表記されています。BGPで伝わってきた10.10.10.10へのルートのnext-hop 192.168.2.10へ到達できないため、ルーティングテーブルに10.10.10.10が載らないようです。
R1#show ip bgp BGP table version is 1, 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 * i10.10.10.10/32 192.168.2.10 0 100 0 2 i R1#
inaccessibleの表記、next-hopである192.168.2.10へ到達できないと怒られているのが確認できます。
R1#show ip bgp 10.10.10.10 BGP routing table entry for 10.10.10.10/32, version 0 Paths: (1 available, no best path) Not advertised to any peer 2 192.168.2.10 (inaccessible) from 2.2.2.2 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, internal R1#
検証4 next-hop到達性 ルーティングで対応
- ルーティングの追加
検証3で確認した通り、next-hopへ到達できないのが問題のようです。そこで、next-hopへのルートをstaticに定義します。
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2 ISP10(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.2
- ルーティングテーブルなどの確認
ISP10へのルートがR1に伝わった事を確認します。
R1#show ip route bgp 10.0.0.0/32 is subnetted, 1 subnets B 10.10.10.10 [200/0] via 192.168.2.10, 00:00:45 R1# R1# R1# R1#show ip bgp BGP table version is 2, 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 *>i10.10.10.10/32 192.168.2.10 0 100 0 2 i R1# R1# R1#show ip bgp 10.10.10.10 BGP routing table entry for 10.10.10.10/32, version 2 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 2 192.168.2.10 from 2.2.2.2 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, internal, best R1#
- 設定の削除
検証4で投入した設定を削除します。
R1(config)#no ip route 192.168.2.0 255.255.255.0 192.168.1.2 ISP10(config)#no ip route 192.168.1.0 255.255.255.0 192.168.2.2
検証5 next-hop到達性 next-hop-self
- next-hop-self
検証4のようにルーティングによってnext-hop到達性の問題を回避する事はできますが、保守しづらい設定であるだけでなくISPにルーティングの変更を依頼しなければなりません。とても現実的な対応方法とは言えません。そこで、以下のようにnext-hopを書き換える事で対応するのが一般的な方法です。
R2でnext-hopを192.168.2.10(ISP10)から2.2.2.2(R2)に書き換える設定を行います。
R2でnext-hopを192.168.2.10(ISP10)から2.2.2.2(R2)に書き換える設定を行います。
R2(config)#router bgp 1 R2(config-router)#neighbor 1.1.1.1 next-hop-self
- ルーティングテーブル等の確認
next-hopが2.2.2.2に書き変わり、BGPによる経路交換ができている事を確認します。
R1#show ip route bgp 10.0.0.0/32 is subnetted, 1 subnets B 10.10.10.10 [200/0] via 2.2.2.2, 00:00:43 R1# 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 *>i10.10.10.10/32 2.2.2.2 0 100 0 2 i R1# R1# R1#show ip bgp 10.10.10.10 BGP routing table entry for 10.10.10.10/32, version 4 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Not advertised to any peer 2 2.2.2.2 (metric 2) from 2.2.2.2 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, internal, best R1#
添付ファイル