DynagenでCCIEを目指す
20100608 BGP ポリシーベースルーティング Wight
最終更新:
it_certification
-
view
目的
- WEIGHT属性によって経路を制御する方法を確認します。
構成
- 設定概要
- R1, R2, R3の間でフルメッシュeBGP neighborを確立します。
- R1, R2, R3それぞれのLoopback I/Fへのルートは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 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 ! router eigrp 1 network 1.1.1.1 0.0.0.0 network 192.168.12.1 0.0.0.0 network 192.168.13.1 0.0.0.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 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 eigrp 1 network 1.1.1.1 0.0.0.0 network 192.168.12.1 0.0.0.0 network 192.168.13.1 0.0.0.0 no auto-summary ! 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 eigrp 1 network 3.3.3.3 0.0.0.0 network 192.168.13.3 0.0.0.0 no auto-summary ! ip http server ip classless ! ! ! ! ! ! ! ! line con 0 line aux 0 line vty 0 4 ! ! end
検証1 環境構築
- eBGP neighborの設定
R1, R2, R3でフルメッシュのeBGP neighborを確立させます。
R1(config)#router bgp 1 R1(config-router)#neighbor 2.2.2.2 remote-as 2 R1(config-router)#neighbor 2.2.2.2 update-source Loopback 0 R1(config-router)#neighbor 2.2.2.2 ebgp-multihop R1(config-router)# R1(config-router)#neighbor 3.3.3.3 remote-as 3 R1(config-router)#neighbor 3.3.3.3 update-source Loopback 0 R1(config-router)#neighbor 3.3.3.3 ebgp-multihop R2(config)#router bgp 2 R2(config-router)#neighbor 1.1.1.1 remote-as 1 R2(config-router)#neighbor 1.1.1.1 update-source Loopback 0 R2(config-router)#neighbor 1.1.1.1 ebgp-multihop R2(config-router)# R2(config-router)#neighbor 3.3.3.3 remote-as 3 R2(config-router)#neighbor 3.3.3.3 update-source Loopback 0 R2(config-router)#neighbor 3.3.3.3 ebgp-multihop R3(config)#router bgp 3 R3(config-router)#neighbor 1.1.1.1 remote-as 1 R3(config-router)#neighbor 1.1.1.1 update-source Loopback 0 R3(config-router)#neighbor 1.1.1.1 ebgp-multihop R3(config-router)# R3(config-router)#neighbor 2.2.2.2 remote-as 2 R3(config-router)#neighbor 2.2.2.2 update-source Loopback 0 R3(config-router)#neighbor 2.2.2.2 ebgp-multihop
- ネットワークの生成
R2に接続されているネットワークを再現します。以下のように、secondaryアドレスを使用して生成します。
設定が完了したら、clear ip bgpコマンドでルートを明示的に送信します。
設定が完了したら、clear ip bgpコマンドでルートを明示的に送信します。
R2(config)#interface Loopback 0 R2(config-if)#ip address 172.16.0.2 255.255.255.0 secondary R2(config-if)#ip address 172.16.1.2 255.255.255.0 secondary R2(config-if)#ip address 172.16.2.2 255.255.255.0 secondary R2(config-if)#ip address 172.16.3.2 255.255.255.0 secondary R2(config-if)#exit R2(config)# R2(config)# R2(config)#router bgp 1 R2(config-router)#network 172.16.0.0 mask 255.255.255.0 R2(config-router)#network 172.16.1.0 mask 255.255.255.0 R2(config-router)#network 172.16.2.0 mask 255.255.255.0 R2(config-router)#network 172.16.3.0 mask 255.255.255.0 R2(config-router)#^Z R2# *Mar 1 00:23:26.491: %SYS-5-CONFIG_I: Configured from console by console R2# R2# R2#clear ip bgp * out R2#
- ベストパスの確認
R1におけるベストパスを確認します。現在の状態では、AS_PATHが短いルートがベストパスになっています。
R1#show ip bgp BGP table version is 5, 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.0.0/24 3.3.3.3 0 3 2 i *> 2.2.2.2 0 0 2 i * 172.16.1.0/24 3.3.3.3 0 3 2 i *> 2.2.2.2 0 0 2 i * 172.16.2.0/24 3.3.3.3 0 3 2 i *> 2.2.2.2 0 0 2 i * 172.16.3.0/24 3.3.3.3 0 3 2 i *> 2.2.2.2 0 0 2 i R1#
検証2 neighborに対するWEIGHT設定
- WEIGHT設定
R3から受信したルートのWEIGHTを0から200に変更します。
R1(config)#router bgp 1 R1(config-router)#neighbor 3.3.3.3 weight 200
- ベストパスの確認
先ほど設定したWIGHTが反映されるようclear ip bgpコマンドを発行します。その後、ベストパスを確認すると、WEIGHTが大きいR3経由のルートがベストパスに変わります。
R1#clear ip bgp 3.3.3.3 in R1# R1# R1#show ip bgp BGP table version is 9, 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.0.0/24 3.3.3.3 200 3 2 i * 2.2.2.2 0 0 2 i *> 172.16.1.0/24 3.3.3.3 200 3 2 i * 2.2.2.2 0 0 2 i *> 172.16.2.0/24 3.3.3.3 200 3 2 i * 2.2.2.2 0 0 2 i *> 172.16.3.0/24 3.3.3.3 200 3 2 i * 2.2.2.2 0 0 2 i R1#
検証3 route-mapを用いたWEIGHT設定
- WEIGHT設定
R1から受信したルートの一部に対しWIGHTを300に変更します。
R1(config)#ip prefix-list LIST_WEIGHT seq 10 permit 172.16.0.0/23 ge 24 le 24 R1(config)# R1(config)# R1(config)#route-map MAP_WEIGHT permit 10 R1(config-route-map)#match ip address prefix-list LIST_WEIGHT R1(config-route-map)#set weight 300 R1(config-route-map)#exit R1(config)#route-map MAP_WEIGHT permit 20 <- 全てのルートを許可します。 R1(config-route-map)#exit この設定を忘れると、暗黙のdeny allが働いてしまいます。 R1(config)# R1(config)# R1(config)#router bgp 1 R1(config-router)#neighbor 2.2.2.2 route-map MAP_WEIGHT in
- ベストパスの確認
R2から受信したルートが反映されるようclear ip bgpコマンドを発行します。一部のWEIGHTが300になっている事が確認できます。
R1#clear ip bgp 2.2.2.2 in R1# R1# R1#show ip bgp BGP table version is 11, 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.0.0/24 3.3.3.3 200 3 2 i *> 2.2.2.2 0 300 2 i * 172.16.1.0/24 3.3.3.3 200 3 2 i *> 2.2.2.2 0 300 2 i *> 172.16.2.0/24 3.3.3.3 200 3 2 i * 2.2.2.2 0 0 2 i *> 172.16.3.0/24 3.3.3.3 200 3 2 i * 2.2.2.2 0 0 2 i R1#
添付ファイル