Repository navigation
RT Constraint
Route Target Constraint (RTC, RFC 4684) is the BGP address family AFI 1, SAFI 132. A speaker uses it to tell a peer, usually a route reflector, which VPN routes it wants: those carrying a route target it has announced membership of. Without it, a route reflector sends every VPN route to every PE, and each PE throws away the ones no VRF imports.
ExaBGP 6.0.0 and later. 5.x negotiates RTC by default but cannot list
ipv4 rtcin a family block, cannot announce membership, and misreads a prefix shorter than 96 bits.
RTC changes what the peer sends. Once it is negotiated, a route reflector which filters by membership (RFC 4684 section 6) sends VPN routes only for the route targets ExaBGP announced: if it announced none, ExaBGP receives no VPN routes at all, on a session which looks healthy.
-
6.0.0: RTC is negotiated only when asked for, with
ipv4 rtcorfamily { all; }. A neighbor with nofamilyblock leaves it out. If you enable it, announce what you want, orrtc defaultfor every VPN route. -
5.x: RTC is in the default family set, so a neighbor with no
familyblock (or withfamily { all; }) negotiates it and cannot announce membership. If VPN routes do not arrive from a route reflector with RTC enabled, list your families explicitly and leave RTC out.
- Negotiated but Silent
- What ExaBGP Does
- The NLRI
- Configuration
- API
- Receiving Membership
- Router Configuration
- References
ExaBGP signals membership:
-
family { ipv4 rtc; }negotiates (1, 132) in the MULTIPROTOCOL capability - membership is announced and withdrawn from the configuration and from the API
- membership a peer sends is decoded and handed to the API as JSON
- an End-of-RIB for (1, 132) is sent once the initial routes are out, with or without graceful restart, as RFC 4684 section 6 asks
By default ExaBGP does not filter the VPN routes it sends by the membership its peer announces.
RFC 4684 section 5 allows a speaker to take part without that filtering, "although this is
discouraged". In 6.0, route-target-filter true; on the neighbor turns the filtering on: when RTC
was negotiated, the IPv4/IPv6 VPN and EVPN routes sent to that peer are only those carrying a route
target covered by the membership it advertised, and a change of membership sends what is now
covered and withdraws what no longer is. The filter needs the neighbor's adj-rib-in and adj-rib-out,
which are on unless disabled. Without it, a program which announces VPN routes and wants to honour
the peer's membership has that membership on the API and decides what to announce.
The filter compares the type of a membership and of a route's Route Target with only the Transitive bit cleared, on both sides (RFC 4360 2). A membership of type 0x80 or 0x82 with sub-type 2, which is no Route Target, does not admit the Route Target of type 0x00 or 0x02 it resembles, which earlier 6.0.0 development snapshots let through.
The usual deployment is ExaBGP as a PE-like speaker next to a route reflector which does the filtering: ExaBGP announces the route targets its VRFs (or the programs behind it) import, and the route reflector only sends it VPN routes carrying one of them.
RFC 4684 section 4 encodes membership as a prefix of 0 to 96 bits:
+-------------------------------+
| origin as (4 octets) |
+-------------------------------+
| route target (8 octets) |
+-------------------------------+
- 96 bits: an origin AS and a full route target, "send me VPN routes with this route target"
- 0 bits: the default route target, "send me every VPN route", typically a route reflector talking to one of its PE clients
- 32 to 95 bits: an origin AS and the start of a route target, for instance every route target of one global administrator. ExaBGP decodes these but cannot configure them
The origin AS is the AS originating the membership. It lets BGP path selection prune the distribution graph between ASes; inside one AS it is normally the local AS.
neighbor 192.0.2.1 {
router-id 192.0.2.2;
local-address 192.0.2.2;
local-as 65001;
peer-as 65001;
family {
ipv4 rtc;
ipv4 mpls-vpn;
}
announce {
ipv4 {
rtc origin-as 65001 route-target 65001:100 next-hop self;
rtc origin-as 65001 route-target 192.0.2.2:200 next-hop self;
rtc origin-as 65001 route-target 4200000000:300 next-hop self;
}
}
}
The same lines can go in a static { } section. The default route target is:
neighbor 192.0.2.1 {
router-id 192.0.2.2;
local-address 192.0.2.2;
local-as 65001;
peer-as 65001;
family {
ipv4 rtc;
}
static {
rtc default next-hop self;
}
}
| Field | Value |
|---|---|
origin-as |
The AS originating the membership, plain (65001) or dotted (1.1) |
route-target |
<asn>:<number>, <ip>:<number>, or with a target: prefix |
default |
The zero-length default route target. Takes no origin-as or route-target
|
next-hop |
An address or self. Carried in MP_REACH_NLRI only |
The field is origin-as and not origin: every RTC UPDATE also carries the ORIGIN path attribute
(RFC 4760 section 3), and origin igp|egp|incomplete keeps its usual meaning on an RTC route, with
the other path attributes (as-path, local-preference, med, community, large-community,
extended-community, originator-id, cluster-list, attribute).
A route target is written the way extended-community target: writes it:
| Written | Type (RFC 4360, RFC 5668) |
|---|---|
65001:100 |
0x00, two octet AS, four octet number |
192.0.2.2:200 |
0x01, IPv4 address, two octet number |
4200000000:300, or 65001L:300 to force it |
0x02, four octet AS, two octet number |
#!/usr/bin/env python3
import sys
def send(command):
"""Write one command, then read lines until ExaBGP answers it."""
sys.stdout.write('peer * ' + command + '\n')
sys.stdout.flush()
while True:
line = sys.stdin.readline()
if not line: # ExaBGP closed the pipe: it is stopping
sys.exit(0)
answer = line.strip()
if answer == 'done':
return True
if answer == 'error':
sys.stderr.write(f'ExaBGP refused: {command}\n')
return False
# the VRFs behind this speaker import these route targets
for target in ('65001:100', '65001:200'):
send(f'announce ipv4 rtc origin-as 65001 route-target {target} next-hop self')
# a VRF is removed
send('withdraw ipv4 rtc origin-as 65001 route-target 65001:200')
for line in sys.stdin:
passThe program reads ExaBGP's answer after each command, as Reading the answers explains. ExaBGP 6.0 writes these commands with a peer * selector, which send() adds in front of each one, see How a program talks to ExaBGP.
| Command | |
|---|---|
announce ipv4 rtc origin-as <asn> route-target <rt> next-hop <ip|self> [attributes] |
Announce membership |
announce ipv4 rtc default next-hop <ip|self> [attributes] |
Announce the default route target |
withdraw ipv4 rtc origin-as <asn> route-target <rt> |
Withdraw membership |
withdraw ipv4 rtc default |
Withdraw the default route target |
What a peer announces reaches the API process as JSON. For a peer announcing a full route target, a 64 bit prefix and the default route target in one UPDATE:
{
"type": "update",
"neighbor": {
"address": { "local": "127.0.0.1", "peer": "127.0.0.1" },
"message": {
"update": {
"attribute": { "origin": "igp", "local-preference": 100 },
"announce": {
"ipv4 rtc": {
"192.0.2.1": [
{ "origin": 65001, "route-target": "target:65001:100" },
{ "origin": 65001, "route-target": null, "prefix-length": 64, "route-target-prefix": "0x0002FDE9" },
{ "origin": 0, "route-target": null }
]
}
}
}
}
}
}-
originis the origin AS of the NLRI, not the ORIGIN attribute - a full route target has
route-targetand nothing else - a prefix shorter than 96 bits has a null
route-target, itsprefix-lengthin bits, and the octets of the route target it does carry inroute-target-prefix - the default route target is origin
0with a nullroute-target
The peer has to enable the family too; vendors name it differently (route-target, rt-filter, rtfilter), so check your platform's documentation. Whether the route reflector filters VPN routes by membership, and what it does before it has received your End-of-RIB, is its decision, not ExaBGP's.
- RFC 4684: Constrained Route Distribution for BGP/MPLS IP Virtual Private Networks
- RFC 4360: BGP Extended Communities Attribute
- RFC 5668: 4-Octet AS Specific BGP Extended Community
- RFC 4760: Multiprotocol Extensions for BGP-4
- L3VPN Overview
- Text API Reference
Getting Started
Configuration
- Configuration Syntax
- Neighbor Configuration
- Directives A-Z
- Syntax Reference
- Templates
- Environment Variables
- Process Configuration
API
- API Overview
- Text API Reference
- JSON API Reference
- API Commands
- Writing API Programs
- Error Handling
- Production Best Practices
Address Families
- Overview
- IPv4 Unicast
- IPv6 Unicast
- FlowSpec
- EVPN
- L3VPN
- BGP-LS
- VPLS
- SRv6 / MUP
- Multicast
- RT Constraint
Features
Use Cases
Tools
Operations
Reference
- Architecture
- Design
- Attribute Reference
- Command Reference
- BGP State Machine
- Capabilities
- Communities
- Examples Index
- Glossary
- RFC Support
Integration
Migration
Community
External