T his month, we'll talk more about BGP and introduce some concepts and details that you'll need to have before we can move on to showing you how to actually configure a router to speak BGP to your provider(s).
By the end of next month's column you should understand enough about BGP to set it up in a simple and safe configuration if you're single or multi-homed.
In future columns we'll be talking about things like RIP, OSPF, and other internal routing protocols. Also in future months we'll talk about more exotic BGP features, but we're going to keep it pretty simple for now.
BGP is a routing protocol-it's used to tell people outside your network (upstream providers or "peers") about the routes (or portions of the IP address space) you know how to get to inside your network. The primary purpose of BGP4 (as we're studying it here) is to advertise routes to other networks (Autonomous Systems). The secondary purpose of BGP4 is to get routes from providers and peers so that you can make more intelligent decisions about how to send traffic out of your network. BGP stands for Border Gateway Protocol. The popular BGP protocol that people speak of when they ask, "can a Cisco 2501 speak BGP?" is actually BGP4. BGP as we're studying it here is strictly an EGP, or Exterior Gateway protocol.
BGP TERMINOLOGY PART I
An AS, or Autonomous System, is a way of referring to someone's network. That network could be yours; a friend's; MCI's; Sprintlink's; or anyone's. Normally an AS will have someone or ones responsible for it (a point of contact, typically called a NOC, or Network Operations Center) and one or multiple border routers (where routers in that AS peer and exchange routes with other ASs), as well as a simple or complicated internal routing scheme so that every router in that AS knows how to get to every other router and destination within that AS.
When you "advertise" routes to other entities, one way of thinking of those route advertisements is as promises to carry data to the IP space represented in the route being advertised. For example, if you advertise 220.127.116.11/24 (the Class C starting at 192 .204.4.0 and ending at 18.104.22.168), you promise that you know how to carry that data destined for any address in 22.214.171.124/24 to its ultimate destination. The cardinal sin of BGP routing is advertising routes that you don't know how to get to. This is called black-holing someone. If you advertise some part of the IP space that is owned by someone else, and that advertisement is more specific than the one made by the owner of that IP space, then all of the data on the Internet destined for the black-holed IP space will flow to your border router. Needless to say, this makes that address space disconnected from the Net and makes many people unhappy. The second most heinous sin of BGP routing is not having strict enough filters on the routes you advertise. The bottom line: Test your configs and watch out for typos. Think through everything that you do in terms of how it could screw things up.
Also, one terminology note: Classless routes are sometimes called prefixes. When someone talks about a prefix they're talking about a route with a particular starting point and a particular specificity (length)-So 126.96.36.199/24 and 188.8.131.52/20 are not the same prefix (route), because they are of a different specificity-a /24 is as big as one Class C and /20 is as big as 16 Class Cs.
BEING "CONNECTED" TO THE INTERNET
Throughout this discussion it's critical to think about what it means to be connected to the Internet. To be connected to the Internet, for each host that is on the Internet, you need to be able to send a packet out a path that will ultimately wind up at that host. Furthermore, that host has to have a path back to you. This means that whoever provides Internet connectivity to that host has to have a path to you. This ultimately means that the provider must hear a route that covers the section of the IP space that you are using, or you will not have connectivity to the host in question.
Every IP address that you can get to on the Internet is reachable because someone, somewhere, has advertised a route that "covers" it. Similarly, if there is not a generally-advertised route to cover an IP address, then no one on the Internet will be able to reach it.
HARDWARE AND SOFTWARE
Most of it is pretty self-explanatory; briefly:
This is a session summary from one of Net Access's core routers. The 6451X Autonomous Systems are BGP sessions to other Net Access routers-those ASNs are not shown to the world. The 184.108.40.206 session is a session that is down, and the sessions where the remote Autonomous Systems are 4231, 3564, and 6078 are external peering sessions. (This router peers with our Pennsauken, MAE East, and MAE West routers via the 645xx sessions.)
We're talking about eBGP in this document. eBGP and iBGP share the same low-level protocol for exchanging routes, and also share some of the algorithms, but eBGP is used to exchange routes between different Autonomous Systems, while iBGP is used to exchange routes between the same Autonomous System. In fact, iBGP is one of the interior routing protocols that you can use to do active routing inside your network. We'll talk more about iBGP in future columns when we cover all of the major interior routing protocols: OSPF, iBGP, IS-IS, RIP, and RIPv2.
The major difference between eBGP and iBGP is that eBGP tries like crazy to advertise all known BGP routes to everyone-you have to put filters in place to stop it from doing so. iBGP is actually pretty difficult to get working because it tries like crazy not to redistribute routes. In fact, all iBGP-speakers inside your network have to peer with all other iBGP speakers to make it work. This is called a routing mesh and, as you can imagine, is quite a mess. If you have 20 routers, each router has to peer with every other router. The solution to this is BGP confederations-a topic for a future column.
When you have one upstream provider, it is rarely desirable to speak BGP to them. Why? Well, you only have one path out of your network. So filling your router with 45,000 BGP routes isn't going to do you any good, since all of those routes point to the same place (your one upstream provider).
And if you have one upstream provider, it's almost guaranteed that you are using sub-allocations (CIDR delegations, to be precise) of their larger IP blocks (aggregates). In this case your provider is not going to advertise your more specific routes-see May 1997's column for an explanation.
If you're single-homed, the whole Internet doesn't need to know if you lost connectivity to your provider, since there's no other path to get to you.
Similarly, in case it's not obvious, if you are multi-homed and your providers are announcing more specific prefixes for you, then they should stop announcing you when they don't know how to get to you any more.
The beauty of speaking BGP to your providers is that when you lose connectivity to them (a T-1 or 56k or what you have goes down), the BGP session will go down as well and all of those route advertisements will be automatically withdrawn.
Every time a route is advertised via BGP, it is stamped with the ASN of the router doing the advertising. As a route moves from Autonomous System to Autonomous System (network to network), it builds up an AS-PATH. Each route starts out with a null AS-PATH, represented by the regular expression ^$.
The AS-PATH is useful for the following reasons:
For routes of the same specificity, as-path length is going to be the deciding factor for choosing which of multiple routes gets used by the router (i.e. put into the IP routing table) when you're just starting out.
We'll shortly go into BGP metrics and attributes-parameters associated with BGP routes that allow you to select and change the selection of the best BGP route for a certain destination.
For now, keep in mind that unless you do any tuning on your own:
When you assert a route-saying "I know how to get to 220.127.116.11/24" based on some internal knowledge that you actually do know how to get to 192.204.4/0- the natural (and previously-thought-to- be-correct-thing-to-do) is to withdraw that assertion if you in fact no longer know how to get to that route.
But look at what happens when you withdraw that assertion. Your providers must then also withdraw that assertion. And then their providers and peers must do the same. All in all, thousands of routers around the world now have to look at that route and decide if they have a next-best path in their BGP table, and insert it as the current best path in their IP routing table. This consumes many CPU-seconds on routers that are sometimes very busy.
In fact, it was consuming so much CPU time a few years ago that Sean Doran of Sprintlink said, "this must stop." Several people came up with an idea, which Cisco implemented in record time, to dampen the route flaps. You'll hear people say "damp" and "dampen." There's no real consensus about which is the correct term.
What this means in practice today is that if your routes flap more than one or two complete up-down-up cycles, then you will be dampened by many providers for at least an hour or so. So even if you're only single-homed, you will be dampened if your provider withdraws your routes every time your T-1 flips up and down a few times because some Bell guy tripped over a wire.
So do not ask your upstream provider to announce you unless it makes a difference. The benefit of being multiply-announced outweighs the possible negative effects of being dampened due to instability in either your or your provider's network.
When you're bringing up a new BGP session, or considering how to do BGP in general, the things to keep in mind for each peer are:
Let's review what happens when you are connected to the Internet without speaking BGP to your provider. Last month's column explained this in more detail.
If you have any address space inside of your provider's larger netblock or aggregate, then you won't be advertised to the outside world specifically-your provider will just advertise their larger block. If you have any other networks (an old Class C; customers with address space; etc.), then your provider will just statically announce those routes to the world and statically route them inside their network to your leased- line/ router interface(s).
With BGP, your provider gives you all of the routes they have (the easy part), and listens to your route announcements and then redistributes some or all of those to their peers and customers. This is the hard part for them. The net difference is just that they may start advertising a more specific route (no mean task in a complicated network designed, as most networks are, to prevent the accidental leaking of more specific routes) or that the routes that they normally advertise for you under just their ASN will now have your ASN attached as well.
OK, so you're multi-homed. What is the most important thing about BGP to you? The ability to have it announce routes. Getting full or partial routes from your providers is cool-and may even be useful-but you can do almost as well by just load-balancing all outgoing traffic in either a round-robin or route- caching manner.
So, the most important thing about being multi-homed is the ability to have your routes advertised to your providers -and by them to their providers and peers (i.e. to the rest of the Internet). Doing this basic level of route advertisement is not hard. You just have to do it in a paranoid way.
If you screw up BGP routing, then you may get slapped down pretty hard. Screw ups with BGP route advertisements can be felt all over the Internet. To repeat: Screw ups with BGP route advertisements can be felt all over the Internet. If your provider is smart, then they will also implement filters to prevent you from screwing them and the Internet up. But don't count on it.
If you were to announce a route that was more specific than, for example, the otherwise-best route for Yahoo's web servers, you would black-hole Yahoo for a period of time. Needless to say, they would not be very happy with you. The solution is to do good filtering on your end-and for your provider to also do excellent filtering wherever possible.
Before you start playing with BGP, you might really want to wait and read the "Configuring a Cisco Router" column (coming out in the next few months). If you do go ahead and are implementing BGP for the first time, then get a friend or another provider to review your proposed configs for you before implementing them.
Generally, the goal of multi-homing is to use both connections in a sane manner and load-balance them somehow. Ideally, you'd like roughly half the traffic to go in and out of each connection. You'd also like fail-over routing, where if one connection goes down, then the other one keeps you connected to the Internet. In an ideal network, you'd be able to have any one of your connections to the Net go down and still maintain connectivity and speed.
Incoming traffic is controlled by how you announce your routes to the world. Packets will flow into your network because someone heard and is using a route announcement. Outgoing traffic is controlled by the routes that you allow to flow into your border router(s)-and is thus much easier to control and tune.
Sorry if this seems like a teaser-we'll get to the actual BGP configuration process and examples next month. If you're impatient, a somewhat long document is available at www.netaxs.com/~freedman/bgp/bgp.html.
Copyright 1998 Mecklermedia Corporation.
All Rights Reserved. Legal Notices.
About Mecklermedia Corp.
13949 W Colfax Ave Suite 250, Golden, CO 80401
Voice: 303-235-9510; Fax: 303-235-9502