BGP AS Prepend Inbound Configuration Example

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 outbound direction to affect the incoming traffic to an AS.

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.

Topology

In this topology, on R1 we are getting the route R4 (9.9.0.4) 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 9.9.0.4 source 9.9.0.1

Type escape sequence to abort.

Tracing the route to 9.9.0.4

VRF info: (vrf in name/id, vrf out name/id)

1 9.9.13.3 92 msec 28 msec 16 msec

2 9.9.34.4 32 msec 64 msec 52 msec

We will now apply BGP AS prepend on R3 inbound to make path R1 -> R2 -> R4 the preferred path to reach router R4.

 

route-map in-prepend permit 10

set as-path prepend last-as 2

router bgp 100

bgp log-neighbor-changes

neighbor 9.9.0.1 remote-as 100

neighbor 9.9.0.1 update-source Loopback0

neighbor 9.9.0.1 next-hop-self

neighbor 9.9.34.4 remote-as 200

neighbor 9.9.34.4 route-map in-prepend in

Now we have applied route-map in-prepend in inbound direction on R3 to make the AS-Path for 9.9.0.4 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.

R1#sh ip bgp

BGP table version is 3, local router ID is 9.9.0.1

Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,

r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,

x best-external, a additional-path, c RIB-compressed,

Origin codes: i – IGP, e – EGP, ? – incomplete

RPKI validation codes: V valid, I invalid, N Not found

Network                Next Hop           Metric        LocPrf   Weight         Path

*> 9.9.0.1/32        0.0.0.0                 0                             32768             i

*  i 9.9.0.4/32       9.9.0.3                 0                100       0                      200 200 200 i

*>i                           9.9.0.2                 0                100       0                      200 i   <Best Path via R2>

 

Below is the Traceroute output to validate the expected output after configuration change –

R1#traceroute 9.9.0.4 source 9.9.0.1

Type escape sequence to abort.

Tracing the route to 9.9.0.4

VRF info: (vrf in name/id, vrf out name/id)

1 9.9.12.2 76 msec 36 msec 32 msec

2 9.9.24.4 44 msec 88 msec 48 msec

Please follow and like us:

Related Post

Add Comment

Social Media Auto Publish Powered By : XYZScripts.com
Select your currency