Introduction to BGP


IN the BGP introduction lesson , in the case with two ISPs sending default route, you have mentioned as below.

"Our customer network only received a default route from both ISPs and we have chosen to use the default route of ISP1 to send all our outgoing traffic to. "

My question is : Will this not ecmp and CPE traffic sent to two ISPs .You have mentioned it will be sent only to ISP1.

Hello Vasanth

In this example, Rene is showing how static routing is not the best choice for connecting to an ISP, and that the use of BGP is important. If we do use static routing, then we have to choose either ISP1 OR ISP2 as the default next hop (default gateway) to the Internet. This scenario does not use ECMP, and thus is not optimal especially for cases where traffic is destined for the network of ISP2, which would result in routing such traffic via ISP1 which is inefficient.

So the example shows the problems of static routing. This is why ECMP should be employed so that traffic can indeed be more efficiently load balanced between the two ISPs.

I hope this has been helpful!



Recently at work, I discovered that my customer had issue with our BGP peering.
On our device we found a log like this.

maximum number of prefixes has been reached .

How are managed this limits ? are any default values on Cisco IOS ? or exist any agreement with IANA or others entities?.

Also Can you help me to understand how use tools like PeeringDB?

For example in the section of IPV4 prefix there is the value

Recommended IPV4 Maximum-prefix limit to be configured on peering session for this ASN

Thanks for your help as always

Hello Giovanni

It looks like the “maximum prefix feature” has been enabled. This is a feature that you can enable on a BGP neighbor where it limits the number of prefixes you can receive from a particular neighbor. Customers may do this if ISPs send too many prefixes for their edge routers to handle (as far as CPU and memory go). Take a look at this Cisco documentation that describes the feature fully:

There are no limits on the number of prefixes by default, nor does any regulating body determine this value. It is configured on a per neighbor basis. You can also take a look at the command in Cisco’s command reference.

As for PeeringDB, it is the first time that I have taken a look at this tool. It is very interesting and provides a lot of information about various networks. It can be quite useful when interconnecting with networks, especially for ISPs searching to interconnect with various backbone networks. I haven’t used it before so I can’t say too much about how to use it.

However, I can tell you a little about the recommended IPv4 maximum prefix limit, as stated in the platform, and as shown in the image below.
Remember that the Internet is an interconnection of multiple networks, each having a set of BGP AS’es, and IPv4 and IPv6 prefiexes. Now as the Internet grows, the number of prefixes grow. Theoretically, we can have all routers on the Internet share all routes on the internet. At the time of writing, the Internet IPv4 BGP Table contains 829123 prefixes, while the IPv6 BGP table contains 83601. If routers had to exchange the full Internet routing table, it would obviously overload most or all networking devices.

So BGP AS’es must limit what information, and how many prefixes they send to each other to make BGP exchange more efficient. This limitation of maximum prefix, is one set by each network itself that says “Please don’t send us more than X number of prefixes”. This is done to protect their own equipment from being overwhelmed with useless prefixes.

As stated in this lesson, in the section titled BGP Advertisements you can share partial routing updates between AS’es, which is recommended. They should be arranged so that the most information is given in the least amount of prefixes. This can be done by sharing less specific routes as well as using a default route.

I hope this has been helpful!


I have some question about how many routes(network prefix) should an AS learn or advertise.

<We can use BGP to advertise our address space to the ISPs but what are the ISPS going to advertise to our customer through BGP? There are a number of options:

They advertise only a default route.
They advertise a default route and a partial routing table.
They advertise the full Internet routing table.>

q1) How many network prefixes does an AS advertise ? I mean the prefixes made by IGP intra AS.
I guess it can be only one prefix if the AS has one aggregated network(supernet) such as
q2) Are there about 500,000 bgp prefixes(full routing table) in spite of supernetting ?
q3) Advertising method : ‘network’ command or Redistribute
a) Why we use Redistribute?
b) case study: OSPF table has 1,000 routes. Redistribute OSPF into BGP
I think this redisribution does not make sense because 1,000 routes is useless. These route should be aggregated and then advertised.


Hello Michael

Theoretically there is no limit to how many prefixes an AS can advertise. It all depends on how you configure the advertisement of your networks. You can either advertise each individual network, or fewer (or one) aggregated network. Needless to say it’s more efficient to advertise aggregated networks, but sometimes it’s not possible to aggregate everything into a single prefix. Ultimately, you must balance between the two, and achieve some level of aggregation to advertise as few prefixes as possible.

According to the CIDR Report as of today there are over individual 830000 prefixes which have been CIDR aggregated to over 450000 prefixes. Even with aggregation, the number of prefixes is still quite large.

The network command will manually place a specific prefix into the BGP table so that it can be advertised. Redistribute will allow you to inject prefixes from other routing protocols (OSFP, EIGRP etc) into BGP. Both are used for particular purposes.

For the redistribute feature, this is very important because it allows you to inject routes learned dynamically by an IGP, into BGP. So as OSPF learns new routes, as networks expand and are upgraded, these routes are automatically injected into BGP. In the event of a failure, if an OSPF route is removed, OSPF will reconverge, and redistribution will dynamically inform BGP of changes.

The network command is simply a static statement, and cannot dynamically reconverge when things change. The way in which both of these features can be used is discussed in further detail in the following lesson:

Yes, what you say makes sense, but this is not a reason to get rid of redistribution altogether. Redistribution in general, from any routing protocol to any other routing protocol, can be tuned and adjusted in order to provide summary prefixes and summary routes thus avoiding having to redistriubute hundreds or thousands of routes from one protocol to another.

Route summarization can be employed within the IGP before redistribution, in order to reduce the number of prefixes redistributed. Here are a few lessons about that:

Even BGP can be configured to send aggregate routes:

I hope this has been helpful!


A post was merged into an existing topic: Single/Dual Homed and Multi-homed Designs

Hi Laz.

BGP neighbor ip address which we specify in neighbor command will always be next hope router loopback or physical interface address( via routers are connected) whether router id is configured or not?

Hello Pradyumna

The router ID of a BGP router is chosen in the same way that it is chosen for OSPF. This is further described in the description of the BGP Open Message at this lesson. There is only one single BGP router ID and it is used to uniquely identify the router within the BGP AS.

However, the IP addresses used in the neighbor commands are independent of the router ID. They are always an IP address of a loopback or a physical interface. The address doesn’t actually have to be a directly connected router (next hop). For iBGP you can specify the IP address of another iBGP router that is several hops away, but is still in the same AS. For eBGP you can actually use the multihop feature to configure an eBGP relationship over several hops.

So to clarify, the router ID and the IP address used in the neighbor command are not related. Only actual IP addresses on loopbacks or physical interfaces can be used by the neighbor command.

I hope this has been helpful!


1 Like

Thanks Laz for clarification.

1 Like

is there some actual config that can guarantee 80% tarffic from one ISP and 20% from other ISP
like lets say the customer A have router A and that is connected to ISP X and ISP Y
IS there a config that i can do in router A that exactly 80% will go from X and 20 percent through Y
Thanks a lot for the awesome content as always

Hello Anoop

First of all, we have to specify what kind of traffic you want to achieve this for, incoming or outgoing? Remember that you are in complete control of your outgoing traffic, but you are not in control of your incoming traffic. You can talk to the ISPs that you’re connected with and ask them to help you achieve the kind of load balancing you’re searching for, but there is no way to guarantee incoming traffic on a percentage basis.

Now for outgoing traffic, there are several ways to do this. These are not limited to the use of BGP but may use other connectivity methods as well, and this will depend upon your topology and your edge network architecture.

When using routing protocols for load balancing on Cisco devices, CEF is used. CEF can use either a per-packet or per-destination load balancing mechanism, so there is no way to specify a percentage. The only exception is EIGRP, where you can use the Variance command to specify how much traffic goes over each possible link.

The other option is to use shaping or policing to specify particular traffic patterns.

I hope this has been helpful!


Thanks for the reply

Yes i get the fact that any attribute we apply for incoming traffic can be override by the neighbor

But i am talking about outgoing traffic , because i have been asked this in one interview lets say we have 2 exit routers and i want 80% traffic from router A and 20%traffic from Router B
And now i saw the same thing written in this site aswell that we can achieve this in BGP
What i am not getting is the exact config that we are supposed to do to achieve this .
How can i tell router that how will the router understand that 80percent numeric value is their some specific command
How is this done

Hello Anoop

Remember, BGP is a routing protocol, which means it determines where to send packets based on their destination IPs, and where to send them is determined using the prefixes that are exchanged by BGP routers. In addition, this forwarding of packets can be influenced using the various BGP attributes that you can adjust.

Even so, the ultimate distribution of traffic in a multi-homed environment will be determined by the distribution of destination IP addresses in each of the packets. In other words, you can route some prefixes one way and others the other way, but this means that you may not have a constant distribution of the load balancing.

The only way to further balance is to use BGP multipath load sharing, but this requires certain attributes to match, and delivers load sharing equally (50/50), and this is just for traffic to the same destination.

So using solely BGP (as far as I can tell) cannot achieve an exact 80/20 split of traffic between two ISPs. You must use additional features such as policing and shaping as mentioned in my previous post.

I hope this has been helpful!


Thanks a lot lazaros for clearing this doubt
Because i have been asked in one interview how to make 80/20 traffic with BGP where i went completely speechless and i still dont know the answer to it
But when i read the introduction to BGP in BGP topic and its written like this
“You could advertise a default route with the same metric but you’d still have something like a 50/50% load share. What if I wanted to send 80% of the outgoing traffic on the primary link and 20% down the backup link? That’s not going to happen here but with BGP it’s possible.”
So i was thinking there must be some concrete config that we can do that can give us pinpoint percentage level accuracy as we wish 80/20 or 70/30

Hello Anoop

I consulted with Rene on this one just to verify my claims. Here’s what he said:

A hard 80/20 split would be difficult. What I meant is that with an IGP, you only have a default route to exit your AS. Everything outside of your AS is a blind spot.

With BGP (if you have a full or partial routing table), you know what prefixes are out there. You could use weight or local pref to decide how to leave your AS per prefix.

It’s a manual process though. You could set weight or local pref to a part of all prefixes you receive. If you really wanted 80/20, you’d need to monitor all flows and build something that sets the attributes.

However, he did suggest Performance Routing to be able to dynamically adjust routing based on the bandwidth you have available for each link. More information about this can be found here:

I hope this has been helpful!


Hi Rene, Thanks for your wisdom.

So as I can understand we receive the full Internet routing table in our ISP so that everyone can reach us, and we can reach any other ip in the world…there’s no other way, isn’t it?

But there’s a lot of addesses…

Thanks for de reply


Hello Fran

First we have to understand the difference between what the customer advertises to the ISP, and what the ISP advertises to the customer.

In order for the rest of the Internet to be able to reach our own IP addresses, where we are running some service that we want the rest of the world to use, as the customer we advertise our IP addresses to the ISP using BGP. It is then the responsibility of the ISP to advertise these addresses further downstream into the Internet at large, using BGP. This is the only thing that is needed to advertise the customer addresses to the rest of the world. There is no need to receive the full internet routing table to achieve this.

Now for outgoing traffic, in order for our customer to reach the rest of the world, there are three options we can choose from, as they are stated in the lesson. One of these options is to have the ISP advertise the whole Internet routing table to us. But this is only for outgoing traffic! This is not generally recommended, because as you say, there’s a lot of addresses, and our corporate edge routers are usually not built to handle such large routing tables. That’s why we have the other two options, which are simply using a default route, or using a partial BGP table.

I hope this has been helpful!



Greetings laz!

Understood, thaks so much for the answer. That helped me a lot to understand it.


1 Like

““IGP are not scalable to use for a network as large as the Internet.””
There is a sentence like the one above in the text.
I have a question.
Why?? Can’t OSPF’s PID and AREA be used like BGP AS?