Sổ tay kỹ thuật

BGP communities – standard, extended, large và well-known

cheatsheet#bgp#iosxr#junos#policy· cập nhật 2026-11-06

Tra nhanh định dạng community, giá trị well-known (no-export, BLACKHOLE 65535:666) và cú pháp match/set/delete trên IOS XR và Junos.

Sửa trang này
Mục lục

Community là tag gắn vào route để policy phía sau quyết định (local-pref, prepend, blackhole). Cách viết policy đầy đủ xem BGP route policy.

Loại community

Loại Kích thước Định dạng Dùng cho
Standard (RFC 1997) 32 bit 64500:100 (ASN 16 bit : giá trị 16 bit) Tag nội bộ, điều khiển upstream
Extended (RFC 4360) 64 bit target:64500:100, origin:64500:100 (Junos); RT:64500:100, SoO:64500:100 (XR hiển thị) Route target VPN, Site of Origin, FlowSpec action
Large (RFC 8092) 96 bit 64500:1:100 (ASN 32 bit : hàm : tham số) ASN 32 bit (không nhét vừa standard)

Well-known

Tên Giá trị Ý nghĩa
NO_EXPORT 65535:65281 Không quảng bá ra ngoài AS (hoặc confederation)
NO_ADVERTISE 65535:65282 Không quảng bá cho bất kỳ peer nào
NO_EXPORT_SUBCONFED 65535:65283 Không quảng bá ra ngoài sub-AS (Junos no-export-subconfed)
NOPEER (RFC 3765) 65535:65284 Không quảng bá qua peering song phương
BLACKHOLE (RFC 7999) 65535:666 Yêu cầu peer blackhole prefix (thường /32, /128), xem RTBH và FlowSpec
GRACEFUL_SHUTDOWN (RFC 8326) 65535:0 Peer hạ local-pref route này trước khi bảo trì
ACCEPT_OWN (RFC 7611) 65535:1 Cho PE nhận lại route VPN do chính mình sinh (qua RR)

Khai báo set

Mục đích IOS XR Junos
Một giá trị community-set C-CUST / 64500:100 / end-set set policy-options community C-CUST members 64500:100
Nhiều giá trị (XR: phân tách bằng ,) 64500:100, xuống dòng 64500:200 members [ 64500:100 64500:200 ] (route phải có cả hai mới khớp)
Wildcard theo ASN 64500:* members "^64500:.*$"
Dải giá trị 64500:[100..199] members "^64500:1[0-9][0-9]$"
Regex ios-regex '^64500:1..$' Chuỗi regex trong members
Well-known 65535:65281 members no-export
Extended RT extcommunity-set rt RT-A / 64500:100 / end-set members target:64500:100
Large large-community-set LC-A / 64500:1:100 / end-set members large:64500:1:100

Match

Mục đích IOS XR (RPL) Junos (from)
Có ít nhất một giá trị trong set if community matches-any C-CUST then from community C-CUST (một community có 1 member)
Có đủ mọi giá trị if community matches-every C-CUST then Một community với nhiều members
Một trong nhiều set (OR) if community matches-any C-A or community matches-any C-B then from community [ C-A C-B ]
Route target if extcommunity rt matches-any RT-A then from community RT-A
Large community if large-community matches-any LC-A then from community LC-A
Không có community if not community matches-any C-CUST then Term trước accept/next policy, term sau xử lý phần còn lại

Set và delete

Mục đích IOS XR Junos (then)
Thêm, giữ community cũ set community C-CUST additive community add C-CUST
Thay toàn bộ set community C-CUST community set C-CUST
Thêm giá trị inline set community (64500:100, 64500:200) additive (phải khai báo community có tên)
Xoá theo set/wildcard delete community in OUR-INTERNAL community delete OUR-INTERNAL
Xoá hết delete community all community delete một community members "*:*"
Gắn RT set extcommunity rt RT-A additive community add RT-A
Gắn large community set large-community LC-A additive community add LC-A

Gửi và xem

Mục đích IOS XR Junos
Gửi community cho eBGP Mặc định không gửi: send-community-ebgp dưới address-family của neighbor Mặc định gửi
Gửi extended community cho eBGP send-extended-community-ebgp Mặc định gửi
Route mang một community show bgp ipv4 unicast community 64500:100 show route community 64500:100
Route khớp community có tên — show route community-name C-CUST
Community của một prefix show bgp ipv4 unicast 203.0.113.0/24 (dòng Community:) show route 203.0.113.0/24 detail | match Communities

Mỗi ISP công bố bảng community riêng cho khách (ví dụ 64500:80 = LP 80, 64500:666 = blackhole, 64500:2xxx = prepend tới peer nào). Viết bảng này trên trang web/IRR và luôn xoá community nội bộ 64500:* khách tự gắn trước khi gắn lại theo policy.