- [Instructor] Earlier in this module
we took a look at a very basic configuration
of BGP for IP version four.
Let's go a little bit deeper here,
we've got a more complex topology on the screen
and for time reasons I've already configured
BGP everywhere except for on router R3.
So let's configure router R3 to advertise
its attached internal network
and to form neighborships with routers R2, ISP1, and ISP2.
Now note that we might not want R3 to advertise
the networks connecting to ISP1 or ISP2
because if we did we might inadvertently
become a transit area for Internet traffic
going from ISP through us to the other ISP,
we don't want that.
Let's get started on router R3
by going into global configuration mode
and let's create our BGP routing process by saying
router, BGP, and we'll give an
autonomous system number of 65,001.
And I want to give this BGP a router ID
that's going to make it easier to recognize
as we're looking at show commands
and based on the topology you see on screen
I'm going to give it a router ID of 3.3.3.3.
We'll say BGP, router-ID3.3.3.3
and keep in mind just like OSPF
when we set the router ID to a number like this
we're not saying that this network is reachable via us,
this is simply an ID which happens to look like
an IP version four address.
So BGP, router-ID3.3.3.3
now let's point to each of our three neighbors,
we'll say neighbor, and router R2 has an IP address of
10.1.1.2 and when we say the remote autonomous system
is 65,001 that might seem like a mistake because
that autonomous system is not remote,
that's our autonomous system,
we're part of 65,001.
So is that okay?
It is.
What we're doing is forming an IBGP connection,
and interior BGP connection
as opposed to an exterior BGP connection.
So this is called IBGP.
When we connect to another autonomous system
that's an EGBP session.
And notice we already have that adjacency that came up,
great news.
Let's say, neighbor, and give the IP address of
the ISP1 router, that's 198.51.100.2,
it's in a remote autonomous system of 65,002.
And let's point over to ISP2,
we'll say, neighbor 198.51.100.6.
Notice we've got an adjacency now with ISP1, great.
But for ISP2 it's in remote autonomous system 65,004.
And we should see that adjacency come up in just a moment.
Now what network do I want to advertise to my neighbors?
The only network I really want to advertise
is the 10.1.1.0 network,
the network between R2 and R3
with a 24 bit subnet mask.
I'll say network, 10.1.1.0,
and it's going to have a mask of 255.255.255.0.
And we're done with our configuration on router R3.
Now let's verify this BGP configuration.
Let's say what routes that BGP knows how to reach.
And let's identify the prefer routes
and autonomous system paths.
Let's do a show IP BGP.
And let's take a look at our output.
I have a loopback interface on the iNet router
and that's what we're pretending
is a network out on the Internet.
So if I can get to the 5.5.5.0/24 network,
I'm getting to what we're calling the Internet
here in this lab environment.
And notice there are two ways to get there.
I could get there via ISP1
or I could get there via ISP2.
Notice the greater than sign here?
This greater than sign means that
this is the preferred route.
Notice here it says this is the best path,
even though I've got two paths,
it's going to be pointing to ISP1.
Now I mentioned earlier, in an earlier video,
that BGP does not pay attention whatsoever to bandwidth.
But if we look at the bandwidth,
there's only 10 meg of bandwidth between R3 and ISP1.
There's 100 meg of bandwidth between R3 and ISP2.
We're going over the soar link.
That's not optimal!
Well we'll deal with that in just a few moments.
But first let's see if we can interpret
some more of this output.
We see the next top IP address
is this is ISP2's router, this is ISP1,
and we see that to get to our destination network
of 5.5.5.0/24,
I'm going to be going through 65,004,
that's where ISP2 lives,
then I'll be going into the autonomous system
of 65,003, that's where the iNet router lives,
and then the I says that we're going to use an IGP,
an interior gateway protocol
within that autonomous system.
Because our network lives
within this last autonomous system right here.
Now something that's a bit confusing in this output,
there are two codes that read I.
Notice that there is a status code of I, meaning internal,
and there is an origin code of I, meaning IGP.
Which one is this?
You might want to make a note of this.
This I is part of the path,
refers to the origin code.
We're going to get to that network via an IGP
once we get into this autonomous system.
Now this I for internal, where does that show up?
Here's the network of 10.1.1.0/24,
that's inside of our autonomous system.
So we can see that to reach that network
it's going to be internal to our autonomous system.
And notice the R code over here,
that we see showing up from time to time.
What does the R code mean?
Well it sounds really bad,
it says that an R is a RIB failure.
That's a routing information based failure.
That means that BGP was unsuccessful
in trying to install this route
that's known to BGP,
it was not successful in injecting it
into the router's IP routing table.
Now this could be for a perfectly valid reason.
For example the route is known via another routing source
that's more believable in terms of administrative distance.
In this case the networks that are marked with an R,
if you notice they're directly connected to R3.
And a connected route has an administrative distance of zero
that's why these routes that are known to BGP
could not be installed in the router's IP routing table.
Let's take a look at our BGP neighbors
by doing a show BGP IP summary command.
And we see that our router identifier that we hard coded
is 3.3.3.3,
we can see the IP addresses of all of our neighbors.
And we can see the autonomous system
in which each neighbor resides.
And if we want very detailed information about our neighbors
we could do a show IP BGP neighbors command.
I rarely do this one,
but it gives us detailed information.
For example this neighbor,
which is router R2 in our case,
there's its IP address and there's its autonomous system.
We see its router ID
and we see that our state is established
meaning we've established to that TCP session
with our neighbor.
Now let's see if router R3
has reachability to this generic Internet address,
which is the loopback IP address on the Internet router
and that's 5.5.5.5.
So let's do a ping to 5.5.5.5.
Is that successful?
Yes it is, awesome.
Now let's see if router R2 has learned
about all the routes in the network.
Let's go to router R2 and let's do a show IP BGP.
Now I'm taking a quick look here
and I think I see all the networks
in our topology table, in this BGP table.
But let's once again see if we can
get to this generic Internet address of 5.5.5.5.
We see an entry for that network right here.
Question is, can I ping it?
Can I ping 5.5.5.5?
No, that is failing.
Why is it failing?
Well we know that we have a route in our BGP topology table
for 5.5.5.5,
but let's see if we made it into the routing table.
Let's do a show IP route.
Does the IP routing table
know how to get to the 5.5.5.5 IP address?
No it doesn't.
What could be going on here?
That's curious.
In fact you might want to pause the video
and think about it for a moment.
There's a clue on screen right now
that should indicate to you
why we're unable to get to that network.
You might want to pause the video
and come back when you think you've figured it out.
All right, did you notice that in our BGP table
to get to the 5.5.5.0/24 network
we went to a next hop of 198.51.100.2?
Which by the way is the ISP1 router.
The challenge is, if we look at our IP routing table,
we don't know how to get to that next hop.
And if we don't know how to get to the next hop
we're not going to inject a BGP route
into the IP routing table and that makes sense,
we wouldn't be able to reach it anyway.
Now the reason we're having this symptom
is a characteristic of IBGP.
With IBGP where we're talking to a neighbor
within our own autonomous system.
When one router sends a
route advertisement to another router
by default it does not change the next hop address.
So router R3 said, okay, to get to 5.5.5.0/24
I've got a next hop IP address of 198.51.100.2
and it left that as the next hop IP address
as we advertised it to R2.
The good news is there's a way to fix that.
We can use the next hop self option
when router R3 is pointing to its neighbor of R2.
So when he routes R3 advertised to R2
they're going to be marked in such a way
that router R3 is the next hop to reach those networks.
Here's what we can do,
let's go back to router R3.
Let's go into global configuration mode
and back into router configuration mode
for BGP autonomous system 65,001.
And let's say neighbor,
and we'll point to R2 as our neighbor
with an IP address of 10.1.1.2
and we're going to use this option of next-hop-self.
And we'll press enter.
Now just to speed things up a little bit
I'm going to say clear IP BGP star
so that we'll relearn our routes
and I'll readvertise the networks down to R2
and we'll see if router R2
now knows how to get to 5.5.5.5
because R3 should've said, oh yeah,
if you want to get to that network,
I'm your next hop, come to me.
And R2 obviously knows how to get to R3
because it's on the same link.
The next hop should be showing up as 10.1.1.1.
Now even after the adjacencies come up
it takes a little bit of time
for everything to be relearned,
it may not have happened yet.
Let's try, let's do a show IP BGP
and see if we have the 5.5.5.0 network
in our BGP topology table.
Not yet, let's give it a few more moments.
Going to try again.
And let's try one more time.
Yeah, it's going to take several seconds.
I'll tell you what I'll do,
just so you don't have to wait through this on the video.
I'm going to pause the video and give it enough time,
this advertisement should happen
and we'll come back in about a minute or two
and we'll see if we have that listed then.
All right I just gave the show IBGP command again
and look at this, now we've got this network of
5.5.5.0/24 with a next hop of 10.1.1.1!
Awesome, that's router R3.
Can I now ping 5.5.5.5?
Let's try, ping 5.5.5.5.
And now that is successful.
Now let's continue with the verification
by shifting out attention over to router R1.
Let's see what it knows about.
On router R1 let's do a show IP BGP.
And it does not know about much,
it can only see networks inside of this autonomous system.
Can you guess what might be going on?
Again you might want to pause the video
and think about what could be happening here.
All right well here's a rule that BGP has,
a BGP router says, if I were to route
from another router in my autonomous system
I'm not going to advertise it to any other neighbors
in my autonomous system.
So in this case R2 learned to route from R3
in its autonomous system and it says,
I'm not going to advertise it to any other neighbors
in this autonomous system, in other words,
I'm not going to advertise it to router R1.
Now an easy way to fix this would be
to make R1 and R3 neighbors,
we could have a full mesh of a adjacencies.
That might be fine for this example
but in a really large network that just doesn't scale well.
What we can do instead is to configure something called
a route reflector.
And in this example we're going to have all routers
within autonomous system 65,001
form a neighborship with R2,
and they already have that neighborship.
Then we're going to say, R2, you are a route reflector.
Now here's what a route reflector does,
when it learns a route from an IBGP neighbor
it's going to advertise that route out
to all of its other IBGP neighbors.
And the configuration is all done on R2.
So let's go into R2 and we'll go into
router configuration mode for BGP autonomous system 65,001
and we're going to say,
for the neighbor of 172.16.1.1, which is R1,
we're going to say, you're going to be a route reflector client.
And for the neighbor at 10.1.1.1,
you're also going to be a route reflector client.
Now if we go to R1 it should've learned about
all the routes on the network
and be able to reach the, quote unquote, Internet.
So let's go over to router R1
let's once again do a show IPBGP,
it knows about 5.5.5.0/24,
it thinks the next hop is R3,
let's do a show IP route,
does it know how to get to the 10.1.1.0 network?
It seems to, let's try this.
Let's do a ping to 5.5.5.5.
Excellent.
Now everybody in our autonomous system
can get out to the Internet.
But let's now optimize and tweak our configuration a bit.
Now in this example we've got a fairly small topology
but imagine we had dozens and dozens of routers
that were interconnected, they're all running BGP.
If we started applying a bunch of policies
like how we're doing route summarization
or how we're filtering routes
and we did that to every single neighbor on a router
that had lots of neighbors,
that router's CPU could take a serious hit.
However in many cases we might have a route
that is peering with multiple neighbors
and it wants to apply the same policy
to all of those neighbors.
So here's what we can do,
instead of doing that one-by-one configuration,
one neighbor and then another neighbor,
what we can do is configure something called a peer group.
And configuring peer groups will not only
reduce our configuration burden,
it's also going to help reduce the CPU load on the router.
You know in this example let's say that router R3
wants to make sure that it's not receiving advertisements
for private IP addresses,
in other words RFC1918 addresses.
We don't want to receive those addresses
from one of its ISPs.
And we can do that through the use of a prefix list,
which we apply to the neighbor.
But to illustrate the configuration of peer groups,
let's apply that prefix list
not to each neighbor individually,
let's apply it to the peer group
containing both routers ISP1 and ISP2.
And just for time's sake I've already created
the prefix list that's a bit off topic
from this particular video
so we won't get into all the syntax,
let me just give you a brief look at it.
On R3 I could say, show IP prefix-list
and we see that we've got these sequence numbers
that are denying these RFC1918 addresses
and they're permitting everything else.
Now on router R3 let's define a peer group,
let's apply this prefix list in the incoming direction,
'cause we don't want to learn those
private IP addresses from our ISPs,
we want to apply that prefix list to the peer group.
And finally we'll tell each of our neighbors
that they belong to this peer group.
Here's how we do that,
let's go under router configuration mode
for BGP autonomous system 65,001.
And I'm going to say, neighbor BGP-PG for peer group.
And I'm going to say that this is a peer group.
And now I'm going to apply this BGP demo prefix list
not to a specific neighbor but to a peer group.
I'm going to say, neighbor,
and I'm going to say the peer group name
instead of a specific neighbor that's BGP-PG.
I'm going to apply the prefix list of BGP-demo
in the incoming direction.
Now I need to say who belongs to this peer group
and it's both of my neighbors,
specifically the two ISP neighbors.
I'll say 198.51.100.2,
peer group, BGP-PG,
that's for ISP1.
Now let's do the same thing for ISP2.
All right.
Now when we're filtering incoming routes,
any routes that should not be permitted to come in,
we don't have to do it individually on each neighbor,
we just do it once for the entire peer group
because our ISP routers belong to the same peer group.
Now before moving on I want to get rid of
the peer group that we've created here
because in our upcoming video it's not going to be compatible
with what we want to do then.
In our next video we're going to take a look at
how we can treat our ISPs very differently
instead of the same,
how we can prefer to go over that 100 meg link
both for incoming and outgoing traffic.
So for now let's say, no neighbor BGP-PG,
peer group, to delete that peer group.
Now I need to reestablish my neighborships with my ISPs
I'll say, neighbor 198.51.100.2, remote, AS, 65,002.
That's for ISP1.
Now for ISP2, we'll point to its IP address
and it's in autonomous system 65,004.
And that should bring up both of our neighborships.
Let's end the video here and I'm going to end it
by doing the clear IP BGP star again.
It's going to make everything be relearned.
And then in our next video we want to see
if we can influence that path selection
because remember we were using the 10 meg link
instead of the 100 meg link to get out to the Internet.
And the bad news is,
it was the same in the other direction.
And we want to fix that in our next video.