This is another method on how AS Path attribute can be used to influence incoming traffic..There are two methods which are usually used to influence routes towards your AS..One of this is AS PATH and the other is MED…The only difference between the two is that MED is only advertise to the neighbor AS and not beyond your neighbor AS…Example, if I have AS1 , AS2 and AS3…AS1 is peered to AS2 and AS2 is peered to AS3…If I used MED on AS1 to influence my path towards AS1 (assuming I’m running IBGP within AS1), AS2 will not advertise metrics to AS3…
The difference with AS Path is that , it’s a transitive attributes and AS Number can be shared along the AS Path…Concept is that the longer the AS PATH , it will be less preferred… This can be done using the AS-PATH PREPEND command…
I will be using the following topology…
Here are my configurations:
R1:
R1#sh run | sec bgp
router bgp 100
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 172.16.12.2 remote-as 200
neighbor 172.16.13.3 remote-as 200
R2:
R2#sh run | sec bgp
router bgp 200
bgp log-neighbor-changes
network 23.23.23.0 mask 255.255.255.0
neighbor 172.16.12.1 remote-as 100
R3:
R3#sh run | sec bgp
router bgp 200
bgp log-neighbor-changes
network 23.23.23.0 mask 255.255.255.0
neighbor 172.16.13.1 remote-as 100
By default, as we can see below, the route towards 23.23.23.0/24 will be installed in R1 with R2 as the next hop router..
R1#sh ip bgp
BGP table version is 2, local router ID is 1.1.1.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
*> 23.23.23.0/24 172.16.12.2 0 0 200 i
* 172.16.13.3 0 0 200 i
R1#
Let me influence R1 in such a way that this same Prefix will be reachable via R3…
First, let me create a route-map that would prepend the AS of R2..
neighbor 172.16.12.2 route-map SET-AS-PATH in
route-map SET-AS-PATH permit 10
set as-path prepend 200 200 200
R1#
Finally, I would need to apply the route-map INBOUND with my BGP neighbors towards R2…
R1(config)#router bgp 100
R1(config-router)#neighbor 172.16.12.2 route-map SET-AS-PATH in
R1(config-router)#^Z
R1#clear ip bgp *
R1#
*Oct 22 12:42:40.383: %BGP-5-ADJCHANGE: neighbor 172.16.12.2 Down User reset
*Oct 22 12:42:40.387: %BGP_SESSION-5-ADJCHANGE: neighbor 172.16.12.2 IPv4 Unicast topology base removed from session User reset
*Oct 22 12:42:40.391: %BGP-5-ADJCHANGE: neighbor 172.16.13.3 Down User reset
*Oct 22 12:42:40.395: %BGP_SESSION-5-ADJCHANGE: neighbor 172.16.13.3 IPv4 Unicast topology base removed from session User reset
*Oct 22 12:42:41.227: %BGP-5-ADJCHANGE: neighbor 172.16.13.3 Up
R1#sh ip bgp
BGP table version is 3, local router ID is 1.1.1.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
*> 1.1.1.0/24 0.0.0.0 0 32768 i
*> 23.23.23.0/24 172.16.13.3 0 0 200 i
* 172.16.12.2 0 0 200 200 200 200 i
R1#
R1#ping 23.23.23.23 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.23.23.23, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/54/56 ms
R1#
R1#traceroute 23.23.23.23 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 23.23.23.23
VRF info: (vrf in name/id, vrf out name/id)
1 172.16.13.3 56 msec 52 msec 56 msec
R1#

Leave a comment