DynagenでCCIEを目指す
20100604 BGP トランジットAS IGPによるルーティング
最終更新:
it_certification
-
view
目的
- トランジットASであるAS 1の設定方法を確認します。
- IGPを利用してトランジットASを設定します
- この設定はCisco非推奨の設定です。後日の検証の方がより実践的な方法です。
構成
- 設定概要
- AS 1内はOSPFによってルーティングします。
- 検証環境のスペック不足のため、ISP30は起動させません。
- R2, ISP20間でeBGP neighborを確立します。
- R2, R3間でiBGP neighborを確立します。
- 構成図

- 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]] f1/0 = ISP20 f1/0 [[ROUTER R3]] [[ROUTER ISP20]]
- 初期設定 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 ! router ospf 1 log-adjacency-changes network 1.1.1.1 0.0.0.0 area 0 network 192.168.12.1 0.0.0.0 area 0 network 192.168.13.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.12.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/0 ip address 192.168.122.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.12.2 0.0.0.0 area 0 ! 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 ! router ospf 1 log-adjacency-changes network 3.3.3.3 0.0.0.0 area 0 network 192.168.13.3 0.0.0.0 area 0 ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
- 初期設定 ISP20
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname ISP20 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! interface Loopback0 ip address 20.20.20.20 255.255.255.255 ! interface FastEthernet1/0 ip address 192.168.122.20 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の設定
R2, R3間でiBPG neighborを、R2, ISP20間でeBPG neighborを確立します。
R2(config)#ip route 20.20.20.20 255.255.255.255 192.168.122.20 R2(config)# R2(config)# R2(config)# R2(config)#router bgp 1 R2(config-router)#neigh R2(config-router)#neighbor 3.3.3.3 remote-as 1 R2(config-router)#neighbor 3.3.3.3 update-source Loopback 0 R2(config-router)#neighbor 3.3.3.3 next-hop-self R2(config-router)#neighbor 20.20.20.20 remote-as 2 R2(config-router)#neighbor 20.20.20.20 update-source Loopback 0 R2(config-router)#neighbor 20.20.20.20 ebgp-multihop 2 R2(config-router)# R2(config-router)# R2(config-router)#network 192.168.122.0 mask 255.255.255.0 R3(config)#router bgp 1 R3(config-router)#neighbor 2.2.2.2 remote-as 1 R3(config-router)#neighbor 2.2.2.2 update-source Loopback 0 ISP20(config)#ip route 2.2.2.2 255.255.255.255 192.168.122.2 ISP20(config)# ISP20(config)# ISP20(config)# ISP20(config)#router bgp 2 ISP20(config-router)#neigh ISP20(config-router)#neighbor 2.2.2.2 remote-as 1 ISP20(config-router)#neighbor 2.2.2.2 update-source Loopback 0 ISP20(config-router)#neighbor 2.2.2.2 ebgp-multihop 2 ISP20(config-router)# ISP20(config-router)# ISP20(config-router)#network 20.20.20.20 mask 255.255.255.255 ISP20(config-router)#network 192.168.122.0 mask 255.255.255.0
- ルーティングの確認
AS 2の経路がR3まで伝わっている事を確認します。
R3#show ip bgp BGP table version is 3, 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 *>i20.20.20.20/32 2.2.2.2 0 100 0 2 i *>i192.168.122.0 2.2.2.2 0 100 0 i R3# R3# R3#show ip bgp summary BGP router identifier 3.3.3.3, local AS number 1 BGP table version is 3, main routing table version 3 2 network entries using 202 bytes of memory 2 path entries using 96 bytes of memory 2 BGP path attribute entries using 120 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 442 total bytes of memory BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 2.2.2.2 4 1 15 11 3 0 0 00:07:35 2 R3# R3# R3# R3#show ip route bgp B 192.168.122.0/24 [200/0] via 2.2.2.2, 00:02:35 20.0.0.0/32 is subnetted, 1 subnets B 20.20.20.20 [200/0] via 2.2.2.2, 00:01:20 R3#
検証2 BGP同期(Synchronization)の意義
- 疎通確認
ISP20からR3への疎通確認を行います。R3へAS 2の経路が伝わっているのにも関わらず、pingが通りません。
ISP20(config)#ip route 0.0.0.0 0.0.0.0 192.168.122.2 ISP20(config)# ISP20(config)#^Z ISP20# *Mar 1 00:09:26.443: %SYS-5-CONFIG_I: Configured from console by console ISP20# ISP20#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: ..... Success rate is 0 percent (0/5) ISP20# ISP20# ISP20# ISP20#traceroute 3.3.3.3 Type escape sequence to abort. Tracing the route to 3.3.3.3 1 192.168.122.2 40 msec 92 msec 52 msec 2 * * * 3 * * ISP20#
- ルーティングテーブルの確認
上記の疎通が不可能なのは、R1はISP20への経路を知らないためです。R1のルーティングテーブルを確認します。
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 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 C 192.168.13.0/24 is directly connected, FastEthernet1/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/2] via 192.168.12.2, 00:17:40, FastEthernet0/0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/2] via 192.168.13.3, 00:17:41, FastEthernet1/0 R1#
- 同期の無効確認
このように、トランジット内の全てのルータが他のASへの経路を知らないために起きてしまう事故を防止するための機能がBGP同期です。BGP同期を有効にすると「IBGP neighborから受信したルートは、AS内のIGPで学習するまで利用しない」ようになります。簡単に言うと、IGPとBGPが同期するようになります。
R3のconfigを確認します。デフォルトではBGP同期が無効になっているようです。(最近は、IGPを利用してトランジットASを形成する事がなくなったから、デフォルトで無効になっているのだと思われます)
R3のconfigを確認します。デフォルトではBGP同期が無効になっているようです。(最近は、IGPを利用してトランジットASを形成する事がなくなったから、デフォルトで無効になっているのだと思われます)
R3#show run | begin ^router router ospf 1 log-adjacency-changes network 3.3.3.3 0.0.0.0 area 0 network 192.168.13.3 0.0.0.0 area 0 ! router bgp 1 no synchronization <- BGP同期が無効 bgp log-neighbor-changes neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 update-source Loopback0 no auto-summary !
検証3 BGP同期の有効化
- BGP同期の有効化
AS 1内の全ルータでBGP同期を有効にします。
R1(config)#router bgp 1 R1(config-router)#synchronization R2(config)#router bgp 1 R2(config-router)#synchronization R3(config)#router bgp 1 R3(config-router)#synchronization
- BGP tableの確認
R3のBGP情報を表示すると、「>」の表示がなくなった事が読み取れます。検証1の時点ではベストパスであったルートがベストパスでなくなってしまった事が分かります。
R3#show ip bgp BGP table version is 5, 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 * i20.20.20.20/32 2.2.2.2 0 100 0 2 i * i192.168.122.0 2.2.2.2 0 100 0 i R3#
検証4 BGPからIGPへの再配送
- BGPからOSPFへの再配送
R2でBGPからOSPFへ再配送する設定を投入します。
R2(config)#router ospf 1 R2(config-router)#redistribute bgp 1 subnets
- BGP tableの確認
R3のBGP tableを確認すると、192.168.122.0がベストパスになった事が読み取れます。
R3#show ip bgp BGP table version is 7, 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 * i20.20.20.20/32 2.2.2.2 0 100 0 2 i r>i192.168.122.0 2.2.2.2 0 100 0 i R3#
- 疎通確認
ISP20からR3へpingが通るようになった事を確認します。
ISP20#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 240/353/696 ms ISP20#
検証5 トラブルシュート Loopback I/Fが再配送されない
- BGP tableの確認
R3のBGP tableを確認すると、ISP20のLoopback I/Fである20.20.20.20がベストパスになっていない事が分かります。どうやら、BPG同期を満たしていない事が分かります。192.168.122.0/24は再配送されるのに、なぜか20.20.20.20/32のみOSPFへ再配送されません。
R3#show ip bgp BGP table version is 7, 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 * i20.20.20.20/32 2.2.2.2 0 100 0 2 i r>i192.168.122.0 2.2.2.2 0 100 0 i R3# R3# R3#show ip bgp 20.20.20.20 BGP routing table entry for 20.20.20.20/32, version 4 Paths: (1 available, no best path) Not advertised to any peer 2 2.2.2.2 (metric 3) from 2.2.2.2 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, internal, not synchronized R3# R3# R3#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 O 192.168.12.0/24 [110/2] via 192.168.13.1, 00:08:17, FastEthernet1/0 O E2 192.168.122.0/24 [110/1] via 192.168.13.1, 00:08:17, FastEthernet1/0 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/2] via 192.168.13.1, 00:08:17, FastEthernet1/0 C 192.168.13.0/24 is directly connected, FastEthernet1/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/3] via 192.168.13.1, 00:08:17, FastEthernet1/0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 R3#
- R2の確認
再配送を行っているR2のルーティングテーブルを見ると、20.20.20.20にはSの表記があります。staticのAD値が1であるのに対し、BGPのAD値は20です。そのため、staticの方が優先され、20.20.20.20のBGPのルートがルーティングテーブルに載りません。
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 C 192.168.12.0/24 is directly connected, FastEthernet0/0 C 192.168.122.0/24 is directly connected, FastEthernet1/0 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/2] via 192.168.12.1, 00:21:29, FastEthernet0/0 O 192.168.13.0/24 [110/2] via 192.168.12.1, 00:21:29, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/3] via 192.168.12.1, 00:21:29, FastEthernet0/0 20.0.0.0/32 is subnetted, 1 subnets S 20.20.20.20 [1/0] via 192.168.122.20 <- staticによるルート R2#
- AD値の変更
R2のstaticルートを再設定します。AD値を240に変更します。すると、BGPの方がAD値が小さくなり、ルーティングテーブルにBの文字が現れます。
R2(config)#ip route 20.20.20.20 255.255.255.255 192.168.122.20 240 R2(config)# R2(config)# R2(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 C 192.168.122.0/24 is directly connected, FastEthernet1/0 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/2] via 192.168.12.1, 00:22:48, FastEthernet0/0 O 192.168.13.0/24 [110/2] via 192.168.12.1, 00:22:48, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/3] via 192.168.12.1, 00:22:48, FastEthernet0/0 20.0.0.0/32 is subnetted, 1 subnets B 20.20.20.20 [20/0] via 20.20.20.20, 00:00:22 <- BGPからStaticに変わります R2(config)#
- BGP同期の確認
20.20.20.20/32が再配送され、BGP同期が満たされた事を確認します。
R3#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 O 192.168.12.0/24 [110/2] via 192.168.13.1, 00:23:18, FastEthernet1/0 O E2 192.168.122.0/24 [110/1] via 192.168.13.1, 00:23:18, FastEthernet1/0 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/2] via 192.168.13.1, 00:23:18, FastEthernet1/0 C 192.168.13.0/24 is directly connected, FastEthernet1/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/3] via 192.168.13.1, 00:23:18, FastEthernet1/0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 20.0.0.0/32 is subnetted, 1 subnets O E2 20.20.20.20 [110/1] via 192.168.13.1, 00:00:41, FastEthernet1/0 R3# R3# R3#show ip bgp BGP table version is 15, 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 r>i20.20.20.20/32 2.2.2.2 0 100 0 2 i r>i192.168.122.0 2.2.2.2 0 100 0 i R3#
添付ファイル