Even set "remove-private all" the router is not removing private ASN from the BGP path
See below configuration and outputs example:
show configuration protocols bgp group
v4-customers neighbor 185.64.170.1
description "v4: Enapter BGP
#1";
local-address 185.64.170.0;
import v4-as197759-import;
export [ next-hop-self
v4-export-defaultroute ];
remove-private {
all;
Even though the command is configured
under the protocol, it doesn´t work:
show route receive-protocol bgp
185.64.170.1
inet.0: 935428 destinations, 3279877
routes (935426 active, 0 holddown, 3 hidden)
Prefix Nexthop MED Lclpref AS path
* 45.131.78.0/24 185.64.170.1 197759
197759 197759 197759 197759 65501 65507 I
* 203.159.83.0/24 185.64.170.1 197759 I
Private
ASN 65501-65507 still showing.
The remove-private all knob does not work in your current config because from the documentation remove all private AS numbers from the original path. Do not stop the process of removing private AS numbers, even if a public AS number is encountered.
When advertising AS paths to remote
systems, have the local system strip private AS numbers from the AS path. The numbers are stripped from the AS path starting at the left end of the AS path (the end where AS paths have been most recently added). The routing device stops searching for private ASs when it finds the first nonprivate AS or a peer’s private AS. You can expand or add one or more AS numbers to an AS sequence. The AS numbers are added before the local AS number has been added to the path. Expanding an AS path makes a shorter AS path look longer and therefore less preferable to BGP. The last AS number in the existing path is extracted and prepended n times, where n is a number from 1 through 32.
Currently, the AS path as below, when the router reads the first non-private AS, it stops searching for private ASs, this is working as expected.
show route receive-protocol bgp 185.64.170.1
inet.0:
935428 destinations, 3279877 routes (935426 active, 0 holddown, 3 hidden)
Prefix
Nexthop MED Lclpref AS path
*
45.131.78.0/24 185.64.170.1 197759 197759
197759 197759 197759 65501 65507 I
203.159.83.0/24 185.64.170.1 197759 I
The local AS is at the left end (the end where AS paths have been most recently
added), and private AS are listed after the local AS, then causes the remove-private not to function. It could be managed to resolve by the policy with as-path expand which basically inserts AS number before the local AS.
With this change and remove-private on the EBGP between ASBR's the route should have only your local AS in path.
This change in configuration will not modify in any way the functionality of your policy, but any change in the policy will cause few seconds of traffic impact, so recommend to perform in MW.
Removing the prepend from import to export using as-path-expand and remove-private-all in the export groups.