Cisco IOS ルーティング – BGP Inject Mapの設定

スポンサーリンク

BGP inject mapは集約したルートを条件に応じて再び分割する事で、longest matchによるトラフィックエンジニアリングを実現する機能です。

概要

BGP inject mapについてまとめます。inject mapは集約したルートを再び分割する事で、longest matchによるトラフィックエンジニアリングを実現する機能です。

コマンド一覧

このシナリオで重要なコマンド一覧は以下の通りです。

Router(config)#router bgp <as>
Router(config-router)# bgp inject-map ORIGINATE exist-map LEARNED_PATH

構成図

以下の構成で動作確認を行います。

R3(AS200)にて以下loopback interfaceを作成し、このprefixをsummarizeします。AS100において、summarizeしたprefixをトラフィックエンジニアリングする事を考えます。

  • 10.1.0.1/24
  • 10.1.1.1/24
  • 10.1.2.1/24
  • 10.1.3.1/24

                                                204.12.1.0/24
                                      e0/1      e0/0     e0/1
                                      .4+--------+.4  .254+--------+
                                        |   R4   |        |  BB3   |
            e0/0    e0/1      e0/0  ┌--+        +--------+        |
    +--------+.254  .4+--------+.4  │  | AS 100 |        | AS 54  |
    |   R3   |        |   R1   |    │  +--------+        +--------+
    |        +--------+        +----┤
    | AS 200 |        | AS 100 |    │  +--------+        +--------+
    +--------+        +--------+    │  |   R6   |        |  BB1   |
           155.1.13.0/24            └--+        +--------+        |
                                        | AS 100 |        | AS 54  |
                                      .6+--------+.6  .254+--------+
                                      e0/1      e0/0     e0/1
                            155.1.146.0/24      54.1.1.0/24

 [R1]
router bgp 100
 neighbor 155.1.13.3 remote-as 200
 neighbor 155.1.146.4 remote-as 100
 neighbor 155.1.146.4 route-reflector-client
 neighbor 155.1.146.6 remote-as 100
 neighbor 155.1.146.6 route-reflector-client

 [R3]
router bgp 200
 network 10.1.0.0 mask 255.255.255.0
 network 10.1.1.0 mask 255.255.255.0
 network 10.1.2.0 mask 255.255.255.0
 network 10.1.3.0 mask 255.255.255.0
 aggregate-address 10.1.0.0 255.255.252.0 summary-only
 neighbor 155.1.13.1 remote-as 100
!
interface Loopback10
 ip address 10.1.0.1 255.255.255.0
!
interface Loopback11
 ip address 10.1.1.1 255.255.255.0
!
interface Loopback12
 ip address 10.1.2.1 255.255.255.0
!
interface Loopback13
 ip address 10.1.3.1 255.255.255.0

 [R4]
router bgp 100
 neighbor 155.1.146.1 remote-as 100
 neighbor 204.12.1.254 remote-as 54

 [R6]
router bgp 100
 neighbor 54.1.1.254 remote-as 54
 neighbor 155.1.146.1 remote-as 100

 [BB1]
router bgp 54
 neighbor 54.1.1.6 remote-as 100

 [BB3]
router bgp 54
 neighbor 204.12.1.4 remote-as 100

設定全文は下記ファイルです。詳細設定は下記を参照ください。

R1
!
version 12.4
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
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 150.1.1.1 255.255.255.0
!
interface Ethernet0/0
 ip address 155.1.146.1 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 155.1.13.1 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 150.1.0.0
 network 155.1.0.0
 no auto-summary
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 155.1.13.3 remote-as 200
 neighbor 155.1.146.4 remote-as 100
 neighbor 155.1.146.4 route-reflector-client
 neighbor 155.1.146.6 remote-as 100
 neighbor 155.1.146.6 route-reflector-client
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R3
!
version 12.4
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
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 150.1.3.3 255.255.255.0
!
interface Loopback10
 ip address 10.1.0.1 255.255.255.0
!
interface Loopback11
 ip address 10.1.1.1 255.255.255.0
!
interface Loopback12
 ip address 10.1.2.1 255.255.255.0
!
interface Loopback13
 ip address 10.1.3.1 255.255.255.0
!
interface Ethernet0/0
 ip address 155.1.13.3 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 150.1.0.0
 network 155.1.0.0
 no auto-summary
!
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 10.1.0.0 mask 255.255.255.0
 network 10.1.1.0 mask 255.255.255.0
 network 10.1.2.0 mask 255.255.255.0
 network 10.1.3.0 mask 255.255.255.0
 aggregate-address 10.1.0.0 255.255.252.0 summary-only
 neighbor 155.1.13.1 remote-as 100
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R4
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 150.1.4.4 255.255.255.0
!
interface Ethernet0/0
 ip address 204.12.1.4 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 155.1.146.4 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 150.1.0.0
 network 155.1.0.0
 network 204.12.1.0
 no auto-summary
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 155.1.146.1 remote-as 100
 neighbor 204.12.1.254 remote-as 54
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R6
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R6
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 150.1.6.6 255.255.255.0
!
interface Ethernet0/0
 ip address 54.1.1.6 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 155.1.146.6 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 54.0.0.0
 network 150.1.0.0
 network 155.1.0.0
 no auto-summary
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 54.1.1.254 remote-as 54
 neighbor 155.1.146.1 remote-as 100
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
BB1
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname BB1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/1
 ip address 54.1.1.254 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router bgp 54
 no synchronization
 bgp log-neighbor-changes
 neighbor 54.1.1.6 remote-as 100
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
BB3
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname BB3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/1
 ip address 204.12.1.254 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router bgp 54
 no synchronization
 bgp log-neighbor-changes
 neighbor 204.12.1.4 remote-as 100
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end

仕様説明

指定パラメータについて

BGP inject mapを使用するには、以下3つのパラメータを指定する必要があります。

  • 集約したprefix
  • 分割してadvertiseしたいprefix
  • 集約したprefixをadvertiseしたルータ

例えばshowコマンドが以下のような出力ならば、advertiseしたルータは155.1.146.1になります。

R4#show ip bgp 10.1.0.0/22
BGP routing table entry for 10.1.0.0/22, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  200, (aggregated by 200 150.1.3.3)
    155.1.13.3 (metric 1) from 155.1.146.1 (150.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, atomic-aggregate, best
R4#

集約したprefixの指定

集約したprefixとそのprefixをadvertiseしたルータを指定するroute-mapを作成します。

Router(config)# ip prefix-list ROUTE_SOURCE seq 10 permit <prefix>
Router(config)# ip prefix-list ORIGINATED_ROUTES seq 10 permit <prefix>
Router(config)# 
Router(config)# route-map LEARNED_PATH permit 10
Router(config-route-map)# match ip address prefix-list SOURCE
Router(config-route-map)# match ip route-source prefix-list ROUTE_SOURCE
Router(config-route-map)# exit
Router(config)# 
Router(config)# route-map ORIGINATE permit 10
Router(config-route-map)# set ip address prefix-list ORIGINATED_ROUTES

分割後prefixの指定

分割してadvertiseしたいprefixを指定するroute-mapを作成します。なお、“match ip address”ではなく”set ip address”である事に注意して下さい。また、”set”コマンドを用いて、communityたmetricを変更する事もできます。

Router(config)# ip prefix-list SOURCE seq 10 permit <prefix>
Router(config)#
Router(config)# route-map ORIGINATE permit 10
Router(config-route-map)# set ip address prefix-list ORIGINATED_ROUTES

BGP inject map

指定したパラメータに基づくprefixをadvertiseするには、”bgp inject-map”コマンドを使用します。なお、この設定が反映されるには最大で60秒かかります

Router(config)#router bgp <as>
Router(config-router)# bgp inject-map ORIGINATE exist-map LEARNED_PATH

BGP inject map

設定投入

AS 54からAS 100へのトラフィックについて、10.1.1.0/24はR4に入ってくるように、10.1.2.0/24はR6に入ってくるように設定します。

 [R4]
router bgp 100
 bgp inject-map ORIGINATE exist-map LEARNED_PATH

route-map LEARNED_PATH permit 10
 match ip address prefix-list SOURCE
 match ip route-source prefix-list ROUTE_SOURCE

route-map ORIGINATE permit 10
 set ip address prefix-list ORIGINATED_ROUTES

ip prefix-list SOURCE seq 10 permit 10.1.0.0/22
ip prefix-list ROUTE_SOURCE seq 10 permit 155.1.146.1/32
ip prefix-list ORIGINATED_ROUTES seq 10 permit 10.1.1.0/24

 [R6]
router bgp 100
 bgp inject-map ORIGINATE exist-map LEARNED_PATH

route-map LEARNED_PATH permit 10
 match ip address prefix-list SOURCE
 match ip route-source prefix-list ROUTE_SOURCE

route-map ORIGINATE permit 10
 set ip address prefix-list ORIGINATED_ROUTES

ip prefix-list SOURCE seq 10 permit 10.1.0.0/22
ip prefix-list ROUTE_SOURCE seq 10 permit 155.1.146.1/32
ip prefix-list ORIGINATED_ROUTES seq 10 permit 10.1.2.0/24

動作確認

injectされたprefixは”show ip bgp injected-paths”コマンドで確認できます。

 [R4]
R4#show ip bgp injected-paths
BGP table version is 3, local router ID is 150.1.4.4
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.1.1.0/24      155.1.13.3                             0 ?
R4#

想定通りのprefixをadvertiseしているかどうかを確認します。集約した10.1.0.0/22に加え、分割した10.1.1.0/24もadvertiseしている事を確認します。

 [R4]
R4#show ip bgp neighbors 204.12.1.254 advertised-routes
BGP table version is 3, local router ID is 150.1.4.4
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.1.0.0/22      155.1.13.3               0    100      0 200 i
*>i10.1.1.0/24      155.1.13.3                             0 ?

Total number of prefixes 2
R4#

Tips

scan process

inject mapの設定が反映されるのは、デフォルトで60秒間隔です。もしも60秒待ちたくない場合は、scan processの間隔を変更します。なお、実践ではscan processを短くしすぎるとCPU使用率上昇につながりますので、注意が必要です。

Router(config)#router bgp 100
Router(config-router)#bgp scan-time ?
  <5-60>  Scanner interval (seconds)

Router(config-router)#bgp scan-time 10
タイトルとURLをコピーしました