Beruflich Dokumente
Kultur Dokumente
36 votes
In this lesson we’ll take a look how you can advertise networks in BGP. There are two methods
how we can do this:
Network command
Redistribution
Just like our IGPs we can use the network command to advertise something or we can
redistribute networks into BGP. There’s one big difference though, the network command for
BGP behaves differently.
When you use any of the IGPs (RIP, OSPF or EIGRP) then the network command is used to
activate the IGP on all interfaces that fall within the range of the network command.
BGP doesn’t care about interfaces, it doesn’t even look at them. When we use the network
command in BGP then BGP will only look at the routing table. When it finds the network that
matches the network command, it will install it in the BGP table.
Let me show you some examples to explain what I’m talking about. We will use the following
two routers:
R1 and R2 are in different autonomous systems so we use eBGP. Here is the BGP configuration:
Nothing special here, just plain eBGP between R1 and R2. Let’s advertise some networks in
BGP…
Network Command
Let’s create a loopback interface with a network and advertise it in BGP:
R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config)#router bgp 1
R1(config-router)#network 1.1.1.0 mask 255.255.255.0
Above we have created a loopback interface with network 1.1.1.0 /24, this is what we will
advertise in BGP. Since we created a loopback interface, this network will be directly connected
for R1:
Since it’s in the routing table, BGP will be able to install this network in the BGP table:
R1#show ip bgp
BGP table version is 2, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-
external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
That’s all there is to it. Just use the network command to put the networks you want in the BGP
table. One thing you have to be aware of is that you have to use the exact network and subnet
mask for the network command. Let me give you an example:
R1(config)#interface loopback 2
R1(config-if)#ip address 11.11.11.11 255.255.255.255
R1(config)#router bgp 1
R1(config-router)#network 11.11.11.0 mask 255.255.255.0
I created a loopback interface with network 11.11.11.11 /32. BGP uses the network command to
advertise 11.11.11.0 /24. This network will never be placed in the BGP table since the subnet
mask doesn’t match:
Be aware of this. Make sure you type the exact network address and subnet mask when
advertising something in BGP. Let’s fix this:
R1(config)#router bgp 1
R1(config-router)#no network 11.11.11.0 mask 255.255.255.0
R1(config-router)#network 11.11.11.11 mask 255.255.255.255
With the correct network command, BGP will be able to advertise this network in the BGP table:
And because R1 has it in its BGP table, R2 will be able to learn it:
Alright so far so good. What if we want to advertise a network that we don’t have? Let’s say that
I want to advertise network 1.0.0.0 /8 in BGP. We won’t be able to advertise this network in
BGP if it’s not in the routing table. To achieve this, we’ll put this network in our routing table: