BGP Downstream & Upstream Control Menggunakan BGP Community

Struktur Umum BGP Large Community (Contoh Best Practice)

<ASN kamu>:<kategori>:<kode>
FieldFungsiKeterangan
1ASN KamuMisal 65053
2Kategori / TargetMenandakan arah (upstream, peer, dst)
3Tagging / TindakanApa yang dilakukan (prepend/suppress/tag dll)

Community Tagging (Contoh Best Practice)

Large CommunityKeterangan
65053:100:xPrefix learned from upstream (x = ASN Upstream)
65053:200:xPrefix learned from RS/Bilateral (x = ASN RS/Bilat)
65053:300:xPrefix learned from PNI (x = ASN PNI)
65053:500:xPrefix learned from Downstream (x = ASN Downstream)

Community Customer/Downstream Self Control (Prepend & Supress)

Large CommunityKeterangan
65053:999:10x10 = Kode untuk Upstream A, x = Prepend 1x, 2x, 3x, 0 suppressed to upstream A
65053:999:20x20 = Kode untuk Upstream B, x = Prepend 1x, 2x, 3x, 0 suppressed to upstream A
65053:999:110x110 = Kode untuk RS/Bilateral A, x = Prepend 1x, 2x, 3x, 0 suppressed to RS/Bilateral A
65053:999:120x120 = Kode untuk RS/Bilateral B, x = Prepend 1x, 2x, 3x, 0 suppressed to RS/Bilateral B
65053:999:1110x1110 = Kode untuk PNI A, x = Prepend 1x, 2x, 3x, 0 suppressed to PNI A
65053:999:1120x1120 = Kode untuk PNI B, x = Prepend 1x, 2x, 3x, 0 suppressed to PNI B

Contoh Topologi

ASN Saya: 65053
Prefix Saya: 172.16.2.0/23 up to /24

ASN Downstream: 65055
Prefix Downstream: 10.0.2.0/23 up to /24

Mikrotik

Contoh Filter DOWNSTREAM in

if ( dst in 10.0.2.0/23 && dst-len in 23-24 && bgp-as-path ^.*65055$ ) { delete bgp-large-communities regexp ^65053:[1-4][0-9][0-9]:.*|^65053:500:.*; append bgp-large-communities 65053:500:65055; set bgp-local-pref 200; accept; } 
reject

Contoh Filter DOWNSTREAM out

Buat community-large-list untuk memudahkan:

/routing filter community-large-list
add disabled=no list=REGEXP-LEARNED_FROM-UPSTERAM regexp=65053:100:.*
add disabled=no list=REGEXP-LEARNED_FROM-RS regexp=65053:200:.*
add disabled=no list=REGEXP-LEARNED_FROM-PEER regexp=65053:300:.*
add disabled=no list=REGEXP-LEARNED_FROM-DOWNSTREAM regexp=65053:500:.*

Buat filter nya:

chain=EBGP-DOWNSTREAM-A-out rule="if ( bgp-large-communities includes 65053:500:65055 ) { reject; } "

chain=EBGP-DOWNSTREAM-A-out rule="if ( dst in 172.16.2.0/23 && dst-len in 23-24 ) { accept; } "

chain=EBGP-DOWNSTREAM-A-out rule="if ( bgp-large-communities includes-list REGEXP-LEARNED_FROM-UPSTERAM ) { accept; } "

chain=EBGP-DOWNSTREAM-A-out rule="if ( bgp-large-communities includes-list REGEXP-LEARNED_FROM-RS ) { accept; } "

chain=EBGP-DOWNSTREAM-A-out rule="if ( bgp-large-communities includes-list REGEXP-LEARNED_FROM-PEER ) { accept; } "

chain=EBGP-DOWNSTREAM-A-out rule="if ( bgp-large-communities includes-list REGEXP-LEARNED_FROM-DOWNSTREAM ) { accept; } "

chain=EBGP-DOWNSTREAM-A-out rule="reject"