BGP for Beginners

 I’m writing this article for everyone that is new to BGP. Perhaps you have passed your CCNA and have learned about all the IGP’s like OSPF, RIP and EIGRP but you still don’t know anything about BGP. Before we start talking about BGP, there’s something you need to keep in mind…

 

Forget everything you know about OSPF (link-state) or EIGRP/RIP (distance vector) routing protocols because BGP is totally different and called a “path vector” routing protocol. Now don’t feel frustrated 😉 We’ll have a look and see what BGP is all about! You are probably familiar using EIGRP or OSPF since these are IGP (Interior gateway protocols) and you are using them on your own network.

 

You should be familiar with the term AS (autonomous system), your own network is an example of an autonomous system. All the interior gateway protocols have one thing in common, they all want to find the “shortest” path to their destination network. They have a different view on what the shortest path is though:

 

  • OSPF: Cost
  • EIGRP: Bandwidth, Delay, Load and Reliability (also called the K-values)
  • RIP: Hop count

 

BGP is not an interior gateway protocol but an EGP (exterior gateway protocol) and used to connect all the different autonomous systems. Now think big…..BIG! On an Internet scale we have a LOT of autonomous systems. With BGP we can see all the different networks, to which autonomous system they belong and which autonomous systems we have to cross to get there. BGP is what we use for routing on the Internet.

 

BGP Autnomous Systems

 

In the picture above we see multiple autonomous systems. These could be large networks from service providers who are connected to each other. Within each autonomous system we are running an Interior gateway protocol. AS100 might be running OSPF, perhaps AS200 is running EIGRP and AS300 and AS400 something else.

 

The routers that are connecting the different autonomous systems to each other are running BGP. Because we are setting up BGP between 2 different autonomous systems this is what we call “External BGP”. Now if you want to see what a real BGP router looks like, you can use one of the many looking glass servers that are found on the internet, try the following one by telnetting to this address:

 

route-views.optus.net.au

 

So just type in “telnet route-views.optus.net.au in your command line and you’ll have access to a Cisco router.

 

Type in “show ip bgp” to see an example of a BGP routing table:

 

 

BGP table version is 134443079, local router ID is 203.202.125.6  Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  r RIB-failure, S Stale  Origin codes: i - IGP, e - EGP, ? - incomplete  Network Next Hop Metric LocPrf Weight Path  * 1.0.4.0/22 202.139.124.145 10 0 7474 7545 56203 i 

 

If you look at the right side you see “Path” with the values 7474, 7545, 56203. These values are the autonomous systems that you have to go through in order to reach network 1.0.4.0/22. Pretty neat huh? Metric, LocPrf (Local Preference) and Weight are the attributes that BGP uses to influence routing decisions, you can forget about those for now but I will write another article on them in the future.

 

We just learned what external BGP is, this is when you run BGP on routers between different autonomous systems. But there’s also internal BGP so let’s see what it is and why we need it.

 

Take a look at the following picture:

 

Transit AS

 

Let me explain you what we have here: There are 3 different autonomous systems, AS100, AS200 and AS300. As you can see AS200 is running OSPF inside it’s autonomous system. We don’t care about what AS100 or AS300 is running inside it’s autonomous system for this scenario. We are using the following ip addressing scheme within the autonomous system:

 

AS100: 10.0.0.0/8

AS200: 20.0.0.0/8

AS300: 30.0.0.0/8

 

BGP has been configured between the 3 autonomous systems, and since it’s between autonomous systems this is EBGP (external BGP). We have advertised the networks in BGP and life is good. However in this scenario there is a problem.

 

AS100 will advertise 10.0.0.0/8 towards the BGP router in AS200 on the left side.

 

How does the router on the right side in AS200 know about this information? We are only running OSPF within AS200 and we are not redistributing BGP information into OSPF. (An Internet routing table consists of roughly 350.000+ entries…no way you can have this many networks in OSPF).

 

The answer is simple…let’s configure BGP between the left and right router within AS200. Since they are in the same autonomous system this is called IBGP (internal BGP). Excellent so now both routers are running IBGP and they can exchange routing information.

 

So are we done? Is this going to work? Unfortunately….Nope! Internal BGP (IBGP)

 

Let’s imagine the following situation: AS100 sends a packet meant for 30.0.0.0/8 towards AS200. AS200 has learned about the 30.0.0.0/8 by BGP and knows where to send it. The router on the left side in AS200 will send it towards the router on the right side by using the router on the top or bottom in AS200.

 

What do you think these routers will do? Does OSPF know about the 30.0.0.0/8 network?

 

No they don’t….they have no clue where this network is so they will drop the packet and send it to IP packet heaven. The solution is that you need to configure BGP on ALL routers within AS200.

 

So do you always have to configure IBGP? You only have to do this when your autonomous system is a transit AS. A transit AS means that your autonomous system can be used to pass traffic to another autonomous system. In this case AS100 needs to pass AS200 in order to reach AS300.

 

Ok I think that’s enough BGP for now and to be honest I’ve been writing a bit more about BGP than I intended when I started this article. In the upcoming articles I will be writing about BGP attributes, this will show you how BGP will choose a certain path and how we can influence routing decisions.

 

So what do you think? Does this make sense to you? I’d like to hear what you think so leave a comment if you feel like!

Opt In Image
Do you want your CCNA or CCNP Certificate?

The How to Master series helps you to understand complex topics like spanning-tree, VLANs, trunks, OSPF, EIGRP, BGP and more.

Written by René Molenaar - CCIE #41726

You May Also Like

About the Author: Rene Molenaar

René - CCIE #41726 is the creator of GNS3Vault.com where he shares CCNA, CCNP and CCIE R&S labs. He also blogs about networking on http://networklessons.com

38 Comments

  1. this one just awesome please post few more like this and real equipment access also to practice if possible

  2. I’m glad you like it. You don’t need real equipment to practice BGP, just download GNS3 and use some routers. Check out the “BGP basic Lab” since this will let you configure the basic commands to setup BGP.

  3. You need to think BIG. There’s no reason for a small company or ISP client to use BGP.

    If you have a large network but only a single connection to an ISP, you also don’t need BGP.

    Let’s say you have 2 different ISPS, if you wouldn’t use BGP then you just advertise a default route in your IGP and send all traffic towards a single ISP. You could also advertise 2 default routes with a different cost or metric, if one router fails the other will take over.

    Now you want to load balance a bit more…20% of the traffic towards ISP1 and 80% towards ISP2…how are you going to do this with OSPF/EIGRP/RIP?

    Or…you got some public IP address space and you want to advertise this to 2 different ISPS…

    I got a really cool document which explains this, I think I should update my article to add this information.

    1. can you please share that document with me. I also searching for the same doc for load balancing with OSPF/EIGRP/RIP
      I will be really thankful for you.
      My mail ID is azhar.sid14@gmail.com

  4. Having bgp between ISP, or between AS that “creates” internet makes perfectly sense…

    what i don’t get is why i should use bgp in my company (let’s admit that for some reasons i MUST find the best path to reach a destination, if for example i have a branch somewhere in the world) i cannot understand why me, an ISP client, should use bgp to push routes into bgp… ip address are ultimately assigned to the customer by the ISP, than the ISP already know the ip(subnets) and she will push them into bgp routing updates.. so… why should i do that? am i still thinking to small or what (i’m actually studying ccnp route exam)

  5. i perform load balancing using GLBP, but i guess i’m starting to understand… can’t wait for your updates.. what to say.. lucky me, you wrote this in the moment i started to study gbp 🙂

  6. GLBP is also nice for load balancing, you could also use NAT.

    Let me put it in another way…without BGP everything outside of your AS is a “blind spot”. You have no idea what’s out there. Once you are running BGP you know about all those prefixes, which AS they belong to and through which paths you need to go in order to get there.

    Having “more” complete routing information will ensure you can make better routing decisions…does this make sense?

    I’ll cook up another article for you.

  7. yes.. it perfectly make sense…

    as a company and as a “read only user”

    what i don’t exactly understand is why should me, as a company push routing updates into GBP, and update the internet. looking on what you wrote it make sense only if i have more than one ISP becuse, even if one ISP gave me my address pool, and that particular ISP only know how to reach me, i may want to inform the other ISPs to witch i am connected that another path (though them) exist to reach me.

    is that correct?

  8. Andrea,
    One major reason why a company will use eBGP is for incoming traffic. Let’s say company A is hosting their own website and they have 2 ISP’s. If they are using an IP that is assigned from ISP 1 for there web server then they will use BGP to advertise this address out ISP 2 as well. This way the internet will now see that there are 2 possible paths to their IP address rather than just the path from ISP 1. Therefore, if the connection between ISP1 and company A drops, the company A’s IP address is still available from ISP2.

    Remember ISP2 is only going to advertise their networks that have been assigned to them from ARIN, therefore, company A needs to use eBGP to advertise this alternate route. This happens all the time with many companies that purchase dedicated internet access circuits.

  9. Great article on Basic Understanding of BGP, I ever read. Rene, I really appreciate your effort to share knowledge and experience. You are the “Rocks”; after reading this article I stated thinking BIG 😉 I hope you will keep it up.
    I just started CCNP ROUTE preparation.

    Thanks

  10. Don’t know how to appreciate you!, You brought me back to ma college!
    Great, well done!
    gafoorcholayil
    INDIA, Kerala

  11. Rene,

    From a beginner point of view this article is awesome. I guess that the other articles will get into more details such as the need to use loopbacks to identify the iBGP routers and their associated configurations…

    Simply outstanding!

    JZ

  12. This article is awesome. This is my first time reading on BGP as I have not gotten to it yet in the ROUTE book. Its nice and concise, plus its easy to understand.

  13. I want to create a BGP internal connection (for learning purposes and to create a MP-BGP VPN) using tunnels between 2 GNS3 routers on two different laptops using 2 different internet connections, so far I have everything set up, the 2 GNS3 routers both can ping to each other PUBLIC IPs, but is there any way to forward the BGP TCP connection from my 2 Home Physical Routers to the GNS3 routers passing through the GNS3 clouds loopbacks?

    To make it more interesting one of the laptops running GNS3 is a MAC, using the tap0 interface.

    Would be of help to use Dynamic DNS instead of IPs for the tunnel destination if I first set it up on both Physical Home Routers?

    Am I doing something at all possible? Or I am totally deranged and confused?

    I would appreciate any comments….

    1. The ip assignment looks something like this:

      172.16.1.6 (GNS3 MAC)—> 172.16.1.5 (GNS3 Loopback)—> 192.168.1.5 (MAC Ethernet)—> 192.168.1.1 (First Location Physical Router)—> Dynamic Public IP

      192.168.0.3 (GNS3 PC)—> 192.168.0.1 (GNS3 Loopback)—> 192.168.1.101 (PC WIFI)—> 192.168.1.1 (Second Location Physical Router)—> Dynamic Public IP

  14. is it me or is this link to the looking glass server no longer working?

    route-views.optus.net.au

    1. nevermind, I was trying to go to the link using a web browser thinking it was web based …DOH !!!

      I used command line like I should have done :/

  15. This articular is really help me a lot to make clear picture for BGP at basic lavel.
    Thank_Q very much Sir.

  16. very useful article..very well said…simple and understandable for a beginner like me it helps a lot nad i want to hear more about this topic…thank you very much for sharing.

  17. Rene, thank you for the excellent article. However can you please clarify one point for me?
    In this article, you said ” … (An Internet routing table consists of roughly 350.000+ entries…no way you can have this many networks in OSPF).” Does that mean the protocol can’t handle 350,000+ entries?
    I thought that was dependent on the router CPU & mem.

    Second related question was, does the router use much more memory if it has all the routes through iBGP and then it has those routes in OSPF through redistribution?

    Thank you –

    1. It is dependent on CPU and memory. Today it might be possible to do it in OSPF but it probably wouldn’t make sense.

      It will use more memory since the LSA5 and BGP routes exist at the same time and as separate data objects. So yes.

  18. Rene,
    Great labs and excellent lessons. I’ve used BGP many times, but never understood all the many types of attributes, etc. So, I went back to the basics and started with your BGP Basic lab.

    Which order do you suggest I go in (the BGP labs) to build up from easiest to most complex?
    Thanks
    Al

  19. Prefect explanation in easy wording and easy to understand.

    Thanks

Comments are closed.