Sometimes you end up having wrong BGP AS number throughout your network. It could be a result of an unexpected merger or split or you could have started using a private BGP AS number and realized you have to connect to the Internet using a real AS number. The proper solution would be a total reconfiguration of the whole network, but of course not many engineers have the time and courage to do it ;), so it's time to introduce another kludge: the neighbor local-as configuration command.For example, let's assume your AS number should be 20, but you're using a private AS 65001, as shown in the following figure:To retain the AS 65001 internally but appear as AS 20 to the outside world, you could use the following configuration on R1:
router bgpThis configuration would ensure that the EBGP session with AS 10 is established (R1 pretends that it belongs to AS 20 on this session), but the AS path propagated to AS 30 is somewhat odd …
65001
neighbor 10.0.0.18 remote-as 65001
neighbor 10.0.0.18
description IBGP to R2
neighbor 10.1.0.2 remote-as 10
neighbor
10.1.0.2 local-as 20
neighbor 10.1.0.2 description EBGP to AS
10AS30#show ip bgp | include 20… making your network appear as a set of nested autonomous systems:There are two reasons for the weird AS path:
*>
172.16.0.0 10.1.0.5 0 20 65001 20 10
iTo fix the AS path, you need the BGP Support for Dual AS Configuration introduced in IOS release 12.3T. This feature adds two options to the local-as configuration command:
- R1 inserts local-as into inbound EBGP updates
- R2 (configured like R1) inserts local-as as well as its real AS (65001) in outbound EBGRP update
When the configuration on R1 and R2 includes these two keywords …:
- no-prepend disables local-as prepending on incoming EBGP updates;
- replace-as replaces router's own AS with local-as on outgoing EBGP updates.
router bgp 65001… the path propagated through AS 65001/AS 20 looks as expected:
neighbor 10.1.0.2 remote-as 10
neighbor 10.1.0.2 local-as 20 no-prepend replace-as
neighbor 10.1.0.2
description EBGP to AS 10AS30#show ip bgp | include
20
*> 172.16.0.0 10.1.0.5 0 20 10
iPosted to Cisco IOS Hints and Tricks by IvanPepelnjak
©Copyright Ivan Pepelnjak