Question


How to remove all the AS path and advertise only with local AS to remote BGP peers?


Solution


1. Create routing peering policy to match all AS and set remove all.


Go to routing peer policy and add term to match with regex (^|[^0-9])[0-9][0-9]*($|[^0-9]) in AS path  and choose "Remove all AS numbers matched by match as-path" under action.

2. Set Local AS Mode to 4 either under group or neighbor level


3. Apply this routing policy to BGP export group.


For any one who prefers to view and verify from CLI:


admin@SDWAN-Branch4-cli(config)% show routing-instances Tenant1-LAN-VR protocols bgp 3033 routing-peer-policy Export-To-LAN-Policy                      

term Remove-All-AS-and-Set-Local-AS {

    match {

        as-path "(^|[^0-9])[0-9][0-9]*($|[^0-9])";

    }

    action {

                    accept;

        as-path      remove-matched;

        rib-bgp-ecmp false;

    }

}

 

admin@SDWAN-Branch4-cli(config)% show routing-instances Tenant1-LAN-VR protocols bgp 3033 group LAN-group                                               

type          external;

family {

    inet {

        unicast {

            prefix-limit-control {

                action drop;

            }

        }

    }

    inet6 {

        unicast {

            prefix-limit-control {

                action drop;

            }

        }

    }

}

enable-alarms false;

local-as-mode mode-4;

neighbor 172.18.41.2 {

    local-as      5000;

    peer-as       5001;

    enable-alarms false;

}

import        Import-From-LAN-Policy;

export        Export-To-LAN-Policy;

[ok][2026-02-11 15:11:40]

 

[edit]

admin@SDWAN-Branch4-cli(config)% run show route table ipv4.unicast routing-instance Tenant1-LAN-VR advertising-protocol bgp neighbor-address 172.18.41.2

 

Routes for Routing instance : Tenant1-LAN-VR  AFI: ipv4  SAFI: unicast

 

 

Prefix/Mask         Next-hop          MED  Lclpref  AS path

-----------         --------          ---  -------  -------

0.0.0.0/0           172.18.41.1       0    0        5000

169.254.0.8/31      172.18.41.1       0    0        5000

172.16.11.0/24      172.18.41.1       0    0        5000

172.16.21.0/24      172.18.41.1       0    0        5000

172.16.31.0/24      172.18.41.1       0    0        5000

172.16.51.0/24      172.18.41.1       0    0        5000

172.18.11.0/24      172.18.41.1       0    0        5000

172.18.21.0/24      172.18.41.1       0    0        5000

172.18.31.0/24      172.18.41.1       0    0        5000

172.18.41.0/24      172.18.41.1       0    0        5000

[ok][2026-02-11 15:11:51]

 

[edit]

admin@SDWAN-Branch4-cli(config)%