ケーススタディ: COMMUNITY
次のネットワーク構成で、Well-known COMMUNITYの動作をみていきましょう。
![]()
図 Well-known COMMUNITY確認用のネットワーク構成
ここでは単純にするために、AS1のISP1が生成する100.1.1.0/24、100.1.2.0/24、 100.1.3.0/24の3つのルートだけを考えます。
Well-known COMMUNITY
ISP1が生成するルートについて、伝わる範囲を制限します。
- 100.1.1.0/24はR1まで
- 100.1.2.0/24はR3まで
- 100.1.3.0/24はR2まで
これを実現するために、ISP1は次のようにWell-known COMMUNITYを付加します。
- 100.1.1.0/24にno_advertise
- 100.1.2.0/24にlocal_as
- 100.1.3.0/24にno_export
100.1.1.0/24はR1から先のいかなるネイバーにも送信しないようにno_advertise のWell-known COMMUNITYを付加します。100.1.2.0/24にはコンフェデレーショ ン構成のサブASから外部に出て行かないようにlocal_asのWell-known COMMUNITY を付加します。100.1.3.0/24には、AS100から外に出て行かないようにno_export のWell-known COMMUNITYを付加します。
![]()
図 ISP1でWell-known COMMUNITYを付加してルートを送信
ISP1では、次のように設定して各ルートにWell-known COMMUNITYを付加します。
ISP1 Well-known COMMUNITYの付加
――――――――――――――――――――――――――――――――――― ISP1(config)#access-list 10 permit 100.1.1.0 ISP1(config)#access-list 20 permit 100.1.2.0 ISP1(config)#access-list 30 permit 100.1.3.0 ISP1(config)#route-map COMMUNITY permit 10 ISP1(config-route-map)#match ip address 10 ISP1(config-route-map)#set community no-advertise ISP1(config-route-map)#exit ISP1(config)#route-map COMMUNITY permit 20 ISP1(config-route-map)#match ip address 20 ISP1(config-route-map)#set community local-AS ISP1(config-route-map)#exit ISP1(config)#route-map COMMUNITY permit 30 ISP1(config-route-map)#match ip address 30 ISP1(config-route-map)#set community no-export ISP1(config-route-map)#exit ISP1(config)#route-map COMMUNITY permit 1000 ISP1(config-route-map)#exit ISP1(config)#router bgp 1 ISP1(config-router)#neighbor 172.16.1.1 route-map COMMUNITY out ISP1(config-router)#end ISP1#clear ip bgp 172.16.1.1 out ―――――――――――――――――――――――――――――――――――
R1でISP1によって付加されたCOMMUNITYを確認します。
R1 show ip bgp community
――――――――――――――――――――――――――――――――――― R1#show ip bgp community R1# ―――――――――――――――――――――――――――――――――――
ISP1で付加されたはずのCOMMUNITYをR1では確認できません。これは、Ciscoル ータではデフォルトでルートを送信するときにCOMMUNITYを削除するからです。 COMMUNITYを削除せずにルートを送信するためには、neighbor send-community の設定が必要です。ISP1でneighbor send-communityの設定を追加します。
ISP1 neighbor send-community
――――――――――――――――――――――――――――――――――― ISP1(config)#router bgp 1 ISP1(config-router)#neighbor 172.16.1.1 send-community ―――――――――――――――――――――――――――――――――――
ISP1でルートを再送信してR1で再度COMMUNITYを確認すると、次のようになります。
R1 show ip bgp community
―――――――――――――――――――――――――――――――――――
R1#show ip bgp community
BGP table version is 7, 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
*> 100.1.1.0/24 172.16.1.11 0 0 1 i
*> 100.1.2.0/24 172.16.1.11 0 0 1 i
*> 100.1.3.0/24 172.16.1.11 0 0 1 i
R1#show ip bgp 100.1.1.0
BGP routing table entry for 100.1.1.0/24, version 7
Paths: (1 available, best #1, table Default-IP-Routing-Table,
not advertised to any peer)
Flag: 0x880
Not advertised to any peer
1
172.16.1.11 from 172.16.1.11 (111.1.1.11)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: no-advertise
R1#show ip bgp 100.1.2.0
BGP routing table entry for 100.1.2.0/24, version 6
Paths: (1 available, best #1, table Default-IP-Routing-Table,
not advertised outside local AS)
Flag: 0x880
Advertised to non peer-group peers:
3.3.3.3
1
172.16.1.11 from 172.16.1.11 (111.1.1.11)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: local-AS
R1#show ip bgp 100.1.3.0
BGP routing table entry for 100.1.3.0/24, version 5
Paths: (1 available, best #1, table Default-IP-Routing-Table,
not advertised to EBGP peer)
Flag: 0x880
Advertised to non peer-group peers:
3.3.3.3
1
172.16.1.11 from 172.16.1.11 (111.1.1.11)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: no-export
―――――――――――――――――――――――――――――――――――
ISP1でneighbor send-communityの設定をすれば、COMMUNITYが削除されないこ とがわかります。COMMUNITYを利用した制御を行うためには、必ずneighbor send-community の設定が必要なので忘れないように気をつけてください。ISP1だけでなくCOMMUNITY による制御を行うすべてのネイバーに対して設定してください。
※特に明記していませんが、R1、R2、R3でneighbor send-communityはすでに 設定しています。
次にWell-known COMMUNITYによるルートの制御について確認しましょう。R1か らR3へ送信しているルートをみると、次の通りです。
R1からR3へ送信しているルート
―――――――――――――――――――――――――――――――――――
R1#show ip bgp neighbors 3.3.3.3 advertised-routes
BGP table version is 7, 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
*> 100.1.2.0/24 172.16.1.11 0 0 1 i
*> 100.1.3.0/24 172.16.1.11 0 0 1 i
―――――――――――――――――――――――――――――――――――
R1からR3へはno_advertiseが付加されている100.1.1.0/24を送信していないこ とがわかります。
続いて、R3からR2へのルートの送信を確認します。
R3からR2へ送信しているルート
―――――――――――――――――――――――――――――――――――
R3#show ip bgp
BGP table version is 7, local router ID is 100.100.1.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
*>i100.1.2.0/24 1.1.1.1 0 100 0 1 i
*>i100.1.3.0/24 1.1.1.1 0 100 0 1 i
R3#show ip bgp neighbors 2.2.2.2 advertised-routes
BGP table version is 7, local router ID is 100.100.1.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
*>i100.1.3.0/24 1.1.1.1 0 100 0 1 i
―――――――――――――――――――――――――――――――――――
R3からみるとR2はIEBGPネイバーです。そのため、local_asが付加されている 100.1.2.0/24のルートを送信していないことがわかります。
また、R2からISP2へのルート送信は次の通りです。
R2からISP2へ送信しているルート
―――――――――――――――――――――――――――――――――――
R2#show ip bgp
BGP table version is 7, 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
*> 100.1.3.0/24 1.1.1.1 0 100 0 (65001) 1 i
R2#show ip bgp neighbors 172.16.2.22 advertised-routes
Total number of prefixes 0
―――――――――――――――――――――――――――――――――――
R2からみるとISP2はEBGPネイバーです。そのため、no_exportのCOMMUNITYが付 加されている100.1.3.0/24のルートを送信しません。
このようにWell-known COMMUNITYを付加すると、そのCOMMUNITYに応じて自動 的にフィルタがかかり、ルートが伝わる範囲を限定することができます。








