To configure BGP to advertise the local-as instead of the router's own AS in the routes advertised to the neighbor, use the neighbor local-as command. This command is only allowed on the external BGP neighbors. A neighbor can inherit this configuration from a peer template.
| Default | No local AS is configured by default on a peer. |
| Format | neighbor { ip-address | autodetect interface interface-name } local-as as-number no-prepend replace-as |
| Mode | IPv4 VRF Address Family Config |
| Parameter | Description |
|---|---|
| ip-address | The neighbor's IPv4 address. |
| autodetect interface interface-name | The routing interface on which the neighbor's link local IPv6 address is auto-detected. |
| local-as as-number | The AS number to advertise as the local AS in the AS PATH sent to the neighbor. |
| no-prepend | Does not prepend the local-AS in the AS PATH received in the updates from this neighbor. |
| replace-as | Replaces the router's own AS with the local-AS in the AS PATH sent to the neighbor. |
Example:
(R1) (Config)# router bgp 65000 (R1) (Config-router)# neighbor 172.20.1.2 remote-as 65001 (R1) (Config-router)# neighbor 172.20.1.2 local-as 65002 no-prepend replace-as (R1) (Config-router)# neighbor 2001::2 remote-as 65003 (R1) (Config-router)# neighbor 2001::2 local-as 65002 no-prepend replace-as