In BGP configuration especially where Multihoming scenarios are used, AS prepend is one of commonly used a BGP feature which is used for path manipulation to influence the direction of the incoming traffic to an AS.
As a general understanding, AS prepend is applied only in an outbound direction to affect the incoming traffic to an AS.
Related – What is VRF
However, in this post, we will configure the AS prepend feature to IN direction and see how we can still achieve the same path manipulation as we could have achieved when AS prepend applied in OUT direction.
In this topology, on R1 we are getting the route R4 (184.108.40.206) from two routers R2 & R3. Without any traffic manipulation we see we are able to reach R4 from R1 via path R1 -> R3 -> R4.
R1#traceroute 220.127.116.11 source 18.104.22.168
We will now apply BGP AS prepend on R3 inbound to make path R1 -> R2 -> R4 the preferred path to reach router R4.
Now we have applied route-map in-prepend in inbound direction on R3 to make the AS-Path for 22.214.171.124 via R3 the longer one.
Verifying now on R1 we see the path via R2 is best and via R3 is not preferred anymore as it has longer AS-path.
Below is the Traceroute output to validate the expected output after configuration change –
Related – Interview Questions of BGP