[AUDIO LOGO]
So let's begin our journey here by taking
a look at AS-Path Prepending.
This is probably the most common and also the easiest way
to influence the return traffic into your AS.
You're simply adding ASes to the path to artificially make
that AS path longer.
And therefore, other devices that are sending traffic to you
will not prefer that path.
So this is actually a fairly easy implementation.
Let's go ahead and take a look at our topology,
get an idea of what we're going to do.
And then we'll jump into the command line
and see AS-Path Prepending in action.
So for the demonstrations in this skill,
we will be using BGP topology 1 if you want
to have that diagram handy.
And for this particular demonstration,
we're going to be taking a look at AS 300
and its return path coming to AS 100.
So what should be happening right now
is router 9 should actually be sending
all of the traffic to router 1.
What we're going to do is we're going
to have router 1 prepend its AS number a few times when sending
its updates to router 9.
And what we'll see is this will cause
router 9 to flip over and start sending the traffic
to router 2.
Now, what makes this inbound path selection is the fact
that we're going to make this configuration change on router
1.
So it's AS 100 that's going to be influencing as 300.
So let's jump into the command line and get started.
We'll begin actually on router 9 to examine its current routes.
So again, let's start by verifying that route.
We'll just do a show ip bgp.
And what we're seeing here is all
of the routes coming from AS 100 are currently
going through router 1.
So we see that there's numerous routes here.
But just to highlight two of them,
we see these first two entries with the next hop of 50.1.19.1
being selected as the best.
And we see that's the same for all of the entries.
So let's go ahead and implement our policy on router 1.
This is a fairly straightforward policy.
We're just going to make a route policy.
We'll call it RP_TO_AS300.
Now, we could of course here use a prefixed
set, as we've done numerous times before,
just to match on certain prefixes.
But in this case, our design goal
was to have all of the traffic returning from AS 300 to AS 100
to come in through router 2.
So in this case, we're going to do this
without specifying the prefixes.
So this will just apply to all of them.
Just keep that in mind as we're writing our policy here.
So without any kind of policy statement,
all we're going to have to say is that we
want to pretend the AS path.
And we see here, we can actually put in any numbers we want.
Technically, you don't have to use your own AS number.
But since own AS is the most common thing to do,
we actually have a special setting for that.
We can just say own-as.
And then we can tell it how many times.
In this case, we'll just go ahead and do 2,
like I had put on our diagram.
Once it's done prepending the path,
then we simply want it to pass the routes through.
We'll end our policy, go into BGP,
go to the neighbor configuration for router 9,
into the address family, and apply our route policy.
This will be an outbound policy because this
is what we're going to be sending to our neighbors.
So this is ready to go.
But before we do it, we want to see
what the update looks like in Wireshark when we actually
implement this.
So let's jump into Wireshark, set up a capture
before we actually commit this change and router 1
sends its update.
So here, we have our capture running on router 1's gigabit 2
interface looking for any BGP traffic other than keepalives.
So now, let's jump back over to our command line
and commit our changes.
So we'll simply say commit.
We'll exit configuration mode.
And let's go ahead and do a show bgp neighbor for router 9.
And let's do an advertised routes.
We can see here on the AS path where we're
prepending our AS two times.
So that's a total of three. .
Remember one of these is the AS that gets put on automatically
on EBGP updates and then the two ASes that we're
adding through our policy.
So now, of course, we want to take a look
at what this looks like in Wireshark and then hop over
and make sure that it made the change we
wanted it to make on router 9.
So back here in Wireshark, I did have
to modify our filter here just a little bit because it
sent a keepalive at the same time as the update messages.
And it ended up matching our filter.
So I did have to take that part of our filter off
to be able to see this.
But here, we can see this message coming from 50.1.19.1
going to router 9, the 50.1.19.9.
And if we look down here and expand the UPDATE Message
and the Path Attributes, we can see here under the Path
Attribute that the AS path is 100 100 100 1,000.
So once again, 3 copies, one that's
normal for EBGP and then the two that, of course,
we're adding through our policy.
Now, let's jump over to router 9 and see
if this actually made the change that we wanted it to make.
So on router 9, we'll simply do our show ip bgp again.
And there's a few things here we can see.
And in this case, we'll just focus on the first entry,
the 100..8.8.0/24.
And in this case, we can see that now it's
choosing router 2 as the next hop, the 50.1.29.2,
with the shorter AS path that's only 100.
We can also see that the path through router 1
has in fact been prepended with those three ASes
in the AS path, which is why router 9 is no longer choosing
these as best.
And therefore, we can see that local preference
is doing exactly what it's designed to do.
In this video, we took a detailed look
at how AS-Path Prepending can actually
be used to influence our return, or our inbound traffic,
depending on how you want to look at it.
The way we did this was by adding ASes to the AS path
going out of router 1 towards router 9,
therefore making that path not look as desirable as the path
that we wanted it to use going through router 2.
So again, the basic idea here is we're
tainting the path that we don't want the other devices to use.
Now, keep in mind just like any other inbound influencing,
this could easily be overridden on router 9
if they chose to by implementing either weight
or local preference because those
are higher on the BGP path selection
criteria than shortest AS path.
I hope this has been informative for you,
and I'd like to thank you for viewing.