So now folks, we're going to dive into a discussion on manipulating BGP best path selection process.
This is not an official exam objective.
However, you know, sometimes when I take exams, I potentially experience things that were never introduced to us in the actual exam objective outline.
It happens quite often.
So being instructor is my duty to ensure that you are all prepared for the possibility of things creeping up on your certification exam,
whether it's something that's going to be officially tested on or not based on the official exam objectives.
So with that said, we need to talk about manipulating BGP best path selection process,
something that I never did for version 1.0, but I do for version 1.1 now that's not actually in the exam objectives.
But here we go. Let's talk about four of those attributes.
And so what I've had to do here is I've had to reconfigure my environment during break really, really, really, really, really fast.
So what do we have right now?
We have an E-BGP session here.
We have an I-BGP session here now.
We have two, two E-BGP sessions here.
We have an E-BGP session here.
And we have an E-BGP session here.
In addition to that down here, I have the network 192.192.192.192 for fun.
And we are going to go through a lot of our, we're going to go through four of our attributes.
Specifically, we'll talk about here weight, local preference, AS path, and MED to help us understand the importance of these four
when it comes to influencing routes in our particular environment.
So let's begin here with a discussion on weight.
So weight, as I mentioned, is Cisco proprietary.
Meaning it's also, and it's also locally significant to the router.
Meaning that when you manipulate weight, you change weight, you adjust weight, it only affects that router that you're doing it on.
It's an attribute that is not shared with any other router and any updates, no matter what.
It's locally significant to the router.
And so you can manipulate weight to influence the path leaving your autonomous system as an example.
Or just changing your router's decision, right?
It doesn't have to be leaving your autonomous system.
It could be like, I want to go this way instead.
And that might be to another router inside of your autonomous system that's running BGP.
Whatever the reason is, or not whatever the reason, whatever you're trying to accomplish, it's based on the fact that you are trying to tell your router,
I don't like the decision you've made based on whatever attribute you've made this decision on.
And I want you to go the other way.
I want you to go a different way.
I want you to choose a different path.
Specifically, I want you to use this path I'm telling you to use right now.
Remember that higher is better for weight.
If you learn it, you automatically get a value of zero for weight.
If you locally generate a route, you get a weight of 32,768.
So, if we look at our routers right here, you'll see that this router locally generated that network.
It's the one that I use the network command on R1 to dump this into that table.
And then we look down here, all the rest are zero because these are ones that we have learned.
So, zero is the default for learned routes.
32,768 is the default for routes that you've injected yourself.
And remember, this is locally significant.
BGP will not pass this information to other routers.
So, there's two different ways we can do this.
We can do this with a route map, and we can do these without a route map.
So, let me just show you quickly first how to do it without a route map.
Now, when you do it without a route map, you have to do it for essentially every single route you learn from a specific neighbor.
So, for example, if I learn from this neighbor that I'm a neighbor with, I want everything I learn from them to have a weight of 40, as an example.
So, when you don't use a route map, you don't have granular control.
When you use a route map, you will have granular control.
So, let me just show you this one without granular control right now.
So, this is R1 in our environment.
R1.
This router right here.
And when we look at this network right here, that network is down here.
So, 192.192.192.192.
Notice I've learned about it two different ways.
I've learned about it from this neighbor, which is EBGP, and I've learned about it from this neighbor, which is IBGP.
Okay.
So, I'm going to show you one more thing before we get deeper into this.
But you see this?
You see that IP address?
Okay, we're on R1 right now.
Remember, we're on R1.
You see that IP address?
That's this router's IP address over here.
When you learn a route via EBGP and you share with an IBGP neighbor, the next hop IP address is the IP address of the router in the next hop autonomous system.
The router doesn't automatically update it.
What does that mean?
It means that this router has to know how to get to this next hop or else it can't use the route.
Because remember the first rule, if you can't get to the next hop, ignore it.
Notice how I am using it.
It's the greater than sign, which means I can get to that next hop.
Does anybody know why I can get to that next hop right now?
Just think about it for a second.
Why can I get to that next hop?
What did we configure last week in this entire network, which is running underneath right now all of this?
OSPF, right?
It would be OSPF.
Yeah.
That's why right now I can get to that next hop.
Now, if I wasn't running OSPF and I didn't learn about the OSPF, we would have to make sure we can learn about it somehow, either through a static route.
Default routing can work as well for that.
For the next hop, default routing works in your routing table.
I need a route to get to that next hop.
But there is a built-in BGP feature that is called next hop self.
So, for example, right now we type in – we're using address families here, right?
Address family IPv4 unicast on this router.
If I type in neighbor 192.168.255.1 and I type in next hop self, then everything I share with R1 is going to have my IP address as the next hop.
So, if we go back to R1 now, we should see that that has changed.
And not yet.
Why?
Because BGP is slow.
So, let's do do clear IP BGP star out.
That's what we call a soft refresh, meaning I do not tear down my TCP session.
All I do is send updates without resetting the neighbor adjacency.
So, whenever you type an out or in, so outbound refresh or inbound refresh, then that is a soft reset.
But if you leave out, out or in, then it resets the whole TCP session, which would have a ripple effect on the Internet, by the way.
So, you typically want to avoid that.
All right.
Now you'll see that the next hop is R2.
So, many different ways to get to the next hop.
You can either do static routing.
You could do default routing.
You could advertise the route into OSPF like we had done in a previous session.
Or you could just change the next hop so that way there the router in your environment makes itself the next hop.
So, that way R1 knows how to get there and that one knows how to get there.
That's just another option you have.
All right.
So, with that in mind, let's get back to our metric discussion.
So, now we can see that we can either get to this network going through EBGP or we can get to this network going through IBGP.
Now, remember what I said earlier.
One of our attributes is prefer EBGP over IBGP.
So, my question to you folks right now is why did we prefer IBGP over EBGP?
Why did we prefer IBGP over EBGP in this scenario?
Well, first of all, we didn't even get that far in our list.
Why did we not get that far in our list?
Well, if we look at our list again, I'll bring that up right here.
Let's put that over my head.
So, if we start off with metric, right?
So, metric or sorry, weight.
Start off with weight.
Weight is tied.
Then local preference is tied.
Then it was not locally originated.
So, that's tied.
Then we have AS path.
Shorter.
Shorter AS path.
There you go.
Done.
Shorter AS path is the reason why that one is being used.
All right.
So, now that we know that, we could manipulate weight or we can manipulate local preference
and that would change this router's decision making process.
So, what we're going to do is we are going to take.
Yeah.
Okay.
We're back on the slide.
What we're going to do is we are going to say that anything we learn from this EBGP neighbor,
anything we learn from that neighbor.
So, neighbor, 203011389.
Anything we learn from that neighbor.
So, neighbor, 203011389.
I want.
We are using address families here.
So, I got to do address families.
Yeah.
I don't see it there.
So, address family IPv4 unicast.
It's going to be neighbor.
Let's put that neighbor address back in.
And then we can type in.
We should see an option for weight in this output.
There it is.
Weight.
And then let's set our weight.
So, what is the current weight right now of these two paths we have?
The two paths we have, the weight is zero and zero.
So, if we.
What higher weight is better?
So, let's make anything we learn from that neighbor higher than zero.
So, let's specify five as an example.
And do clear IPBGP star in.
So, let's refresh everything we've learned inbound from our neighbors.
And what we should see now when we look at our table is that anything we learned from this router has now a weight of five.
So, let's just focus now on this network here.
And you'll see that we are now preferring this path right here.
Why are we preferring this path?
We're preferring this path because higher weight.
That's it.
Higher weight.
So, now we're going to go this way to get to that network instead of this way to get to that network.
So, we influence the individual router's decision-making process.
Now, the problem with this, as I said, is that it affects every single network that we've learned from that device.
Now, is that what we want?
If it is, great.
So, as you can see, if we wanted to make sure that this router, no matter what, for all internet destinations, chose this way instead of coming through this router, then that makes sense.
That works.
Everything we learned from that neighboring ISP router, I want to make sure we always go that way unless there's a failure.
If it fails, then we can use the other path.
Perfect.
That's what this would accomplish for me.
But what if there's only specific routes that you wanted to match?
Well, that's where you're going to have to use something called a route map.
So, let me erase this right now.
We'll clear our BGP.
Now, with a route map, we're going to have to specify which routes we want to match.
So, what are we going to need?
We're going to need, first of all, a prefix list.
So, a prefix list to match that.
So, IP prefix list BGP wait example.
I'm going to call it prefix list underscore BGP WEIGHD.
And then we are going to say that.
What is my commands here?
We're going to permit.
So, I want to permit.
What is it?
It's going to be this one right here.
So, I just want to match that one right there.
That's it.
Now, I don't have to worry about all the other traffic,
because all the other traffic, all the other stuff,
is going to be falling under my default route map after.
So, I'm just going to specify what I want to match.
I want to match this specific network ID.
Now, we're going to create my route map.
And so, my route map allows me to do a construct here
that allows me to differentiate different types of traffic from other types of traffic.
Or routes, I should say.
Network IDs, different things like that.
So, with route map, for example,
I'm going to go ahead and call this one my route map underscore BGP WEIGHD.
E-I-G-H-T.
And then I'm going to say that this entry is going to be a permit.
And I'm going to give it a sequence number of 10.
So, now I want to match the IP prefix list we created earlier.
Nope, it's got to be IP address prefix list.
And what do we call our prefix list?
I want to match this one right here.
Now, I'm going to set.
Set what?
Set the weight.
Set the weight to, let's say, 7.
So, if you match this, if you're a network ID and you match this,
your weight is now 7.
Now, what we're going to do is we're going to create another sequence in this route map.
So, think of it like an access control list.
Sequence 10 is one entry.
Sequence 20 is now a totally different entry.
And I'm going to match everything else.
Match everything else.
So, what is everything else?
Well, I just leave it blank.
I don't put a match.
And if I want to use the default weight, I just leave it blank as well.
So, basically, leave the whole thing blank.
This means permit everything else and use default values.
That's what it means in this case.
So, now, we go back into router BGP configuration mode for 65,001 on R1.
And what we're going to do is we're now going to say under.
Is it going to be address family configuration mode?
Neighbor.
So, neighbor what?
So, when I am learning from this neighbor.
Who is it?
203011389.
I want to apply.
No, it is under address family.
So, address family IPV4 Unicast.
All right.
So, when I'm learning from that neighbor.
Then, we want to apply this route map that we created.
And the route map we just created is called route map BGP weight.
And we want to apply inbound.
Inbound meaning when I'm learning from that neighbor.
When I'm learning from that neighbor.
All right.
So, now, let's clear the BGP process.
So, we can refresh everything.
And what's going to happen now is that when I learn from that router.
We are now going to apply this route map.
And if we type in do show route-map.
It states that when you match.
So, this is a permit.
Permit.
When you match this prefix list.
Which is 192.192.192.192.
Then, go ahead and set the weight to 7.
For everything else.
Just leave it at its default values.
Because there is an explicit deny or an implicit deny all.
Just like an access control list or route map.
So, if I did not include this.
Then, everything else would not be learned.
Right.
You see what's happening there.
So, I got to say permit.
So, I learn it.
Learn everything else.
And set their default values to whatever they are.
If I had a deny here.
Then, it would mean do not learn everything else.
So, that's why I have this catch all.
It's like permit IP any, any.
In an access control list.
All right.
So, now, that's cooked.
Let's see.
If we type in do show IP BGP.
We should see that only one of them has been affected.
Everything else has not been affected.
So, you'll see here.
This one's still 0 for weight.
But if you look down here.
Oh, this one's still 0 for weight.
But this one here is 7 for weight.
Whereas, this one here is a 0 for weight.
How cool is that?
I was able to manipulate just that one.
And make sure all traffic for that network goes through who?
Goes directly to that ISP.
Where the traffic for all the other ones is still going through R2.
Except for that one there.
Because that one is learning directly that way.
So, anyways.
Pretty cool.
When you think about it in the end.
Having the ability to manipulate that decision making process on your router.
All right.
Now, let's talk about local preference.
So, local preference is another attribute that we have.
It comes right after weight.
Remember in our list.
And local preference is an attribute that is going to be passed to other routers in the autonomous system.
So, if I manipulate local preference on one router.
It tells all the other BGP routers in my autonomous system.
What this new local preference is.
So, what does that mean?
It means that you can use local preference.
To manipulate other routers in your autonomous system.
To prefer a certain path.
Remember, local preference default value is 100.
Higher is better.
And we can set it for all routes that we share with all the other routers in our autonomous system.
Or just very specific routes.
Very specific routes.
Using a route map.
So, let's remind ourselves what our environment looks like.
So, in this case.
We've got.
EBGP right here.
We've got IBGP here.
We've got EBGP here.
And what's happening down here?
19.
Was it 192?
Is that what we're using?
Yeah, 192 is the one we're working with.
192.
It's tough to remember the numbers you're using when you do it on the fly.
And you have no notes for any of this stuff.
And I'm just manipulating it based on what I see.
So far, so good.
So.
Now, let's think about this scenario here.
If we look at R1.
We have successfully manipulated weight, right?
So, that way there it's going this way.
So, R1 is going this way.
To get to this network over here.
That's the way we're going.
Okay, which way is R2 going?
Because R2 is in the same autonomous system as R1.
So, do show IP.
BGP.
And we'll see here that to get to that particular network, R2 is choosing the direct path.
The direct path, 1045.33.2.
So, 1045.33.2.
That's the way it's choosing right now.
So, we could manipulate local preference over here.
If we change local pref here, we could then influence R2 to potentially actually go this way.
Interesting, isn't it?
Absolutely.
So, for example, over here on R1, if I type in the command that we saw on this last page.
It says here BGP default local preference and then give it a value.
So, let's do that.
BGP default local preference.
Let's say 150 as an example.
So, I do this on R1.
So, this doesn't actually really affect R1.
Because as you can see in this particular case, it's not changing anything on R1.
Nothing has changed here on R1 in regards to that.
But notice, my table has changed, hasn't it?
It used to be this big.
Do you see that?
It used to be this big and now it's only this big.
Why?
Because certain things have changed now in this environment.
That's right.
So, you notice the ripple effect of change is just by doing that.
So, let's go over to R2 and see if something happened on R2.
If we go over to R2, this is the table before on R2.
Right?
This is the table now.
And if we look here closely, please have worked.
I've got to go do something on R1 to make this a little bit more easier to understand.
I've got to go to address family IPV4 Unicast.
I've got to do that command we did before on R2.
So, neighbor 192.168.255.2 next hop self.
Because right now, I'm not advertising myself as the next hop.
I'm advertising.
I'm preserving the next hop IP address.
I'm preserving the next hop IP address of the EB2B peer,
which is going to cause confusion when we look at this output.
So, let me refresh this and we should see that things are different now.
There we go.
Okay.
So, this is going to make a lot more sense now.
Okay.
So, when you look at this output now,
you're going to see that I now have preferred the path through who?
Through R1.
Why?
Because look at the local preference.
Look at the local preference.
So, even though this is a shorter path, and that's the path we were using before.
If we go back up, before we made these changes, that's the path I was choosing.
Why?
It had the lower AS path.
Lower AS path.
But now, I'm choosing what?
R1.
Why?
Because we don't even get that far.
We look at weight.
Weight is tied.
And now, we look at local preference, and local preference is 150.
So, that's what I'm going to use.
And so, that's the one that ends up in the routing table.
So, now, all the traffic that leaves R2 to go to this network down here is going to go this way.
Obviously, that's not the best way to go in our scenario,
but I'm just trying to show you how manipulating local preference here on R1,
how that can change other routers' decision-making processes.
Now, when we look at something like what we just did on R1,
I said, hey, when you advertise to all your IBGP neighbors,
tell them the local preference for all routes are going to be 150.
So, that affected all the traffic, everything.
But if we wanted to get very specific and just focus on that one network and not affect everything else,
we could totally do that as well with a route map.
So, let me erase what we just did on R1 and just show you quickly how we can do that with a route map.
So, we'll go over to R1.
Where's the command?
There it is.
Let's get rid of that command.
Let's clear BGP out.
Let's clear BGP in just to be on the safe side.
I don't want any stale information.
Okay.
Now, we already have a prefix list that's going to match this.
So, do show IP prefix list.
So, I am just going to use this exact same prefix list
because that's the one we want to match in our particular example again.
So, let's just go ahead and do that.
We'll just match that exact same prefix list.
Even though it's called BGP wait, we're just going to use it for the local preference example.
So, now I'm going to type in a route map.
We're going to create a new route map, route-map.
And let's call this one route-map for local preference.
And we're going to do a permit.
And we're going to use sequence number 10 in this case.
And we are going to say match.
Match what?
Match the IP address of the prefix list we created called this.
And the only reason I'm using the same one for this scenario
is because I want to match that same address.
And then I'm going to set the local preference.
I'm going to set the local preference to what?
Let's go ahead and set it to 177.
Now, if we exit out of there.
Again, let's not forget about all the other routes that we still have to catch and match.
So, match everything else by leaving it blank.
And because it's a permit, it means that I want to match them in this case.
And I want to match everything.
I want to learn about them because I'm using it for BGP.
And as a result of that, I leave my set as well to blank.
And it does all the default values of whatever it is.
So, now that I have that done,
if we simply go back to the router BGP configuration mode for autonomous system number 65,001,
then what we're going to be able to do is we're going to type in neighbor.
Nope.
We've got to go into address family configuration mode for IPv4 Unicast.
And let's say neighbor in this case.
And specifically, we're going to focus on R2.
So, 192.168.255.who.
192.168.255.to.
Apply a route map of what?
Apply the route map called route map local preference that we created.
And in this case, outbound.
So, what I am teaching,
what I am teaching router number to 192.168.255.to about my BGP routes that I know about,
I want to make sure that this route map is applied when I teach them.
So, what is it going to be?
I am going to set the local preference to 177 for any network that matches this prefix list,
which happens to be this one here.
And then all the other ones, I'm not going to do anything to them.
I'm just going to leave them blank, but I'm still going to teach them.
Or, sorry, not leave them blank.
I'm going to leave them with their default values, and I'm going to send those to R2.
So, let's clear the BGP process here for ourselves.
Basically, tickle your neighbor, update them, essentially what I'm doing.
So, now we go over to R2.
We should see here over on R2 that this is what we had before.
These should all be back to 100 except for this one right here.
This is the only one that should now be 177.
And there you go.
So, now I've been able to influence that one specifically on R2,
but only R2.
I haven't influenced it on anybody else, just R2,
forcing R2 to come through me in order to get to that particular network.
So, again, when you're using this command here,
it affects all your IBGP neighbors and all the routes that you share with them.
Whereas when you use a route map, you can pick and choose what BGP neighbors you affect,
IBGP neighbors you share with them.
IBGP neighbors you affect,
and you can pick and choose what routes you want to affect as well.
All right.
So, those two, wait and local preference, as you can see,
are really valuable manipulators for manipulating traffic leaving your environment.
Let me repeat that.
Pay attention right now to the directionality.
Wait and local preference allows me to manipulate what?
Traffic that is leaving my environment.
So, when we used wait, I was able to manipulate that router specifically
and indicate which way I wanted it to go.
Whereas with local preference,
I can now manipulate other routers' decision-making processes
that are running BGP in that autonomous system.
So, basically, by setting local preference on R1,
when it tells all the other routers,
hey, locally prefer me.
Ah, you get the name now,
if you're having trouble making a connection to that name.
Locally prefer me as the way to get to those networks.
So, now the other routers running BGP will prefer that router
to get to wherever they need to go.
But what about manipulating traffic coming back to you?
What about manipulating traffic that is coming back to you?
You ever thought about that?
Because right now, look at this environment.
We want to make sure all traffic goes this way.
All traffic is going this way.
See the flow from my environment,
it's got to go this way and this way.
Never go this way right now.
Well, let's see what path they're taking to get to me,
my network.
So, what network do we have right now that we're advertising?
I believe it's 10.0.0.0 size 24, right?
I think we advertised that one earlier.
So, if we go right now to branch,
we should see that one in its table.
Yep, there it is.
Okay.
So, how is it getting back to us?
Well, it is choosing to go which way?
It is choosing to go this way, it looks like.
So, it has chosen 10.45.33.1.
And why?
Well, it's because it's the lowest AS path.
Weights tied, local preference tied,
it wasn't a locally originated.
So, we are dealing with the lowest AS path.
Well, what if this was our primary ISP
and this was our backup?
What does that mean?
One, it means that traffic going to the internet
is following the primary path like we want it to,
but traffic coming back to us
is going through our backup path.
Let's say it's costing us a lot of money.
Well, that's no good, right?
So, if traffic's coming back this way
across our backup path,
it's going to cost us a lot of money.
And if traffic's coming back this way
across our backup path,
that's costing us too much money.
But also, look at the traffic flow.
Traffic leaves our environment here,
comes back here, leaves our environment here.
That's what we call what?
Asymmetric routing.
And because of that asymmetric routing,
it's quite possible that the traffic coming back to us
could be bypassing security features.
It definitely would have a NAT problem, wouldn't we?
In this type of scenario.
There's a lot of other things that would be a problem.
So, how can I influence the traffic
to actually come back this way instead?
Well, Casey typed in autonomous system path prepending.
Autonomous system path prepending.
What does that mean?
Let's make this path look horrible.
That's what we're going to do.
We are going to lie to the internet
by doing AS path prepending.
With AS path prepending,
what we do is we add additional autonomous system hops.
Now, what autonomous system number do we use?
Our own.
Don't use anybody else's.
Use your own autonomous system number.
And so, if normally,
as we can see in this particular scenario,
what they have is they've learned it's 65,001.
Well, what if we made it 65,001, 65,001, 65,001, 65,001,
65,001, 65,001, 65,001, 65,001?
Well, then that's worse than 65,000 and 65,001.
So, what path do you think Branch is now going to use?
Branch is now going to use the one with the lower AS path.
That's all I'm doing here.
I'm just basically tricking it to use that other path.
So, that's what we're going to do here.
We're going to go ahead on R2.
We're going to tell this neighbor that to get here,
it's 65,001, 65,001, 65,001, 65,001.
I can put as many as I want, but we're going to do four.
So, over on R2, we need a route map to do this.
So, let's back out of here.
Let's back out of here.
And we're going to type in route map.
We're going to call it AS path prepend, pre, just so we know.
It's AS path prepending route map that we're creating here.
Permit sequence number 10.
And we want to match everything.
Everything we teach, that router right now.
Now, in your case, it might not be everything.
It might be very specific networks.
And if it's very specific networks, what do you do?
Create a prefix list.
And then with that prefix list, you match it.
Then you match the prefix list here, and then you set it.
But in my case, I'm just going to do all.
Everything I teach you, I'm going to prepend like crazy.
But, again, you can get very specific.
And if you want certain routes this way to have a prepend,
and other routes up here to have a prepend,
then you can control different traffic on different paths.
So, AS path prepending match.
I'll leave blank, meaning match everything.
And now I'm just going to say set AS path prepend to, we said,
65,001, 65,001, 65,001.
And I also said, I think, 65,001.
All right.
Now, if you use other wrong Autonomous System numbers,
you could cause problems out on the Internet.
So that's why you should only use your own.
All right.
Now, since we're matching everything here,
I don't need a sequence number 20,
because I'm matching everything here.
So it catches everything.
So now we go to router, BGP, 65,001.
And we say address family IPV for Unicast.
And then we type in neighbor.
And who's our neighbor?
10.45.33.2, that's our neighbor.
And we're going to now say that we want to do a route map.
We're going to apply a route map to them.
And the route map we're applying is the AS path prepending a route map.
And then we're going to say in the outbound direction.
So when I teach, when I teach that neighbor about what I want to teach them,
I am going to teach them that everything has this added to it.
So let's type in do show, not do show, do clear IP BGP star out and in,
just to be on the safe side, make sure we totally refresh everything here.
So as you can see, BGP doesn't automatically refresh itself.
As soon as you make a change, you have to force those refreshes.
So now we're going to go ahead and type what?
Oh, we got to go over to branch.
That's where we got to go.
And so if I did everything right,
you should see that everything learned from this neighbor,
everything learned from this neighbor,
is now going to have a very excessive, a very excessive what?
AS path attribute.
And there you go.
So what does that mean?
It means we should have a change.
So what network we were focusing on specifically, it was this one here.
So originally we were using 10, 45, 33, one,
but now we should be using this one here.
So let's verify that.
And the answer is yes, we are.
Look at that.
We're using this one because it's two versus that.
So now traffic is flowing this way as we want it to.
Now up here, up here, it might not be flowing that way.
It might actually be flowing this way,
which means that we still have to think about other connections, right?
Because this is an EBGP connection as well here.
So might I have to lie to this neighbor as well to make sure they also go that way?
Absolutely.
So I'm pretty sure if I go to ISPA, it's probably pointing down, right?
Right now still to R2.
So it's just something to keep in mind for the real world,
that you have to keep an eye and pay attention to all the possible options
while you're doing this.
So let's see here.
Yep.
Nope.
Actually, it's going to R1 right now.
That is R1 as the neighbor.
That is R1.
But look at this one here.
Okay, that's R2.
So it is why was that one chosen?
Okay, so this one was chosen because the metric.
You see the metric here is zero, but the metric here is two.
And the reason why is because we did redistribution,
if I recall correctly, for this one.
No, it was network command.
But the metric was preserved.
Okay, but over here, the thing is, is that that is an IBGP.
It was learned via IBGP.
There's a lot of things.
The reason why the metric here is zero.
So actually, it's the metric that is making the choice here.
So we would have to be careful.
We would have to think, okay, wait a second.
If metrics being the choice, then I might want to manipulate that AS path.
So that way there down the road, that metric, if it ever changes,
does not ultimately change and cause traffic to come this way.
So, again, advanced BGP,
you've got to be thinking of every single possible scenario
to get the result that you want.
But in this case, what was our goal?
Our goal was primarily force this router to go that way, which we have done.
So we've accomplished our objective in this scenario
with AS path prepending.
All right, and lastly, lastly, what do we have next to cover?
And that is going to be a discussion on MED.
All right, so MED is called the metric.
And MED, as we saw, is something that can be used for many different purposes.
So, for example, if we are using MPLS,
then when I redistribute from OSPF into BGP or EIGRP into BGP for MPLS,
then the metric of OSPF or EIGRP can be placed in the MED field.
That's why it's called metric in the actual output on a Cisco router.
But we can still manipulate metric,
because metric is something that is passed to another autonomous system.
It's very beneficial when you have dual-homed connections,
dual-homed connections,
because I can influence the MED for one path versus the other path
going to the same autonomous system.
So, for example, in a scenario where you have your router here,
dual-connected up to a router here,
and this is a big, giant autonomous system with lots and lots and lots and lots
and lots of routers, and let's say there's another autonomous system here,
another one here, another one here, all right,
and then you're connected back up here.
If I can tell this autonomous system here,
I want you to prefer this way.
I want you, you, you to prefer this path right here,
then I can influence this autonomous system to make sure that they're coming
along this path.
I'm not influencing anybody else.
I'm not affecting anybody else with MED.
I'm just influencing the directly connected autonomous system in that
particular case.
So, when we look at our topology, we have dual connections here.
What if this is a primary link and this is a backup link,
and it's this link that's being used?
Well, that's no good.
I don't want that to be used by the upstream autonomous system.
I want this one to be used.
So, MED is what, higher or lower?
What is better?
Lower MED is better.
So, lower MED is better.
Lower MED is more preferred.
So, if I set the MED, the metric, and then I tell a router, hey,
this is the MED now for this path,
then that means that I can get that neighboring autonomous system to choose
one path over the other directly back to me.
So, great for like those dual home scenarios, for example, with an ISP.
So, if we come back to this scenario here,
let's just take a peek at R2 right now, not R2, ISP,
and see if we can do something with this.
Let's just see if we can do something with this and make it work.
So, is the ISP choosing anything?
Yeah, sure, this one right here.
So, right now, let's focus on 10.
Let's make sure that's R2.
91.
Perfect.
All right.
So, you can see here, it's a little bit more complicated than I thought.
So, let's see if we can do something with this.
91.
Perfect.
All right.
So, you can see we're choosing this path right here.
But we also have this path right here.
So, what we're going to do is we're going to look here at how that decision was made.
So, weight is tied.
Local preference is tied.
Origin code learned.
All of them were learned, so tied.
AS path tied.
And we keep going down the list because med right now is tied at zero for all of them.
More than likely, it was based on the higher router ID or the higher neighboring IP address.
That would be more than likely.
So, we went all the way to the bottom.
Okay.
All the way to the bottom of the list here.
So, what we're going to do is we're going to make med because the decision was made after med,
then I can manipulate med and accomplish my objective here.
So, what we're going to do is remember, we're going to go to R2.
That's where we're going to do the changes because med allows you to influence the neighboring autonomous system,
not your own, your neighboring autonomous system to control how traffic comes back to you.
So, we're going to go to R2, and we're going to force the ISP to use this link instead.
So, we want this one to be the primary one.
Let me start.
So, what we're going to do is we're going to make this one look bad, and therefore, this one look good.
Now, the problem is I might do that, and it might actually choose this one instead, okay?
That's probably what's going to happen to us, but I just want to show, and then, which means we have to go manipulate R1.
I'm thinking that that might be the result.
Just based on what?
The list, but it shouldn't be.
No, because med would be tied between this one and this one.
So, my example might not work unless we influence R1 as well.
So, let's do that.
Let's make it work.
Let's show you how we can make it work in total.
We might have to go to two routers for this one.
So, let's create a route map.
So, route map, and in this case, let's call it med, and it's going to be permit.
And sequence number 10, and now we're going to match everything.
So, match everything, and we're going to set the metric to, we got to set it higher.
So, zero is the default.
So, let's set it to something like five, all right?
And since we matched everything, I don't need another sequence.
Now, let's go ahead and go to router BGP configuration mode for what autonomous system?
For our local autonomous system is 65,001, and now we're going to type in address family IPV4 Unicast,
and we're going to type in our neighbor, and our neighbor in this case is going to be who?
Okay, we want to make this one look bad.
So, we want to up the med on this one.
So, it's the neighbor 2030113, in this case, 89.
So, neighbor 2030113.89, and we are now going to type in, apply the route map when you talk to that particular neighbor,
and the route map you're going to apply is the med route map in the outbound direction.
Why? Because when I tell you about it, when I tell you about it, I want you to up your med.
Good. So, let's clear IPBGP, and let's just go see if that applied to ISPA right now,
and we'll see how it does not affect this autonomous system at all.
So, we'll go check their output as well.
So, you should see here that the med is now five.
The med is now five.
You see that?
But if we go to branch, you'll see that this has no effect on branch because med is not going to be shared with other autonomous systems.
So, if I tell you to set your med to five, then you're going to set it,
but you're not going to tell other routers to set their med to five or other networks.
Now, would it apply to all the routers in your autonomous system? Yes.
So, when I send that to the ISP as an example, all their routers will be affected, not just the neighboring router, all their routers.
So, we'll see here now, and I was right.
You see how this one was chosen now.
So, I have not been able to accomplish my objective just with this.
So, let's go over to R1 and make R1 do the exact same thing just as an example.
So, we'll go to R1 now.
So, basically, we'll tell that one to set the med to five as well, let's say, as an example.
So, router or route map, I should say, we'll call this one med as well, permit, sequence number 10.
And then we're going to say set med to, let's say, six, just so we can tell the difference between the two.
And it's actually met, Rick, on our router.
And now we're going to go to router BGP 65,001.
And when you're talking to your neighbor, who's our neighbor in this case?
What is their address?
Their address is going to be this right here.
Boom, boom, put that in.
And then we're going to say we want to apply the route map.
No, I've got to go to what?
I have to go to address family IPV4 Unicast.
Then I can apply this command with the route map to it.
And then it's going to be route map.
What did we call it?
We called it med.
And then we want to apply it outbound.
Outbound, outbound.
So when we teach that neighbor, when we teach that neighbor, we want their med to be six.
So let's go to ISPA now.
And we should see that this one here, or sorry, this one here is now going to be listed as five as well, because we just told R1 to do that.
So let's see if that took, or six, not five, but six.
So there we go.
So now you'll see that that one's six, that one's five, and you'll see that this one is still zero.
And notice that's the one that's now installed in the routing table.
So now by manipulating even this one here, we have been able to make sure that this is the primary path coming back into that autonomous system.
That's what we've done.
So, yeah, as you can see, all of these attributes can be manipulated to ultimately determine what is the way that AWS, why did I say AWS,
the way that the neighboring autonomous system is going to use in order to get back to that particular environment.
So might you have to manipulate these on the exam?
Possibly.
Might you have to manipulate them around maps?
Possibly.
Might you just have to know, for example, that if you have a router with multiple paths that it can take, how do you force this router to take this specific path?
Folks, how would you force this router to take this specific path if, let's say, it was going this way instead?
How would you make it use this path instead?
Chat in.
Which of those four attributes would you manipulate?
Okay.
So it's outbound manipulation.
So you've got two options, wait and local preference.
So if you're trying to influence that exact router, it is wait.
Casey, you got it.
Well done.
Wait would be the answer.
Okay.
Now, what if, for example, you were on this router here, but the scenario was you want this router to go this way?
Or all your routers in your environment to all go this way to get to that network?
How could you do that?
Well, could I go to all the routers and use wait?
Yes, I technically could, right?
I could.
But what if I told you I wanted to do it on R2?
Then what do you use?
Again, outbound traffic flow.
So if it's outbound, wait or local preference.
Well, which one of those, wait or local preference, allows you to influence other routers in your autonomous system?
Right, local preference.
Remember, locally prefer me as your exit point out of the environment.
Think of it that way.
If you were trying to manipulate inbound traffic flow from the entire internet, what option would be a good option to choose?
Casey, you typed it in earlier.
Yep, AS path prepending.
Exactly.
AS path prepending.
And then if you wanted to influence a directly connected autonomous system that's connected to you multiple times, like we have here, dual connections, you could use what?
MED or the metric to influence what path's being utilized to get back to you.
So MED and local preference.
No, MED and AS path prepending used to influence traffic coming to you.
Wait and local preference used to influence traffic leaving you.
That's what I want you to take away from that.
All right.
Be prepared for those on the exam, folks.