- 1 BGP Introduction
- 2 BGP Transport method
- 3 BGP router vs BGP peer
- 4 BGP packet types
- 5 Some BGP connection scenarios
- 6 BGP neeighborship states
- 7 BGP peering agreement
- 8 Types of BGP tables
- 9 Methods to advertize a BGP route
- 10 Filtering BGP routes
- 11 BGP attributes
- 12 The 10 rules of BGP path selection
Historically, there was EGP. then came BGP. BGP is a popular Exterior Gateway Protocol. It falls under neither the distance vector, nor the link state family; it is a path vector protocol.
BGP is a policy-based routing protocol; we can manipulate the routing packets according to various criteria.
BGP is the protocol with the slowest convergence time.
Without tuning, BGP behaves like RIP; path selection occurs based on the hop count, where hops are the autonomous system numbers.
BGP is used as a protocol that interconnects between autonomous systems, such as:
- multihoming Internet connection: when the company has more than one Internet connection with more than one ISP
- ISP-to-ISP peering.
BGP builds path vectors. A path vector contains:
- a path to a network prefix, and
- a list of path attributes (for example: the ORIGIN attribute which describes how the prefix was introduced into BGP). We’ll discuss them in the BGP Attributes paragraph.
The path is a series of ASN in reverse order.
A BGP router chooses the best path based on its BGP routing policy.
A BGP announcement – aka BGP update message – is an update about one and only one path. It contains the following:
- a list of prefixes within the path
- the path attributes
Each autonomous system advertises the best path to reach the prefixes of the autonomous system behind it. In the figure, AS2 advertises to AS1 only the best path it has for AS11 prefixes.
BGP updates are triggered and incremental.
BGP Transport method
The BGP connection runs over TCP port 179. And despite that, the only reliability mechanism that BGP has is TCP ACKs.
When designing a network with BGP and you have some filtering in the network (such as a firewall or ACLs), make sure to allow the TCP/179 connection between BGP routers, in both ways, because you don’t know which router will initiate the BGP connection first.
BGP router vs BGP peer
A BGP router is also called a BGP speaker. It’s a router that runs BGP. However, a BGP peer is more than just a BGP router; it has established BGP neighborship with some other BGP routers.
it is recommended to establish BGP peering over loopback interfaces, because loopback interfaces never go down in a network.
BGP packet types
- Notification: informs the BGP protocol that something “bad” happened.
When the UPDATE messags are exchanged, BGP does not need to exchange the KEEPALIVE messages.
Some BGP connection scenarios
When a company is multihomed, there could be one of these BGP connection scenarios:
- ISPs send default routes to the company BGP routers. This is obviously the simplest scenario,
- ISPs send default routes and a portion of their BGP table.
When you have a connection to a single ISP, there is no need for BGP. A simple default route would suffice.
BGP neeighborship states
There are four stages before two BGP routers become neighbors:
BGP peering agreement
Between a company and an ISP, there could exist a peering agreement. This is a document that describes the BGP configuration between both parties.
For example, an ISP could require network blocks of /18 to be announced by the client enterprise network, as part of the peering agreement.
Types of BGP tables
There are three tables used by BGP. Two of them are typical of BGP:
- BGP neighbor table: list of peering relationships
- BGP table: list of BGP prefixes
- RIB: Routing Information Base. This is the classical routing table we used to see in a router. The best paths of BGP are inserted here.
Methods to advertize a BGP route
You can advertize a BGP route in one of the following ways:
– with the “network” statement
– with redistribution
– with an aggregate route
– with a default route “default-information originate”
Filtering BGP routes
Filtering routes in BGP can be done with one of the following commands:
- neighbor … prefix-list …
- neighbor … distribute-list …
- neighbor … filter-list …
- neighbor … route-map …
BGP provides flexibility in the fact that it can customize individual route properties, while IGPs provide only the capability of customizing the metric (or cost) of the whole protocol. These properties are called attributes.
BGP attributes -aka BGP path attributes– are the massive metrics of BGP. There is about 80 attributes. And they fall under one of these categories:
- well-known attributes,
- optional attributes.
BGP route aggregation: it is the mechanismof route summarization, but specific to BGP
The 10 rules of BGP path selection
Before giving the famous list of BGP path selection criteria, the network must have the following properties:
- Routes are synchronized
- there is are no AS loops
- the next hops are valid
Here are the 10 rules for path selection, ordered:
- highest Weight
- highest Local Preference
- existence of route with next hop 0.0.0.0
- shortest AS Path
- lowest Origin
- lowest MED
- EBGP routes are privilieged over IBGP routes
- route through the closest IBGP neighbor
- prefer the oldest route
- lowest neighbor’s Router ID