■ 入力/出力トラフィックフィルタリング
■ 外部隣接ルーターのリンクに入出力するトラフィックのカウントとアカウンティング
■ 特定のトラフィックのためのルーター/ネットワークの安全性の確保
■ redundancyの処理
■ 外部コネクションへのサービス提供
入力/出力ルーティングBGPポリシー
ルーティングポリシーは、潜在する多数の状況を処理することができます。それらは、ピアリングと
as-path
を使 用する場合のように、論理的または方策的に実行されます。ポリシーを作成して、ASとの間でやり取りされるトラフィックが経由するパスに影響を与えたり、それらを操作した りすることができます。
Communityが合致したら、as-pathを付加し、MEDをセットする
BGPは、ASトラフィックがASからのすべてのルートを経由するか、一部の特定のルートだけを経由するかを操作す るために、ポリシーをルートに適用します。ルートをマークするために使用される主な機能は、communityです。起 点(アクセスルーター)などの特定のルートをマークすることで、境界/配信ルーターは、次のようにそのルートに関す る決定事項を決めることができます。
■ よく知られた
community no-export
を使うことで、外部隣接ルーターへの特定ルートの転送を阻止する■ 境界ルーターでMEDと
as-path
を操作できるように、アクセスルーターで特定のルートにcommunity
をマ ークする■ アナウンスされたアグリゲートに対して境界ルーターで
as-path
とMED
を操作し、ポリシーをASへの応答ト ラフィックに適用する図10と図11は、トポロジー例と、受信およびアドバタイズされたルート更新情報の例です。図10は、イントラASト ラフィックを対象としたルートのプロビジョニング(たとえば、RFC 1918ルート。この場合は、192.168.1/24、
192.168.2/24、および172.16.2/24)と、適したルートテーブルプリフィックスを示しています。
図11は、ASへの応答トラフィックを制御するための、
as-path
とMED
の操作を示しています。境界ルーターはア グリゲーションを実行し、特定のcommunity
stringを持つルートの受信時に、アグリゲートされていないカスタ マのプリフィックスへ送るなどのアクションを実行します。図 10:
Provision and Prevention of Advertising Intra-AS Routes
192.168.1/24, no-export 172.16.2/24, 1111:10
192.168.1/24, no-export 100.100.1.1/32, 1111:1
100.100.2.1/32, 1111:2 100.200.1.1/32, 1111:5 100.200.2.1/32, 1111:4 111.111/16, 1111:5 222.222/16, 1111:6
2.2/16
3.3/16 Plus Martians
UNIX Lunkan
Cisco_pop Ida
Lena
Cisco_border
Pagent
Access
AS 2222 AS 1111
AS 3333 Dummy
Cisco_core_rr
M40 M20
M10
CommunityをBGPルートに追加するIOSの例
この例では、Cisco̲core̲rrが192.168.2/24 rfc1918ルートをアナウンスしています。ルートは、外部に転送さ れないように、
community no-export
でマークされています。以下は、Ciscoルーターのコンフィグレーショ ンの一部です。図 11:
Manipulation of Announced Aggregate Updates
100.100/16 MED 0
100.200/16 MED 100 as-path 1111 1111 111.111/16 MED 0
222.222/16 MED 100 as-path 1111 1111 1111
100.200/16 MED 0
100.100/16 MED 100 as-path 1111 1111 1111 111.111/16 MED 0
222.222/16 MED 100 as-path 1111 1111 1111 100.100.1.1/32, 1111:1
100.100.2.1/32, 1111:2 100.200.1.1/32, 1111:5 100.200.2.1/32, 1111:4 111.111/16, 1111:5 222.222/16, 1111:6
UNIX Lunkan
Cisco_pop Ida
Lena
Cisco_border
Pagent Access
AS 2222 AS 1111
AS 3333 Dummy
Cisco_core_rr
M40 M20
M10
!
router bgp 1111 no synchronization bgp router-id 1.1.1.6 bgp cluster-id 3232236033 bgp log-neighbor-changes
network 192.168.2.0 route-map rfc1918 timers bgp 30 90
redistribute connected
neighbor internal_rr peer-group neighbor internal_rr remote-as 1111
neighbor internal_rr update-source Loopback0 neighbor internal_rr route-reflector-client neighbor internal_rr send-community
neighbor internal_rr route-map rfc1918 out neighbor internal peer-group
neighbor internal remote-as 1111
neighbor internal update-source Loopback0
neighbor internal send-community/* Send community */
neighbor internal route-map rfc1918 out/* Route-map out */
neighbor 1.1.1.1 peer-group internal neighbor 1.1.1.2 peer-group internal_rr
この例では、Ciscoアクセスルーターが、後から境界ルーターが判別できるように、
community
タグを持つIBGP へのルートをプロビジョンしています。neighbor 1.1.1.3 peer-group internal_rr neighbor 1.1.1.4 peer-group internal_rr neighbor 1.1.1.5 peer-group internal_rr no auto-summary
!
!
ip bgp-community new-format
!
!
access-list 1 permit 192.168.2.0 0.0.0.25 /* Access-list that route-map use */
route-map rfc1918 permit 10/* Route-map mark route with no-export community */
match ip address 1 set community no-export
!
!
router bgp 1111 no synchronization bgp log-neighbor-changes timers bgp 30 90
redistribute connected route-map access/* Route-map used for connected routes (loopbacks) */
redistribute static route-map static /* Route-map used for static routes */
neighbor access peer-group neighbor access remote-as 1111
neighbor access update-source Loopback0 neighbor access send-community
neighbor 1.1.1.3 peer-group access neighbor 1.1.1.5 peer-group access no auto-summary
!
ip bgp-community new-format
!
access-list 1 permit 100.100.1.1/* Access-list that route-map uses */
access-list 2 permit 100.100.2.1 access-list 3 permit 100.200.1.1 access-list 4 permit 100.200.2.1
access-list 5 permit 111.111.0.0 0.0.255.255 access-list 6 permit 222.222.0.0 0.0.255.255
route-map access permit 10/* Route-map that sets community for connected routes */
match ip address 1 set community 1111:1
!
route-map access permit 20 match ip address 2
set community 1111:2
!
route-map access permit 30 match ip address 3
set community 1111:3
route-map access permit 40 match ip address 4
set community 1111:4
!
route-map static permit 10/* Route-map that set community for staticly routes */
match ip address 5 set community 1111:5
!
route-map static permit 20 match ip address 6
set community 1111:6
!
cisco_access#sh ip bgp commun 1111:1
BGP table version is 12, local router ID is 1.1.1.7
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 100.100.1.1/32 0.0.0.0 0 32768 ?
cisco_access#sh ip bgp commun 1111:2
BGP table version is 12, local router ID is 1.1.1.7
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 100.100.2.1/32 0.0.0.0 0 32768 ?
cisco_access#sh ip bgp commun 1111:3
BGP table version is 12, local router ID is 1.1.1.7
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 100.200.1.1/32 0.0.0.0 0 32768 ?
cisco_access#sh ip bgp commun 1111:4
BGP table version is 12, local router ID is 1.1.1.7
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 100.200.2.1/32 0.0.0.0 0 32768 ?
cisco_access#sh ip bgp commun 1111:5
BGP table version is 12, local router ID is 1.1.1.7
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 111.111.0.0/16 0.0.0.0 0 32768 ?
cisco_access#sh ip bgp commun 1111:6
BGP table version is 12, local router ID is 1.1.1.7
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 222.222.0.0/16 0.0.0.0 0 32768 ?
ここでは、Ciscoルーターは、アナウンスされたルートが
community
stringを持っていることを検証しています。CommunityをBGPルートに追加するJUNOSソフトウェアの例
この例では、lunkanルーターが、
community no-export
をマークした192.168.1/24 rfc1918ルートと、community
1111:10をマークした172.16.2/24ルートをアナウンスし、前出のcisco̲accessルーターと同様 のルートプロビジョニングをシミュレートしています。routing-options { router-id 1.1.1.1;
autonomous-system 1111;
}
protocols { bgp {
traceoptions { file bgp;
flag state;
}
log-updown;
group internal_rr { type internal;
local-address 1.1.1.1;
export service;/* Export policy (for non-reflected routes) */
cluster 1.1.1.1;
neighbor 1.1.1.2 {
authentication-key "$9$.mT3ApBSrv9ApBRSMW";
}
neighbor 1.1.1.3 {
authentication-key "$9$h2PclM7-waZjX7-w2aiH";
}
neighbor 1.1.1.4;
neighbor 1.1.1.5;
}
group internal { type internal;
local-address 1.1.1.1;
export service;/* Export policy (for non-reflected routes) */
neighbor 1.1.1.6;
} }
policy-options {
policy-statement service { term one {
from {
route-filter 192.168.1.0/24 exact;
} then {
community add rfc1918;
accept;
} }
term two { from {
route-filter 172.16.2.0/24 exact;
} then {
community add mcast;
accept;
} } }
community mcast members 1111:10;
ここでは、Juniperルーターは、アナウンスされたルートが
community
stringを持つことを検証しています。IOSのas-pathとMEDの操作例
これは、ルートを受信するcisco̲borderのコンフィグレーションの一部です。いくつかのルートをアグリゲートして いますが、それ以外はアグリゲートしていません。場合によっては、
MED
を追加しています。as-path
プリペンド は、community
stringに基づいて付加されます。また、デフォルトとしてcommunity no-export
を持つ ルートはEBGPへはアドバタイズされません。lunkan@lunkan# run show route advertising-protocol bgp 1.1.1.2 172.16.2/24 detail inet.0: 27 destinations, 27 routes (27 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
172.16.2.0/24 (1 entry, 1 announced) BGP group type Internal AS 1111
Nexthop: Self Localpref: 100 AS path: I
Communities: 1111:10 [edit]
lunkan@lunkan# run show route advertising-protocol bgp 1.1.1.2 192.168.1/24 detail inet.0: 27 destinations, 27 routes (27 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
192.168.1.0/24 (1 entry, 1 announced) BGP group type Internal AS 1111
Nexthop: Self Localpref: 100 AS path: I
Communities: no-export [edit]
lunkan@lunkan#
!
router bgp 1111 no synchronization bgp router-id 1.1.1.4 bgp log-neighbor-changes bgp deterministic-med
bgp dampening route-map damp
aggregate-address 100.100.0.0 255.255.0.0 summary-only aggregate-address 100.200.0.0 255.255.0.0 summary-only timers bgp 30 90
neighbor internal peer-group neighbor internal remote-as 1111
neighbor internal update-source Loopback0 neighbor internal next-hop-self
neighbor external peer-group
neighbor external prefix-list martians in neighbor external route-map int_policy in
neighbor external route-map ext_policy out /* Route-map (policy) applied to route... */
neighbor 1.1.1.1 peer-group internal neighbor 1.1.1.6 peer-group internal neighbor 194.68.128.22 remote-as 2222 neighbor 194.68.128.22 peer-group external neighbor 194.68.128.33 remote-as 3333 neighbor 194.68.128.33 peer-group external no auto-summary
!
ip bgp-community new-format ip community-list 1 permit 1111:5 ip community-list 2 permit 1111:6
!
community
がマークされたルートは、境界ルーターに到達します。access-list 10 permit 100.100.0.0 0.0.255.255 access-list 20 permit 100.200.0.0 0.0.255.255 route-map ext_policy permit 10
match ip address 10 /* Agggregate 100.100/16 are as-prep and get high (bad) MED */
set metric 100
set as-path prepend 1111 1111 1111
!
route-map ext_policy permit 20
match ip address 20/* Aggregate 100.200/16 get low (good) MED */
set metric 0
!
route-map ext_policy permit 30 match community 1
set metric 100
set as-path prepend 1111 1111 1111 /* 111.111/16 route with community 1111:5 get as-path prepend and high MED (bad) value */
!
route-map ext_policy permit 40
match community 2 /* 222.222/16 route with community 1111:6 get low MED (good) value */
set metric 0
!
route-map ext_policy deny 50
!
cisco_border#sh ip bgp comm 1111:1
BGP table version is 17, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
s>i100.100.1.1/32 1.1.1.7 0 100 0 ?
cisco_border#
cisco_border#sh ip bgp comm 1111:2
BGP table version is 17, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
s>i100.100.2.1/32 1.1.1.7 0 100 0 ?
cisco_border#
cisco_border#sh ip bgp comm 1111:3
BGP table version is 17, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
s>i100.200.1.1/32 1.1.1.7 0 100 0 ?
cisco_border#
cisco_border#sh ip bgp comm 1111:4
BGP table version is 17, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
s>i100.200.2.1/32 1.1.1.7 0 100 0 ?
cisco_border#
この例は、
community
string1111:10を持つルートを示しています。この例は、
no-export community
stringを持つルートを示しています。この例は、
community
stringに応じて、MED
とas-path
が操作されているルートを示しています。この例は、EBGP隣接ルーターへアドバタイズされたルートを示しています。192.168.1/24、192.168.2/24、
および172.16.2/24はアドバタイズされません。
cisco_border#sh ip bgp com 1111:10
BGP table version is 18, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i172.16.2.0/24 1.1.1.1 100 0 i
cisco_border#
cisco_border#sh ip bgp comm no-export
BGP table version is 19, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i192.168.1.0 1.1.1.1 100 0 i
*>i192.168.2.0 1.1.1.6 0 100 0 i
* i 1.1.1.6 0 100 0 i
cisco_border#
cisco_border#sh ip bgp comm 1111:5
BGP table version is 17, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i111.111.0.0/16 1.1.1.7 0 100 0 ?
cisco_border#
cisco_border#sh ip bgp comm 1111:6
BGP table version is 17, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i222.222.0.0/16 1.1.1.7 0 100 0 ?
cisco_border#
cisco_border#sh ip bgp nei 194.68.128.33 adv
BGP table version is 17, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 100.100.0.0/16 0.0.0.0 32768 i
*> 100.200.0.0/16 0.0.0.0 32768 i
*>i111.111.0.0/16 1.1.1.7 0 100 0 ?
*>i222.222.0.0/16 1.1.1.7 0 100 0 ?
cisco_border#
as-pathとMEDを操作するJUNOSソフトウェアの例
これは、前出のIOSの例と同じ結果をもたらすJuniper境界ルーターのコンフィグレーションです。
routing-options { aggregate {
route 100.100.0.0/16 { as-path {
origin igp;
atomic-aggregate;
aggregator 1111 1.1.1.2;
} }
route 100.200.0.0/16 { as-path {
origin igp;
atomic-aggregate;
aggregator 1111 1.1.1.2;
} } }
router-id 1.1.1.2;
autonomous-system 1111;
}
protocols { bgp {
traceoptions { file bgp;
flag damping detail;
}
log-updown;
group external { type external;
local-address 194.68.128.2;
damping;
import ebgp_in;
export ebgp; /* Policy used for EBGP peering */
neighbor 194.68.128.22 { peer-as 2222;
}
neighbor 194.68.128.33 { peer-as 3333;
} }
group internal { type internal;
local-address 1.1.1.2;
export internal;
neighbor 1.1.1.1 {
authentication-key "$9$0UylORSvWxwYoevWx-waJ";
}
neighbor 1.1.1.6;
} }
policy-options {
policy-statement ebgp {
term two {/* Agggregate 100.200/16 are as-prep and get high (bad) MED */
from {
route-filter 100.200.0.0/16 exact;
} then {
metric 100;
as-path-prepend "1111 1111";
accept;
} }
term three {/* Aggregate 100.100/16 get low (good) MED */
from {
route-filter 100.100.0.0/16 exact;
} then {
metric 0;
accept;
} }
term four {/* 222.222/16 route with community 1111:5 get as-path prepend and high MED (bad) value */
from community bad;
then {
metric 100;
as-path-prepend "1111 1111 1111";
accept;
} }
term five {/* 111.111/16 route with community 1111:6 get low MED (good) value */
from community good;
then {
metric 0;
accept;
} }
term last { then reject;
} }
community bad members 1111:6;
community good members 1111:5;
community
がマークされたルートは、境界ルーターに到達します。この例は、
community
string1111:10を持つルートを示しています。lunkan@lena> show route community 1111:1
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
100.100.1.1/32 *[BGP/170] 01:55:38, MED 0, localpref 100, from 1.1.1.1 AS path: ?
> to 1.1.0.3 via fxp0.0 to 1.1.0.5 via fxp0.0
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
lunkan@lena> show route community 1111:2
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
100.100.2.1/32 *[BGP/170] 01:55:41, MED 0, localpref 100, from 1.1.1.1 AS path: ?
to 1.1.0.3 via fxp0.0
> to 1.1.0.5 via fxp0.0
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
lunkan@lena> show route community 1111:3
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
100.200.1.1/32 *[BGP/170] 01:55:43, MED 0, localpref 100, from 1.1.1.1 AS path: ?
> to 1.1.0.3 via fxp0.0 to 1.1.0.5 via fxp0.0
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
lunkan@lena> show route community 1111:4
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
100.200.2.1/32 *[BGP/170] 01:55:45, MED 0, localpref 100, from 1.1.1.1 AS path: ?
> to 1.1.0.3 via fxp0.0 to 1.1.0.5 via fxp0.0
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
lunkan@lena> show route community 1111:10
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
172.16.2.0/24 *[BGP/170] 00:22:42, localpref 100, from 1.1.1.1 AS path: I
> to 1.1.0.1 via fxp0.0
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
この例は、lunkanルーターとcisco̲borderルーターからの、no-export community stringを持つルートを示してい ます。
この例は、
community
stringに応じて、MED
とas-path
が操作されているルートを示しています。lunkan@lena> show route community no-export
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
192.168.1.0/24 *[BGP/170] 02:03:04, localpref 100, from 1.1.1.1 AS path: I
> to 1.1.0.1 via fxp0.0
192.168.2.0/24 *[BGP/170] 02:03:07, MED 0, localpref 100, from 1.1.1.6
AS path: I
> to 1.1.0.6 via fxp0.0
[BGP/170] 02:03:04, MED 0, localpref 100, from 1.1.1.1
AS path: I
> to 1.1.0.6 via fxp0.0
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
lunkan@lena> show route community 1111:5 detail
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
111.111.0.0/16 (1 entry, 1 announced)
*BGP Preference: 170/-101 Source: 1.1.1.1
Nexthop: 1.1.0.3 via fxp0.0
Nexthop: 1.1.0.5 via fxp0.0, selected State: <Active Int Ext>
Local AS: 1111 Peer AS: 1111
Age: 1:59:26 Metric: 0 Metric2: 20 Task: BGP_1111.1.1.1.1+179
Announcement bits (3): 0-KRT 4-BGP.0.0.0.0+179 5-BGP_Sync_Any
AS path: ? <Originator>
Cluster list: 1.1.1.1 1.1.1.5 Originator ID: 1.1.1.7
Communities: 1111:5 BGP next hop: 1.1.1.7 Localpref: 100
Router ID: 1.1.1.1
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both
lunkan@lena> show route community 1111:6 detail
inet.0: 28 destinations, 28 routes (26 active, 0 holddown, 4 hidden) + = Active Route, - = Last Active, * = Both
222.222.0.0/16 (1 entry, 1 announced)
*BGP Preference: 170/-101 Source: 1.1.1.1
Nexthop: 1.1.0.3 via fxp0.0, selected Nexthop: 1.1.0.5 via fxp0.0
State: <Active Int Ext>
Local AS: 1111 Peer AS: 1111
Age: 1:59:33 Metric: 0 Metric2: 20 Task: BGP_1111.1.1.1.1+179
Announcement bits (3): 0-KRT 4-BGP.0.0.0.0+179 5-BGP_Sync_Any