I use Cisco with IOSv and would like to change AS number without losing the old BGP configuration.How to change the AS number without losing the old BGP configuration?

1 Answer 1


That's probably more of a coordination job with your bgp peers ( and possibly the given Internet Registry), and less of a local difficulty.

However, I don't see a way to do this without actually bringing the peering sessions down and up again.

But you asked about keeping the configuration, not the running state, so ...

Locally, essentially what you do is:

  • copy the router's current router bgp ... config section into a text file.
  • if the router's BGP config uses access lists, prefix-list and route map configurations with your local AS number in descriptions or names, consider copying/changing/editing them also, for clarity.
  • also remember to look at other config parts where your BGP instance's old AS number might pop up (such as some redistribute bgp ... statements in other routing protocols).
  • copy & edit the file(s) to reflect the new configuration with the new AS number
  • on the router, do no router bgp
  • paste the entire edited config router bgp ... block from the edited text file.
  • remove old (now possibly unused) prefix lists, access lists, route maps etc.

... and if things go wrong, reverse the process and paste the original configuration excerpt.

With your BGP peers:

Have your peers prepare a config with changed remote AS number, but the same other paramers (peer's IP address etc), and have them activate it a the given time.

If this is about public IPs on the Internet, be sure to involve your given Internet Registry (such as RIPE, if in Europe), possibly via your LIR, so that the public IPs (resp. their route objects) are properly registered before being announced from a new/different AS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.