Skip to content
LinkState
Go back

Large communities as containment labels across AS boundaries

Introduction to Cross‑Domain Containment Contracts

A cross‑domain containment contract is a set of mutually agreed‑upon BGP‑based rules that restrict the advertisement, acceptance, or modification of routes as they cross administrative boundaries. The contract defines a trust boundary: routes carrying a designated community (or set of communities) may cross the boundary only if they satisfy the contract’s conditions; otherwise they are dropped, tagged with a lower local‑pref, or otherwise altered to prevent leakage. Its purpose is to limit the blast‑radius of mis‑configurations, policy drift, or malicious route injection while preserving legitimate transit and peering relationships.

In multi‑operator environments—such as Internet Exchange Points, carrier‑grade MPLS backbones, or federated cloud interconnects—each operator maintains its own routing policy language, template library, and translation layer. Without a clear containment contract:

A well‑defined containment contract provides a deterministic, auditable checkpoint that can be validated independently of the underlying policy language, enabling the question: Given a route carrying community X, will it be allowed to cross from domain D₁ to domain D₂?


Legacy Communities vs Large Communities

Legacy Communities

Matched with community or extcommunity operators.
Advantages: universal support since the late‑1990s.
Limitations: ≈ 4 billion values for 4‑byte extended communities; encoding more than two independent semantics requires overloading the value space.

Large Communities (RFC 8092)

Advantages

Drawbacks

Comparison of Containment Contract Effectiveness

DimensionLegacy CommunitiesLarge Communities
Namespace size≤ 2³² (extended)2⁹⁶
Semantic granularity1‑2 independent fields (AS:VAL or type:subtype:GA:LD)3 independent fields
Policy translator complexityRequires mapping tables; risk of lossy translationDirect 1:1 mapping; translators preserve all three parts
Evaluation order impactSimple bitwise AND; cheapThree integer compares; O(1) with marginal CPU overhead
Blind spotsUnintentional reuse of values; limited versioningUnknown‑attribute handling on older boxes may cause silent drops
Operational maturityDecades of tooling, validation, best‑practice guidesGrowing support; validation tools (Batfish, pybatfish) now include large‑community matchers

When multiple operators, templates, and policy translators all touch a route, the determinism of the contract depends on whether the community value survives translation unchanged and whether matching logic is uniformly applied. Large communities provide a larger, less collision‑prone space and a structured format that reduces the need for heuristic translation, increasing the likelihood that the contract’s identity boundary (the community triple) is preserved across hops.


Containment Contract Requirements for Multiple Operators

Operator‑Specific Requirements

Each operator must declare:

  1. Trust Boundary Definition – the set of AS numbers or confederation members that constitute the operator’s domain.
  2. Community Allocation Policy – which global‑admin value(s) the operator owns (e.g., 65000: for Operator A, 65001: for Operator B).
  3. Containment Action – default treatment for routes that carry the operator’s containment community but lack the expected local‑data parts (e.g., drop, set local‑pref = 50, or add a transit‑only community).
  4. Translation Rules – how incoming legacy communities from peers are mapped to the operator’s large‑community format, and vice‑versa for export.

These requirements are captured in a policy contract document (YAML or JSON), version‑controlled and consumed by the operator’s policy‑as‑code pipeline.

Template‑Driven Containment Contracts

Operators use templating engines (Jinja2, Go‑text/template, or vendor‑specific CLI templates) to generate router‑level route‑policies from the contract document. A typical Juniper snippet:

policy-statement {{ operator }}-containment-import {
  term legacy {
    from community [ {{ legacy_set }} ];
    then reject;
  }
  term large {
    from large-community [ {{ large_set }} ];
    then {
      local-preference {{ lp_value }};
    }
  }
  term accept {
    then accept;
  }
}

Template variables ({{ operator }}, {{ legacy_set }}, {{ large_set }}, {{ lp_value }}) are populated from the contract store, ensuring the same logical rule set is rendered consistently across all routers of the operator and eliminating drift caused by manual CLI edits.

Policy Translator Integration

When a peer advertises a legacy community that maps to the operator’s large‑community contract, a translator must:

  1. Parse the incoming UPDATE, extracting the community attribute.
  2. Lookup the mapping table (e.g., 65000:10 → 65000:100:10).
  3. Rewrite the UPDATE, replacing the legacy community with the corresponding large community (or adding it alongside, depending on contract).
  4. Re‑calculate BGP path attributes (e.g., recalc the UPDATE’s checksum).

Minimal Python translator using exabgp:

from exabgp.bgp.message.update.attribute.community import Community
from exabgp.bgp.message.update.attribute.large_community import LargeCommunity

LEGACY_TO_LARGE = {
    (65000, 10): (65000, 100, 10),
    (65000, 20): (65000, 100, 20),
}

def translate(update):
    for comm in update.attribute('community'):
        asn, val = comm.value
        if (asn, val) in LEGACY_TO_LARGE:
            ga, ld1, ld2 = LEGACY_TO_LARGE[(asn, val)]
            update.add_attribute(LargeCommunity.new(ga, ld1, ld2))
            # Optionally remove the legacy community if contract demands
            update.del_attribute('community')
    return update

The translator sits as a policy enforcement point between the peer’s inbound session and the local BGP import process. Correctness is verified by confirming that the identity boundary (the large‑community triple) is present on the route after translation and before any local import policy runs.


Assessing Containment Contract Effectiveness

Metrics for Evaluation

MetricDescription
Detection RatePercentage of policy‑violating routes that are correctly dropped or re‑marked at the boundary.
False‑Positive RatePercentage of legitimate routes incorrectly blocked or altered.
False‑Negative RatePercentage of violating routes that leak across the boundary.
Translation LatencyAverage time (µs) added by the policy translator to process an UPDATE.
Policy Drift FrequencyNumber of deviations per month between the contract source and rendered router policies.
Namespace Collision CountOccurrences where two independent operators assign the same community value causing unintended matches.
Operational OverheadEffort (person‑hours) required to maintain translation tables, templates, and validation scripts.

Operators should collect these metrics continuously (e.g., via flow‑sampling, BGP monitoring tools, and automated policy‑as‑code CI pipelines). A containment contract is considered effective when:

Conclusion

Large communities provide a substantially larger, semantically richer namespace that reduces the likelihood of accidental collisions and enables lossless translation between legacy and modern formats. When multiple operators, templates, and policy translators interact with a route, the deterministic preservation of the community triple is more reliably achieved with large communities, leading to higher detection rates, lower false‑positive/negative rates, and minimal operational overhead. Consequently, large communities make a superior choice for cross‑domain containment contracts in complex, multi‑operator environments.


Share this post on:

Previous Post
Not Every Paging Alert Deserves Auto-Remediation
Next Post
RSS imbalance versus real NIC drops