DynagenでCCIEを目指す
20100610 BGP ポリシーベースルーティング MEDの設定
最終更新:
it_certification
-
view
目的
- MED値によって経路を制御する方法を確認します。
構成
- 設定概要
- R1, R2, R3の間でフルメッシュiBGP neighborを確立します。
- R1, R2, R3はEIGRPを用いて、Loopback I/Fへのルーティングを定義します。
- 構成図

- 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 f0/0 [[ROUTER R2]] f1/0 = LAN 1 [[ROUTER R3]] f1/0 = LAN 1 [[ROUTER ISP10]] f1/0 = LAN 1
- 初期設定 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.16.0.1 255.255.255.0 secondary ip address 172.16.1.1 255.255.255.0 secondary ip address 172.16.2.1 255.255.255.0 secondary ip address 172.16.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 ! 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 172.16.0.0 network 192.168.12.0 network 192.168.13.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 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 2.2.2.2 0.0.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
- 初期設定 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 FastEthernet0/0 ip address 192.168.13.3 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/0 ip address 192.168.100.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.0 no 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 環境構築
- eBGP neighborの設定
R1, R2, R3でフルメッシュのiBGP neighborを確立させます。また、AS 1, AS 2間でeBGP neighborを確立されます。
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 3.3.3.3 remote-as 1 R1(config-router)#neighbor 3.3.3.3 update-source Loopback 0 R1(config-router)#network 172.16.0.0 mask 255.255.255.0 R1(config-router)#network 172.16.1.0 mask 255.255.255.0 R1(config-router)#network 172.16.2.0 mask 255.255.255.0 R1(config-router)#network 172.16.3.0 mask 255.255.255.0 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 R2(config-router)#neighbor 1.1.1.1 next-hop-self 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 192.168.100.10 remote-as 2 R3(config)#router bgp 1 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 next-hop-self R3(config-router)#neighbor 2.2.2.2 remote-as 1 R3(config-router)#neighbor 2.2.2.2 update-source Loopback 0 R3(config-router)#neighbor 2.2.2.2 next-hop-self R3(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)#neighbor 192.168.100.3 remote-as 1 ISP10(config-router)#network 10.10.10.10 mask 255.255.255.255
- ルーティングの確認
R1, ISP10でnetworkコマンドによって生成されたルートが互いに交換できているかどうかを確認します。
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:11:13 R1# ISP10#show ip route bgp 172.16.0.0/24 is subnetted, 4 subnets B 172.16.0.0 [20/0] via 192.168.100.3, 00:05:50 B 172.16.1.0 [20/0] via 192.168.100.3, 00:05:50 B 172.16.2.0 [20/0] via 192.168.100.3, 00:05:50 B 172.16.3.0 [20/0] via 192.168.100.3, 00:04:50 ISP10#
検証2 MED値の伝搬
- MED値の設定
R1で生成されたルート172.16.0.0/24, 172.16.1.0/24, 172.16.2.0/24, 172.16.3.0/24について確認します。このルートはiBGP neighborであるR2, R3までは伝わりますが、eBGP neighborを経由するISP10までは伝わりません。R1, R2, R3のMED値が0になっているのに対し、ISP10のMED値は空欄になっている事が分かります。
(MED値がどのように通知されていくかは、トップページ/動作検証 ネットワーク系/20100610 BGP ポリシーベースルーティング MEDの伝播で確認します。)
(MED値がどのように通知されていくかは、トップページ/動作検証 ネットワーク系/20100610 BGP ポリシーベースルーティング MEDの伝播で確認します。)
R1#show ip bgp 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 * i10.10.10.10/32 3.3.3.3 0 100 0 2 i *>i 2.2.2.2 0 100 0 2 i *> 172.16.0.0/24 0.0.0.0 0 32768 i *> 172.16.1.0/24 0.0.0.0 0 32768 i *> 172.16.2.0/24 0.0.0.0 0 32768 i *> 172.16.3.0/24 0.0.0.0 0 32768 i R1# R2#show ip bgp BGP table version is 10, 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 * i10.10.10.10/32 3.3.3.3 0 100 0 2 i *> 192.168.100.10 0 0 2 i r>i172.16.0.0/24 1.1.1.1 0 100 0 i r>i172.16.1.0/24 1.1.1.1 0 100 0 i r>i172.16.2.0/24 1.1.1.1 0 100 0 i r>i172.16.3.0/24 1.1.1.1 0 100 0 i R2# R3#show ip bgp BGP table version is 10, 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 * i10.10.10.10/32 2.2.2.2 0 100 0 2 i *> 192.168.100.10 0 0 2 i r>i172.16.0.0/24 1.1.1.1 0 100 0 i r>i172.16.1.0/24 1.1.1.1 0 100 0 i r>i172.16.2.0/24 1.1.1.1 0 100 0 i r>i172.16.3.0/24 1.1.1.1 0 100 0 i R3# ISP10#show ip bgp BGP table version is 9, 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.16.0.0/24 192.168.100.3 0 1 i * 192.168.100.2 0 1 i *> 172.16.1.0/24 192.168.100.3 0 1 i * 192.168.100.2 0 1 i *> 172.16.2.0/24 192.168.100.3 0 1 i * 192.168.100.2 0 1 i * 172.16.3.0/24 192.168.100.2 0 1 i *> 192.168.100.3 0 1 i ISP10#
検証3 MED値の設定
- R2の設定
R2からISP10へ送信されるルートについてMED値を定義します。
R2(config)#route-map MED permit 10 R2(config-route-map)#set metric 50 R2(config-route-map)#exit R2(config)# R2(config)#router bgp 1 R2(config-router)#neighbor 192.168.100.10 route-map MED out R2(config-router)#^Z R2# R2# *Mar 1 00:35:13.335: %SYS-5-CONFIG_I: Configured from console by consol R2#clear ip bgp 192.168.100.10 out
- R3の設定
R3にMED値を設定し、172.16.0.0/24のみR3の方が優先されるようにします。
R3(config)#route-map MED permit 10 R3(config-route-map)#match ip address 1 R3(config-route-map)#set metric 10 R3(config-route-map)#exit R3(config)#route-map MED permit 20 R3(config-route-map)#set metric 100 R3(config-route-map)#exit R3(config)# R3(config)# R3(config)#router bgp 1 R3(config-router)#neighbor 192.168.100.10 route-map MED out R3(config-router)#^Z R3# *Mar 1 00:37:36.747: %SYS-5-CONFIG_I: Configured from console by console R3# R3# R3#clear ip bgp 192.168.100.10 out
- BGPテーブルの確認
先ほど設定したMED値が反映されているかどうか確認します。BGPテーブルとルーティングテーブルから想定通りのルートになっている事を確認します。
ISP10#show ip bgp BGP table version is 13, 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.16.0.0/24 192.168.100.3 10 0 1 i * 192.168.100.2 50 0 1 i * 172.16.1.0/24 192.168.100.3 100 0 1 i *> 192.168.100.2 50 0 1 i * 172.16.2.0/24 192.168.100.3 100 0 1 i *> 192.168.100.2 50 0 1 i *> 172.16.3.0/24 192.168.100.2 50 0 1 i * 192.168.100.3 100 0 1 i ISP10# ISP10# ISP10#show ip route bgp 172.16.0.0/24 is subnetted, 4 subnets B 172.16.0.0 [20/10] via 192.168.100.3, 00:00:42 B 172.16.1.0 [20/50] via 192.168.100.2, 00:00:42 B 172.16.2.0 [20/50] via 192.168.100.2, 00:00:42 B 172.16.3.0 [20/50] via 192.168.100.2, 00:00:42 ISP10#
添付ファイル