{"id":196,"date":"2026-08-13T00:00:00","date_gmt":"2026-08-12T20:30:00","guid":{"rendered":"https:\/\/www.anynet.ir\/blog\/%d8%a2%d9%85%d9%88%d8%b2%d8%b4-bgp-%d9%88-%d9%82%d8%a7%d8%a8%d9%84%db%8c%d8%aa-only-to-customer-otc-%d8%af%d8%b1-rfc-9234-%d8%a8%d8%b1%d8%a7%db%8c-cisco-ios-xr-en\/"},"modified":"2026-10-19T09:53:20","modified_gmt":"2026-10-19T06:23:20","slug":"%d8%a2%d9%85%d9%88%d8%b2%d8%b4-bgp-%d9%88-%d9%82%d8%a7%d8%a8%d9%84%db%8c%d8%aa-only-to-customer-otc-%d8%af%d8%b1-rfc-9234-%d8%a8%d8%b1%d8%a7%db%8c-cisco-ios-xr-en","status":"publish","type":"post","link":"https:\/\/www.anynet.ir\/blog\/en\/%d8%a2%d9%85%d9%88%d8%b2%d8%b4-bgp-%d9%88-%d9%82%d8%a7%d8%a8%d9%84%db%8c%d8%aa-only-to-customer-otc-%d8%af%d8%b1-rfc-9234-%d8%a8%d8%b1%d8%a7%db%8c-cisco-ios-xr-en\/","title":{"rendered":"RFC 9234 BGP Only-to-Customer (OTC) on IOS XR"},"content":{"rendered":"<div><\/div>\n<div>\n<div><\/div>\n<div><\/div>\n<\/div>\n<div>\n<div>\n<div>\n<h2 style=\"color: rgb(26, 26, 26); font-weight: 700\">1. Introduction<\/h2>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">1.1 Overview<\/h3>\n<p>Defined in RFC 9234, the BGP Only-to-Customer (OTC) attribute helps prevent and detect route leaks between Autonomous Systems (ASes), reducing the risk that an AS unintentionally provides transit between its Providers or Peers. OTC applies route-leak rules based on the BGP Role of each eBGP session. The operator configures the role from the perspective of the local AS. The neighbor configures its own role for the same session. For example, one side uses Provider and the other side uses Customer.<\/p>\n<p>OTC is complementary to Autonomous System Provider Authorization (ASPA), which is featured in the next XRdocs BGP tutorial, but does not replace it. OTC does not replace route policy, prefix filtering, or Resource Public Key Infrastructure (RPKI) Route Origin Validation either, because these features have different purposes. Route Origin Validation checks whether a Route Origin Authorization (ROA) permits an AS to originate a prefix. OTC uses the configured BGP Roles to prevent or detect advertisements in a direction that is not allowed.<\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">1.2 What is OTC?<\/h3>\n<p>Only-to-Customer (OTC) is an optional transitive BGP path attribute used for route-leak prevention and detection. It uses path attribute type code <code>35<\/code> and carries one four-octet AS number.<\/p>\n<p>When an eBGP router advertises a prefix to a downstream Customer, it marks the prefix with OTC. If an eBGP neighbor receives the OTC-marked route from its downstream Customer, it identifies the route as a route leak.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-basic-operation-1787931316649.webp\" alt=\"OTC marks a Customer-facing route and blocks its advertisement to another Provider\"><\/p>\n<p><em>Figure 1. OTC marks a Customer-facing route and prevents an advertisement to another Provider.<\/em><\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">1.3 OTC local roles<\/h3>\n<p>OTC uses a local role for each eBGP session. The role defines the relationship of the local AS with the remote AS.<\/p>\n<p>The BGP Role Capability carries the configured local role. It uses capability code <code>9<\/code>. The eBGP neighbors exchange this capability in their BGP OPEN messages when the session starts. Each neighbor sends its own local role.<\/p>\n<p>The following table shows all OTC local roles and their meanings:<\/p>\n<table class=\"english-numbers\">\n<thead>\n<tr>\n<th>Local role<\/th>\n<th>Meaning<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Provider<\/td>\n<td>The local AS provides transit to the remote AS.<\/td>\n<\/tr>\n<tr>\n<td>Customer<\/td>\n<td>The local AS receives transit from the remote AS.<\/td>\n<\/tr>\n<tr>\n<td>Peer<\/td>\n<td>The two ASes exchange selected routes without providing transit to each other.<\/td>\n<\/tr>\n<tr>\n<td>Route Server (RS)<\/td>\n<td>The local system is a Route Server.<\/td>\n<\/tr>\n<tr>\n<td>Route Server Client (RS-Client)<\/td>\n<td>The local AS is a client of a Route Server.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The following local and remote role pairs are valid:<\/p>\n<table class=\"english-numbers\">\n<thead>\n<tr>\n<th>Local role<\/th>\n<th>Remote role<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Provider<\/td>\n<td>Customer<\/td>\n<\/tr>\n<tr>\n<td>Customer<\/td>\n<td>Provider<\/td>\n<\/tr>\n<tr>\n<td>Peer<\/td>\n<td>Peer<\/td>\n<\/tr>\n<tr>\n<td>Route Server<\/td>\n<td>Route Server Client<\/td>\n<\/tr>\n<tr>\n<td>Route Server Client<\/td>\n<td>Route Server<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Provider and Customer are a valid pair. For a Peer relationship, both routers use the Peer role. Provider and Peer are not a valid pair because the roles do not match.<\/p>\n<p>If both neighbors send the capability, the two roles must form a valid pair. If only one neighbor sends it, the result depends on whether loose or strict mode is used. Section 1.4 explains both modes.<\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">1.4 Loose and strict modes<\/h3>\n<p>OTC supports two modes for checking the roles exchanged between eBGP neighbors: loose mode and strict mode.<\/p>\n<p>Loose mode does not require the remote neighbor to send the BGP Role Capability. If only one neighbor sends the capability, the eBGP session can still be established. The OTC-enabled neighbor uses its configured local role for OTC processing. The remote role is inferred from the local role. For example, local role Provider implies remote role Customer. An inferred role does not confirm the configuration on the remote neighbor.<\/p>\n<p>Strict mode requires the remote neighbor to send the BGP Role Capability. In both modes, the two roles must form a valid pair when both neighbors send the capability. A missing capability in strict mode or an invalid role pair causes a Role Mismatch Notification (OPEN Message Error, <code>code 2<\/code>, <code>subcode 11<\/code>). In both cases, the eBGP session does not come up.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-role-negotiation-1787847614833.webp\" alt=\"A Provider and a Customer exchange the BGP Role Capability in their BGP OPEN messages in strict mode\"><\/p>\n<p><em>Figure 2. BGP Role Capability exchange between a Provider and a Customer in strict mode.<\/em><\/p>\n<p>The routers exchange their roles only when the session starts. A change to the configured OTC role resets the eBGP session. The routers then send new OPEN messages with the new roles.<\/p>\n<h2 style=\"color: rgb(26, 26, 26); font-weight: 700\">2. IOS XR implementation<\/h2>\n<p>The OTC feature described in this guide is supported starting with Cisco IOS XR Release 26.4.1. General BGP Route Server functionality is not supported in IOS XR, so the <code>route-server<\/code> local role is not configurable. The Route Server rows in the tables that follow describe the behavior defined by RFC 9234.<\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.1 Configuring OTC roles<\/h3>\n<p>To enable OTC on an IOS XR eBGP session, configure <code>otc-local-role<\/code> under the BGP neighbor configuration. The value defines the local role toward that neighbor. Configure each end from its own point of view. For a Provider-to-Customer relationship, the Provider uses local role <code>provider<\/code>, and the Customer uses local role <code>customer<\/code>.<\/p>\n<p>The configuration examples use AS numbers <code>65540<\/code>, <code>65545<\/code>, and <code>65550<\/code> from the RFC 5398 range reserved for documentation.<\/p>\n<p>Configuration example:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor X.X.X.X\n<\/span><span> remote-as 65545\n<\/span><span> <mark>otc-local-role { customer | provider | peer | route-server-client} [strict<\/mark>]\n<\/span><\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-provider-customer-roles-1787847607152.webp\" alt=\"Topology showing the Provider and Customer OTC local roles configured on the R1-R2 eBGP session\"><\/p>\n<p><em>Figure 3. OTC local roles on a Provider-to-Customer eBGP session.<\/em><\/p>\n<p>R1 is configured as Provider toward R2:<\/p>\n<pre><code><span>router bgp 65545\n<\/span><span> neighbor 10.10.10.2\n<\/span><span> <mark>otc-local-role provider<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R2 is configured as Customer toward R1:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 10.10.10.1\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R3 is configured as Customer toward R5:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 11.11.11.4\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R5 is configured as Provider toward R3:<\/p>\n<pre><code><span>router bgp 65550\n<\/span><span> neighbor 11.11.11.3\n<\/span><span> <mark>otc-local-role provider<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.2 Basic role verification<\/h3>\n<p>Use the detailed neighbor command on both routers. The following R1 output verifies the Provider-to-Customer role pair:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R1# show bgp neighbor 10.10.10.2 detail\n<\/span><span>BGP neighbor is 10.10.10.2\n<\/span><span> Remote AS 65540, local AS 65545, external link\n<\/span><span> Remote router ID 192.168.0.2\n<\/span><span> BGP state = Established\n<\/span><span> <mark>OTC Local Mode: Loose<\/mark>\n<\/span><span> <mark>OTC Local Role: Provider<\/mark>\n<\/span><span> <mark>OTC Remote Role: Customer (received)<\/mark>\n<\/span><span>Neighbor capabilities: Adv Rcvd\n<\/span><span> 4-byte AS: Yes Yes\n<\/span><span> Address family IPv4 Unicast: Yes Yes\n<\/span><span> OTC Role: Yes Yes\n<\/span><\/code><\/pre>\n<p>The local and remote roles must form a valid pair. <code>received<\/code> means that the neighbor sent its role. <code>Yes\/Yes<\/code> means that both routers sent the BGP Role Capability.<\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.3 Loose mode configuration and output<\/h3>\n<p>Loose mode is the default, so no additional keyword is required. In this example, R3 is configured as Customer toward R5, but no OTC role is configured on R5 toward R3.<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 11.11.11.4\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>If R5 does not send a BGP Role, R3 can keep the session up. R3 shows the remote role as inferred:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R3# show bgp neighbor 11.11.11.4 detail\n<\/span><span>BGP neighbor is 11.11.11.4\n<\/span><span> Remote AS 65550, local AS 65540, external link\n<\/span><span> Remote router ID 11.11.11.4\n<\/span><span> BGP state = Established\n<\/span><span> OTC Local Mode: Loose\n<\/span><span> OTC Local Role: Customer\n<\/span><span> <mark>OTC Remote Role: Provider (inferred)<\/mark>\n<\/span><span>Neighbor capabilities: Adv Rcvd\n<\/span><span> 4-byte AS: Yes Yes\n<\/span><span> Address family IPv4 Unicast: Yes Yes\n<\/span><span> OTC Role: Yes No\n<\/span><\/code><\/pre>\n<p>Loose mode can apply OTC processing when only one router advertises the BGP Role Capability. A missing capability means that the neighbor has no local role configured, which is not necessarily the same as the neighbor not supporting BGP Roles. The configured local role controls OTC processing on R3.<\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.4 Strict mode configuration and session reset<\/h3>\n<p>Strict mode is configured locally. It requires the remote eBGP neighbor to send the BGP Role Capability. The advertised roles must form a valid pair. In this example, strict mode is configured on both neighbors.<\/p>\n<p>R1 configuration:<\/p>\n<pre><code><span>router bgp 65545\n<\/span><span> neighbor 10.10.10.2\n<\/span><span> <mark>otc-local-role provider strict<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R2 configuration:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 10.10.10.1\n<\/span><span> <mark>otc-local-role customer strict<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>After the configuration is committed, IOS XR resets the eBGP session. The reset is required because the neighbors exchange their roles in the BGP OPEN message.<\/p>\n<pre><code><span>%ROUTING-BGP-5-ADJCHANGE: neighbor 10.10.10.2 Down - OTC local role changed (CEASE notification sent - configuration change)\n<\/span><span>%ROUTING-BGP-5-ADJCHANGE: neighbor 10.10.10.2 Up\n<\/span><\/code><\/pre>\n<p>After the session comes up, verify the mode and roles:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R1# show bgp neighbor 10.10.10.2 detail\n<\/span><span>BGP neighbor is 10.10.10.2\n<\/span><span> Remote AS 65540, local AS 65545, external link\n<\/span><span> Remote router ID 192.168.0.2\n<\/span><span> BGP state = Established\n<\/span><span> <mark>OTC Local Mode: Strict<\/mark>\n<\/span><span> <mark>OTC Local Role: Provider<\/mark>\n<\/span><span> <mark>OTC Remote Role: Customer (received)<\/mark>\n<\/span><span>Neighbor capabilities: Adv Rcvd\n<\/span><span> 4-byte AS: Yes Yes\n<\/span><span> Address family IPv4 Unicast: Yes Yes\n<\/span><span> OTC Role: Yes Yes\n<\/span><\/code><\/pre>\n<p>In strict mode, the session does not come up if the remote capability is missing. In either mode, the session does not come up if the roles do not form a valid pair. For example, changing R2 to Provider while R1 is also Provider creates a mismatch:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 10.10.10.1\n<\/span><span> <mark>otc-local-role provider strict<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R1 reports the resulting mismatch:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R1# show bgp neighbor 10.10.10.2 detail | include \"Last reset\"\n<\/span><span> <mark>Last reset 00:00:06, due to BGP Notification sent: OTC role mismatch<\/mark>\n<\/span><\/code><\/pre>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.5 OTC rules<\/h3>\n<p>The OTC rules define how a router processes the OTC attribute based on the role of the eBGP neighbor. Three ingress rules apply when a route is received. Two egress rules apply when a route is advertised. The rules define when OTC is added, when a route becomes ineligible, and when a route must not be advertised.<\/p>\n<table class=\"english-numbers\">\n<thead>\n<tr>\n<th>Rule<\/th>\n<th>Direction<\/th>\n<th>Condition<\/th>\n<th>Required action<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>IR1<\/td>\n<td>Ingress<\/td>\n<td>OTC is present on a route from a Customer or RS-Client.<\/td>\n<td>The leaked path is not accepted for BGP route selection and is not advertised to other BGP neighbors.<\/td>\n<\/tr>\n<tr>\n<td>IR2<\/td>\n<td>Ingress<\/td>\n<td>OTC is present on a route from a Peer, and OTC is not equal to the remote AS number.<\/td>\n<td>The leaked path is not accepted for BGP route selection and is not advertised to other BGP neighbors.<\/td>\n<\/tr>\n<tr>\n<td>IR3<\/td>\n<td>Ingress<\/td>\n<td>OTC is absent on a route from a Provider, Peer, or RS.<\/td>\n<td>Add OTC with the remote AS number.<\/td>\n<\/tr>\n<tr>\n<td>ER1<\/td>\n<td>Egress<\/td>\n<td>OTC is absent on a route sent to a Customer, Peer, or RS-Client.<\/td>\n<td>Add OTC with the local AS number.<\/td>\n<\/tr>\n<tr>\n<td>ER2<\/td>\n<td>Egress<\/td>\n<td>OTC is present on a route sent to a Provider, Peer, or RS.<\/td>\n<td>Do not advertise the route.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>RFC 9234 applies these ingress and egress procedures only to the IPv4 and IPv6 unicast address families (AFI 1 and AFI 2 with SAFI 1). They are not applied to other address families by default. Once OTC has been set, its value is preserved unchanged.<\/p>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.5.1 Ingress Rule 1 (IR1)<\/h4>\n<p>When a prefix with OTC is received from a Customer or RS-Client, it is identified as a route leak. The leaked path is not accepted for BGP route selection and is not advertised to other BGP neighbors.<\/p>\n<p>R4 and R3 are configured as Providers. R5 is configured as Customer only toward R3; no OTC role is configured on R5 toward R4:<\/p>\n<pre><code><span>! R5\n<\/span><span>router bgp 65550\n<\/span><span> neighbor 11.11.11.3\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span>! R4\n<\/span><span>router bgp 65540\n<\/span><span> neighbor 12.12.12.4\n<\/span><span> <mark>otc-local-role provider<\/mark>\n<\/span><span> address-family ipv4 unicast\n<\/span><span> <mark>soft-reconfiguration inbound always<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span>!\n<\/span><span>! R3\n<\/span><span>router bgp 65540\n<\/span><span> neighbor 11.11.11.4\n<\/span><span> <mark>otc-local-role provider<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-ir1-ingress-1787847586555.webp\" alt=\"R4 rejects an OTC-marked route received from its Customer R5 under Ingress Rule 1\"><\/p>\n<p><em>Figure 4. R4 identifies an OTC-marked route received from Customer R5 as a route leak.<\/em><\/p>\n<p>R5 sends an OTC-marked prefix to R4. R4 receives the prefix from its Customer and identifies it as a route leak. The path is not accepted or advertised to another BGP neighbor.<\/p>\n<p>The lab deliberately allowed the same AS to be received again so the leak could be reproduced. <code>allowas-in<\/code> was enabled on R4 under the neighbor address family, and R5 disabled the outbound <code>AS_PATH<\/code> loop check:<\/p>\n<pre><code><span>! R4\n<\/span><span>router bgp 65540\n<\/span><span> neighbor 12.12.12.4\n<\/span><span> address-family ipv4 unicast\n<\/span><span> allowas-in\n<\/span><span>!\n<\/span><span>!\n<\/span><span>!\n<\/span><span>! R5\n<\/span><span>router bgp 65550\n<\/span><span> address-family ipv4 unicast\n<\/span><span> as-path-loopcheck out disable\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<blockquote>\n<p><strong style=\"color: rgb(26, 26, 26)\">Note:<\/strong> These loop-prevention exceptions are only for lab testing and should not be used in a production network.<\/p>\n<\/blockquote>\n<p>The neighbor counters and BGP debug identify IR1 as the rejection reason:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R4# show bgp ipv4 unicast neighbors 12.12.12.4 detail | include \"OTC ingress|denied\"\n<\/span><span> <mark>Exact no. of prefixes denied: 56<\/mark>\n<\/span><span> Cumulative no. of prefixes denied: 112\n<\/span><span> <mark>By OTC ingress rule 1: 112, By OTC ingress rule 2: 0<\/mark>\n<\/span><span>RP\/0\/0\/CPU0:R4# debug bgp update in\n<\/span><span><mark>Prefix 18.18.18.0\/24 received from 12.12.12.4 DENIED due to OTC ingress rule 1: route leak from Customer\/RS-Client<\/mark>\n<\/span><\/code><\/pre>\n<p>The route can appear as <code>received-only<\/code> when inbound soft reconfiguration stores it. The route must not become eligible.<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R4# show bgp 18.18.18.0\/24 detail\n<\/span><span>Paths: (3 available, best #1)\n<\/span><span> Path #2: Received by speaker 0\n<\/span><span> Not advertised to any peer\n<\/span><span> 65550 65540, <mark>(received-only)<\/mark>\n<\/span><span> 12.12.12.4 from 12.12.12.4 (11.11.11.4)\n<\/span><span> Origin incomplete, localpref 100, valid, external\n<\/span><span> OTC-AS: 65540\n<\/span><\/code><\/pre>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.5.2 Ingress Rule 2 (IR2)<\/h4>\n<p>When a prefix with OTC is received from a Peer, the OTC AS number must be equal to the remote Peer AS number. If the values are different, the prefix is identified as a route leak and becomes ineligible.<\/p>\n<p>For this test, R4 uses the local Peer role in loose mode and R5 does not advertise a BGP Role toward R4. R4 therefore applies Peer ingress processing to the route received from R5:<\/p>\n<pre><code><span>! R4\n<\/span><span>router bgp 65540\n<\/span><span> neighbor 12.12.12.4\n<\/span><span> <mark>otc-local-role peer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span>! R5\n<\/span><span>router bgp 65550\n<\/span><span> neighbor 12.12.12.5\n<\/span><span> <mark>no otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-ir2-ingress-1787847594748.webp\" alt=\"R4 rejects a route received from a Peer under Ingress Rule 2 because the OTC AS number does not match remote AS 65550\"><\/p>\n<p><em>Figure 5. R4 rejects a Peer route because OTC does not equal remote AS 65550.<\/em><\/p>\n<p>R5 advertises a path whose OTC value is <code>65540<\/code>. Because R5 is in remote AS <code>65550<\/code>, R4 rejects the path under IR2:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R4# show bgp ipv4 unicast neighbors 12.12.12.4 detail | include \"OTC ingress|denied\"\n<\/span><span> Exact no. of prefixes denied: 56\n<\/span><span> Cumulative no. of prefixes denied: 56\n<\/span><span> <mark>By OTC ingress rule 1: 0, By OTC ingress rule 2: 56<\/mark>\n<\/span><span>RP\/0\/0\/CPU0:R4# debug bgp update in\n<\/span><span><mark>Prefix 18.18.18.0\/24 received from 12.12.12.4 DENIED due to OTC ingress rule 2: OTC AS mismatch from Peer<\/mark>\n<\/span><span>RP\/0\/0\/CPU0:R4# show bgp 18.18.18.0\/24 detail\n<\/span><span>Paths: (3 available, best #1)\n<\/span><span> Path #2: Received by speaker 0\n<\/span><span> Not advertised to any peer\n<\/span><span> 65550 65540, (received-only)\n<\/span><span> 12.12.12.4 from 12.12.12.4 (11.11.11.4)\n<\/span><span> Origin incomplete, localpref 100, valid, external\n<\/span><span> <mark>OTC-AS: 65540<\/mark>\n<\/span><\/code><\/pre>\n<p>If the OTC AS number is not equal to the remote AS number, <code>65550<\/code>, the route becomes ineligible. A route with <code>OTC-AS: 65550<\/code> passes the IR2 rule.<\/p>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.5.3 Ingress Rule 3 (IR3)<\/h4>\n<p>When a prefix without OTC is received from a Provider, Peer, or RS, the receiving router adds OTC. The OTC AS number is set to the remote AS number.<\/p>\n<p>R2 is configured with the local Customer role toward R1. No OTC role is configured on R1. In loose mode, R2 therefore infers R1&#8217;s remote role as Provider. R1 sends the route without the OTC attribute:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 10.10.10.1\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span>! R1 has no configured OTC role toward R2.\n<\/span><\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-ir3-ingress-1787847600200.webp\" alt=\"R2 adds OTC with remote AS 65545 to an unmarked route received from Provider R1 under Ingress Rule 3\"><\/p>\n<p><em>Figure 6. R2 adds remote AS 65545 to an unmarked route received from Provider R1.<\/em><\/p>\n<p>The R2 BGP table confirms that IR3 stored the AS number of the inferred Provider in OTC:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R2# show bgp 192.168.0.1\/32 detail\n<\/span><span>Paths: (1 available, best #1)\n<\/span><span> 65545\n<\/span><span> 10.10.10.1 from 10.10.10.1 (10.10.10.1)\n<\/span><span> Origin incomplete, metric 0, localpref 100, valid, external, best, group-best\n<\/span><span> <mark>OTC-AS: 65545<\/mark>\n<\/span><\/code><\/pre>\n<p>The UPDATE arrived without OTC. The stored route contains the remote AS number <code>65545<\/code>. This confirms that R2 applied the IR3 rule. If OTC is already present, the router does not change its value.<\/p>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.5.4 Egress Rule 1 (ER1)<\/h4>\n<p>When a prefix is advertised to a Customer, Peer, or RS-Client, add the OTC attribute if it is not present. Set the OTC AS number to the local AS number.<\/p>\n<p>R3 is configured as Provider toward R5, and R5 is configured as Customer toward R3:<\/p>\n<pre><code><span>! R3\n<\/span><span>router bgp 65540\n<\/span><span> neighbor 11.11.11.4\n<\/span><span> <mark>otc-local-role provider<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span>! R5\n<\/span><span>router bgp 65550\n<\/span><span> neighbor 11.11.11.3\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-er1-egress-1787847557420.webp\" alt=\"R3 adds OTC with its local AS 65540 before advertising the route to its Customer R5 under Egress Rule 1\"><\/p>\n<p><em>Figure 7. R3 adds its local AS number before it sends the route to Customer R5.<\/em><\/p>\n<p>No OTC role is configured on the R1-R2 session for this test, so the prefix reaches AS 65540 without OTC and no ingress rule marks it. When R3 advertises the prefix to its Customer R5, ER1 adds OTC with the local AS number of R3. R5 receives the prefix with <code>OTC-AS: 65540<\/code>.<\/p>\n<blockquote>\n<p><strong style=\"color: rgb(26, 26, 26)\">Note:<\/strong> If R2 kept the Customer role used in the IR3 example, R2 would add <code>OTC-AS: 65545<\/code> on ingress. R3 would then preserve that value instead of adding its own, because ER1 only adds OTC when the attribute is absent.<\/p>\n<\/blockquote>\n<p>The route output on R5 shows the complete AS path and OTC value:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R5# show bgp 192.168.0.1\/32 detail\n<\/span><span>Paths: (2 available, best #1)\n<\/span><span> <mark>65540 65545<\/mark>\n<\/span><span> 11.11.11.3 from 11.11.11.3 (192.168.0.3)\n<\/span><span> Origin incomplete, localpref 100, valid, external, best, group-best\n<\/span><span> <mark>OTC-AS: 65540<\/mark>\n<\/span><\/code><\/pre>\n<p>OTC is added to the route advertised from R3 to R5. The route stored on R3 does not have to contain OTC.<\/p>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.5.5 Egress Rule 2 (ER2)<\/h4>\n<p>When a prefix with OTC is advertised to a Provider, Peer, or RS, the advertisement is blocked. This prevents the local AS from becoming a transit AS by mistake.<\/p>\n<p>R3 and R4 are configured as Providers toward R5. R5 is configured as Customer toward both routers:<\/p>\n<p>R3 configuration:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 11.11.11.4\n<\/span><span> <mark>otc-local-role provider<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R5 configuration:<\/p>\n<pre><code><span>router bgp 65550\n<\/span><span> neighbor 11.11.11.3\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span> neighbor 12.12.12.5\n<\/span><span> <mark>otc-local-role customer<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R4 configuration:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 12.12.12.4\n<\/span><span> <mark>otc-local-role provider<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>R3 advertises the prefix to Customer R5 with <code>OTC-AS: 65540<\/code>. Egress Rule 2 prevents R5 from advertising the OTC-marked prefix to its other Provider, R4.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-er2-block-1787847562421.webp\" alt=\"Egress Rule 2 stops R5 from advertising an OTC-marked route to its other Provider R4\"><\/p>\n<p><em>Figure 8. R5 does not advertise an OTC-marked route to its other Provider, R4.<\/em><\/p>\n<p>Confirm that R5 has received the OTC-marked route from R3. R5 can still use the route, but ER2 prevents it from advertising the route to R4:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R5# show bgp 192.168.0.1\/32 detail\n<\/span><span>Paths: (2 available, best #1)\n<\/span><span> Not advertised to any peer\n<\/span><span> Path #1: Received by speaker 0\n<\/span><span> Not advertised to any peer\n<\/span><span> 65540 65545\n<\/span><span> 11.11.11.3 from 11.11.11.3 (192.168.0.3)\n<\/span><span> Origin incomplete, localpref 100, valid, external, best, group-best\n<\/span><span> <mark>OTC-AS: 65540<\/mark>\n<\/span><span> Path #2: Received by speaker 0\n<\/span><span> Not advertised to any peer\n<\/span><span> 65540 65545\n<\/span><span> 12.12.12.5 from 12.12.12.5 (192.168.0.5)\n<\/span><span> Origin incomplete, localpref 100, valid, external\n<\/span><span> OTC-AS: 65540\n<\/span><\/code><\/pre>\n<p>Path #1 is the best path received from R3, so R5 can install and use it. Both paths carry <code>OTC-AS: 65540<\/code>, confirming that they are OTC-marked. <code>Not advertised to any peer<\/code> shows that R5 does not advertise the OTC-marked path to its other Provider, R4. This is the expected ER2 behavior.<\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">2.6 OTC rules table<\/h3>\n<p>The following table covers all combinations, with and without OTC, when both roles are configured or one role is inferred in loose mode. The first column describes the route before egress processing. <code>Configured<\/code> means that the router has a local role and applies the OTC rules. <code>Inferred<\/code> means that the other router derives this missing role from its own configured role; the router with the inferred role does not apply role-based OTC processing.<\/p>\n<div style=\"max-width: 100%\" class=\"table-responsive\">\n<table class=\"english-numbers\">\n<thead>\n<tr>\n<th>OTC present?<\/th>\n<th>Sender role<\/th>\n<th>Receiver role<\/th>\n<th>Sender action<\/th>\n<th>Receiver action<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>No<\/td>\n<td>Provider (configured)<\/td>\n<td>Customer (configured)<\/td>\n<td>Add the local AS number as OTC (ER1).<\/td>\n<td>Accept the route with OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Provider (configured)<\/td>\n<td>Customer (configured)<\/td>\n<td>Advertise and preserve OTC.<\/td>\n<td>Accept the route with OTC unchanged.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Provider (configured)<\/td>\n<td>Customer (inferred)<\/td>\n<td>Add the local AS number as OTC (ER1).<\/td>\n<td>No role-based ingress action; receive the route with OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Provider (configured)<\/td>\n<td>Customer (inferred)<\/td>\n<td>Advertise and preserve OTC.<\/td>\n<td>No role-based ingress action; receive the route with OTC.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Provider (inferred)<\/td>\n<td>Customer (configured)<\/td>\n<td>No role-based egress action; advertise without OTC.<\/td>\n<td>Add the remote Provider AS number as OTC (IR3).<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Provider (inferred)<\/td>\n<td>Customer (configured)<\/td>\n<td>No role-based egress action; advertise with OTC unchanged.<\/td>\n<td>Accept the route with OTC unchanged.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Customer (configured)<\/td>\n<td>Provider (configured)<\/td>\n<td>Advertise without adding OTC.<\/td>\n<td>Accept the route without OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Customer (configured)<\/td>\n<td>Provider (configured)<\/td>\n<td>Do not advertise the route (ER2).<\/td>\n<td>If received contrary to ER2, make the route ineligible (IR1).<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Customer (configured)<\/td>\n<td>Provider (inferred)<\/td>\n<td>Advertise without adding OTC.<\/td>\n<td>No role-based ingress action; receive the route without OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Customer (configured)<\/td>\n<td>Provider (inferred)<\/td>\n<td>Do not advertise the route (ER2).<\/td>\n<td>No route is received.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Customer (inferred)<\/td>\n<td>Provider (configured)<\/td>\n<td>No role-based egress action; advertise without OTC.<\/td>\n<td>Accept the route without OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Customer (inferred)<\/td>\n<td>Provider (configured)<\/td>\n<td>No role-based egress action; advertise with OTC unchanged.<\/td>\n<td>Make the route ineligible (IR1).<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Peer (configured)<\/td>\n<td>Peer (configured)<\/td>\n<td>Add the local AS number as OTC (ER1).<\/td>\n<td>Accept the route because OTC equals the remote AS.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Peer (configured)<\/td>\n<td>Peer (configured)<\/td>\n<td>Do not advertise the route (ER2).<\/td>\n<td>If received contrary to ER2, accept only when OTC equals the remote Peer AS; otherwise, make it ineligible (IR2).<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Peer (configured)<\/td>\n<td>Peer (inferred)<\/td>\n<td>Add the local AS number as OTC (ER1).<\/td>\n<td>No role-based ingress action; receive the route with OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Peer (configured)<\/td>\n<td>Peer (inferred)<\/td>\n<td>Do not advertise the route (ER2).<\/td>\n<td>No route is received.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>Peer (inferred)<\/td>\n<td>Peer (configured)<\/td>\n<td>No role-based egress action; advertise without OTC.<\/td>\n<td>Add the remote Peer AS number as OTC (IR3).<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>Peer (inferred)<\/td>\n<td>Peer (configured)<\/td>\n<td>No role-based egress action; advertise with OTC unchanged.<\/td>\n<td>Accept only when OTC equals the remote Peer AS; otherwise, make it ineligible (IR2).<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>RS (configured)<\/td>\n<td>RS-Client (configured)<\/td>\n<td>Add the local AS number as OTC (ER1).<\/td>\n<td>Accept the route with OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>RS (configured)<\/td>\n<td>RS-Client (configured)<\/td>\n<td>Advertise and preserve OTC.<\/td>\n<td>Accept the route with OTC unchanged.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>RS (configured)<\/td>\n<td>RS-Client (inferred)<\/td>\n<td>Add the local AS number as OTC (ER1).<\/td>\n<td>No role-based ingress action; receive the route with OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>RS (configured)<\/td>\n<td>RS-Client (inferred)<\/td>\n<td>Advertise and preserve OTC.<\/td>\n<td>No role-based ingress action; receive the route with OTC.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>RS (inferred)<\/td>\n<td>RS-Client (configured)<\/td>\n<td>No role-based egress action; advertise without OTC.<\/td>\n<td>Add the remote RS AS number as OTC (IR3).<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>RS (inferred)<\/td>\n<td>RS-Client (configured)<\/td>\n<td>No role-based egress action; advertise with OTC unchanged.<\/td>\n<td>Accept the route with OTC unchanged.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>RS-Client (configured)<\/td>\n<td>RS (configured)<\/td>\n<td>Advertise without adding OTC.<\/td>\n<td>Accept the route without OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>RS-Client (configured)<\/td>\n<td>RS (configured)<\/td>\n<td>Do not advertise the route (ER2).<\/td>\n<td>If received contrary to ER2, make the route ineligible (IR1).<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>RS-Client (configured)<\/td>\n<td>RS (inferred)<\/td>\n<td>Advertise without adding OTC.<\/td>\n<td>No role-based ingress action; receive the route without OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>RS-Client (configured)<\/td>\n<td>RS (inferred)<\/td>\n<td>Do not advertise the route (ER2).<\/td>\n<td>No route is received.<\/td>\n<\/tr>\n<tr>\n<td>No<\/td>\n<td>RS-Client (inferred)<\/td>\n<td>RS (configured)<\/td>\n<td>No role-based egress action; advertise without OTC.<\/td>\n<td>Accept the route without OTC.<\/td>\n<\/tr>\n<tr>\n<td>Yes<\/td>\n<td>RS-Client (inferred)<\/td>\n<td>RS (configured)<\/td>\n<td>No role-based egress action; advertise with OTC unchanged.<\/td>\n<td>Make the route ineligible (IR1).<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The two roles cannot both be inferred on the same session. At least one router must have a configured local role before it can infer the remote role. <code>Inferred<\/code> is a local display convention: no Role Capability was received, and the unconfigured neighbor does not apply OTC processing of its own. An inferred role does not confirm the configuration or behavior of the remote neighbor.<\/p>\n<h2 style=\"color: rgb(26, 26, 26); font-weight: 700\">3. RPL: OTC role per prefix<\/h2>\n<p>The <code>otc-local-role<\/code> configured under a neighbor is the default role for all prefixes on the eBGP session. Routing Policy Language (RPL) can override the default role for prefixes matched by a route policy. This allows different prefix groups on the same session to use different OTC processing. An inbound route policy selects the local role used by the ingress OTC rules for each matched prefix. An outbound route policy selects the local role used by the egress OTC rules.<\/p>\n<p>The override applies to local OTC processing only. The BGP Role Capability is still negotiated once per session, so a per-prefix role is not verified with the neighbor. RFC 9234 Section 6 describes this trade-off: BGP Roles must not be configured on a session with a Complex peering relationship, and an operator who instead uses per-prefix policies has no in-band way to check that both ends agree.<\/p>\n<h3 style=\"color: rgb(26, 26, 26); font-weight: 700\">3.1 Configuration<\/h3>\n<p>The RPL attach point is under the neighbor address-family configuration. A route policy can be attached inbound or outbound:<\/p>\n<pre><code><span>router bgp (local-as-number)\n<\/span><span> neighbor (neighbor-address)\n<\/span><span> address-family (ipv4-or-ipv6) unicast\n<\/span><span> <mark>route-policy (route-policy-name) (in-or-out)<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>The RPL action supports these local roles and is used inside a route policy:<\/p>\n<pre><code><span>route-policy otc_out\n<\/span><span> if...\n<\/span><span> <mark>set otc-local-role { customer | provider | peer | route-server-client}<\/mark>\n<\/span><span> else\n<\/span><span>...\n<\/span><span> endif\n<\/span><span>end-policy\n<\/span><\/code><\/pre>\n<p>An outbound <code>set otc-local-role<\/code> action selects the local role used for Egress Rule 1 and Egress Rule 2. For a matched prefix, the RPL role takes precedence over the <code>otc-local-role<\/code> configured under the neighbor.<\/p>\n<p>The following example shows how RPL changes the neighbor role for one prefix. R5 has the local Customer role toward both R3 and R4. This is the default role for prefixes that do not match the policies. For <code>192.168.0.1\/32<\/code>, the inbound policy changes R5&#8217;s local role from Customer to Provider when R5 receives the route from R3. The outbound policy changes the role from Customer to Peer when R5 sends the route toward R4.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anynet.ir\/blog\/wp-content\/uploads\/2026\/10\/otc-rpl-override-1787847620372.webp\" alt=\"A route policy overrides the neighbor-level Customer role on R5 for a single prefix, inbound from R3 and outbound to R4\"><\/p>\n<p><em>Figure 9. A route policy overrides the neighbor-level Customer role on R5 for one prefix.<\/em><\/p>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">Step 1: Check the default roles and behavior<\/h4>\n<p>R5 has the neighbor-level Customer role toward both routers:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R5# show running-config formal | include otc\n<\/span><span><mark>router bgp 65550 neighbor 11.11.11.3 otc-local-role customer<\/mark>\n<\/span><span><mark>router bgp 65550 neighbor 12.12.12.5 otc-local-role customer<\/mark>\n<\/span><\/code><\/pre>\n<p>Before the RPL policies are attached, the OTC-marked paths are not advertised because R5 uses its default Customer role:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R5# show bgp 192.168.0.1\/32\n<\/span><span>Paths: (2 available, best #1)\n<\/span><span> Not advertised to any peer\n<\/span><span> Path #1: Received by speaker 0\n<\/span><span> <mark>Not advertised to any peer<\/mark>\n<\/span><span> 65540 65545\n<\/span><span> 11.11.11.3 from 11.11.11.3 (192.168.0.3)\n<\/span><span> Origin incomplete, localpref 100, valid, external, best, group-best\n<\/span><span> OTC-AS: 65540\n<\/span><span> Path #2: Received by speaker 0\n<\/span><span> <mark>Not advertised to any peer<\/mark>\n<\/span><span> 65540 65545\n<\/span><span> 12.12.12.5 from 12.12.12.5 (192.168.0.5)\n<\/span><span> Origin incomplete, localpref 100, valid, external\n<\/span><span> OTC-AS: 65540\n<\/span><\/code><\/pre>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">Step 2: Remove the Provider role on R3<\/h4>\n<p>Remove R3&#8217;s neighbor-level Provider role:<\/p>\n<pre><code><span>router bgp 65540\n<\/span><span> neighbor 11.11.11.4\n<\/span><span> <mark>no otc-local-role provider<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>If this role is not removed, R3 adds OTC before it sends the route to R5. R5 then receives an already-marked route, and the test does not clearly show the inbound RPL action.<\/p>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">Step 3: Configure and attach the RPL policies<\/h4>\n<p><code>OTC_complex_pfx<\/code> selects <code>192.168.0.1\/32<\/code>. The inbound policy makes R5 use local role Provider for that prefix when it is received from R3. The outbound policy makes R5 use local role Peer for the same prefix when it is advertised toward R4:<\/p>\n<pre><code><span>prefix-set OTC_complex_pfx\n<\/span><span> <mark>192.168.0.1\/32<\/mark>\n<\/span><span>end-set\n<\/span><span>!\n<\/span><span>route-policy OTC_complex_in\n<\/span><span> if destination in OTC_complex_pfx then\n<\/span><span> <mark>set otc-local-role provider<\/mark>\n<\/span><span> else\n<\/span><span> pass\n<\/span><span> endif\n<\/span><span>end-policy\n<\/span><span>!\n<\/span><span>route-policy OTC_complex_out\n<\/span><span> if destination in OTC_complex_pfx then\n<\/span><span> <mark>set otc-local-role peer<\/mark>\n<\/span><span> else\n<\/span><span> pass\n<\/span><span> endif\n<\/span><span>end-policy\n<\/span><span>!\n<\/span><span>router bgp 65550\n<\/span><span> neighbor 11.11.11.3\n<\/span><span> address-family ipv4 unicast\n<\/span><span> <mark>route-policy OTC_complex_in in<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span> neighbor 12.12.12.5\n<\/span><span> address-family ipv4 unicast\n<\/span><span> <mark>route-policy OTC_complex_out out<\/mark>\n<\/span><span>!\n<\/span><span>!\n<\/span><span>!\n<\/span><\/code><\/pre>\n<p>The policy applies these rules:<\/p>\n<table class=\"english-numbers\">\n<thead>\n<tr>\n<th>Direction and neighbor<\/th>\n<th>Match<\/th>\n<th>Effective local role<\/th>\n<th>Route treatment<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Inbound from R3 (<code>11.11.11.3<\/code>)<\/td>\n<td><code>192.168.0.1\/32<\/code><\/td>\n<td>Provider<\/td>\n<td>R5 treats R3 as a Customer for this prefix. The unmarked route is accepted without adding OTC.<\/td>\n<\/tr>\n<tr>\n<td>Outbound to R4 (<code>12.12.12.5<\/code>)<\/td>\n<td><code>192.168.0.1\/32<\/code><\/td>\n<td>Peer<\/td>\n<td>R5 treats R4 as a Peer, adds <code>OTC-AS: 65550<\/code>, and advertises the route.<\/td>\n<\/tr>\n<tr>\n<td>Inbound from R3 (<code>11.11.11.3<\/code>)<\/td>\n<td>Any other prefix<\/td>\n<td>Customer (neighbor default)<\/td>\n<td>R5 treats R3 as a Provider. If OTC is absent, R5 adds <code>OTC-AS: 65540<\/code>.<\/td>\n<\/tr>\n<tr>\n<td>Outbound to R4 (<code>12.12.12.5<\/code>)<\/td>\n<td>Any other prefix<\/td>\n<td>Customer (neighbor default)<\/td>\n<td>R5 treats R4 as a Provider. ER2 blocks the OTC-marked route.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>After the policies are attached, verify both a non-matching prefix and the matching prefix. The non-matching prefix <code>192.168.1.1\/32<\/code> still uses the default Customer role and is not advertised. The matching prefix <code>192.168.0.1\/32<\/code> uses the RPL roles and is advertised toward R4:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R5# show bgp 192.168.1.1\/32 detail\n<\/span><span>Paths: (2 available, best #1)\n<\/span><span> <mark>Not advertised to any peer<\/mark>\n<\/span><span>RP\/0\/0\/CPU0:R5# show bgp 192.168.0.1\/32\n<\/span><span>Paths: (2 available, best #1)\n<\/span><span> <mark>Advertised IPv4 Unicast paths to peers (in unique update groups):<\/mark>\n<\/span><span> 12.12.12.5\n<\/span><span> Path #1: Received by speaker 0\n<\/span><span> 65540 65545\n<\/span><span> 11.11.11.3 from 11.11.11.3 (192.168.0.3)\n<\/span><span> Origin incomplete, localpref 100, valid, external, best, group-best\n<\/span><\/code><\/pre>\n<h4 style=\"color: rgb(26, 26, 26); font-weight: 700\">Step 4: Verify the outbound attributes<\/h4>\n<p>Normal eBGP processing prepends the R5 AS number <code>65550<\/code> to the AS path. The Peer role selected by the outbound policy then causes ER1 to add <code>OTC-AS: 65550<\/code>:<\/p>\n<pre><code><span>RP\/0\/0\/CPU0:R5# show bgp advertised neighbor 12.12.12.5\n<\/span><span>192.168.0.1\/32 is advertised to 12.12.12.5\n<\/span><span> Path info:\n<\/span><span> neighbor: 11.11.11.3 neighbor router id: 192.168.0.3\n<\/span><span> valid external best\n<\/span><span> Attributes after inbound policy was applied:\n<\/span><span> next hop: 11.11.11.3\n<\/span><span> origin: incomplete neighbor as: 65540\n<\/span><span> aspath: 65540 65545\n<\/span><span> Attributes after outbound policy was applied:\n<\/span><span> next hop: 12.12.12.4\n<\/span><span> origin: incomplete neighbor as: 65540\n<\/span><span> <mark>aspath: 65550 65540 65545<\/mark>\n<\/span><span> <mark>OTC-AS: 65550<\/mark>\n<\/span><\/code><\/pre>\n<p>The output confirms that RPL overrides the neighbor-level OTC role only for the selected prefix. R4 still applies its own configured local role on ingress, so its role determines whether the received route is accepted.<\/p>\n<h2 style=\"color: rgb(26, 26, 26); font-weight: 700\">4. Preserving OTC across networks<\/h2>\n<p>RFC 9234 requires that, once the OTC attribute has been set, it is preserved unchanged. The attribute tells each downstream eBGP neighbor that the route may be advertised only to Customers. If OTC is removed or changed, another eBGP neighbor may advertise the route to a Provider or Peer and create a route leak. Removing it also hides the information that other networks use to detect the leak. For this reason, filtering or modifying OTC weakens the protection provided by RFC 9234, as explained in <a href=\"https:\/\/blog.cloudflare.com\/rfc9234-bgp-role-model\/\" style=\"color: rgb(0, 102, 204)\">Cloudflare&#8217;s article on the RFC 9234 BGP role model<\/a>.<\/p>\n<div title=\"\u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0644 \u0627\u06cc\u0646 \u0628\u062e\u0634\" style=\"display: flex\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\"><\/svg><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction 1.1 Overview Defined in RFC 9234, the BGP Only-to-Customer (OTC) attribute helps prevent and detect route leaks between Autonomous Systems (ASes), reducing\u2026<\/p>\n","protected":false},"author":1,"featured_media":194,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[130,69,37],"tags":[],"class_list":["post-196","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bgp-en","category-iosxr-en-en","category-security-en"],"_links":{"self":[{"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/posts\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/comments?post=196"}],"version-history":[{"count":1,"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/posts\/196\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/posts\/196\/revisions\/198"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/media\/194"}],"wp:attachment":[{"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/media?parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/categories?post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anynet.ir\/blog\/wp-json\/wp\/v2\/tags?post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}