What Is BGP?

what is bgp used for

Border Gateway Protocol (BGP) is the transit service of the Internet. To explain simply, think of a postal system whereby you send a letter to someone, the postal service will then send that letter to the destination using the most efficient or cost effective way to get there.  In terms of BGP, the protocol uses the best path that the data can traverse over.  This usually requires passing through other autonomous systems (or depots in our example).

What Is BGP Used For?

BGP is used by the internet and makes things happen by enabling the best data routing to the packet’s destination.  For example, if you accessed a server hosting content that was located in the UK and you were in the US, the data request would pass through several autonomous systems (depots) until it reached the server in the UK and back to the client.

What Is An Autonomous System?

All networks on the internet are made up of smaller networks which are connected together by routers.  These smaller networks are known as autonomous systems (AS) and are uniquely identified by a number such as AS12345.

An AS is similar in its operation to a mail depot, each geographical location will have hundreds of mailboxes, the mail will be posted into the mailbox, then sent to the local depot for sorting and sending on to the correct location for delivery.  Routers operate like mailboxes; they forward the traffic on to the AS which in turn then forwards on to the next AS and then forwarded to the correct router (or mailbox in our example).

Autonomous Sytem Example

Imagine we had AS100 as our autonomous system and we were located in Scotland. On the internet also existed the following;

  • AS200 (Spain)
  • AS300 (Singapore)
  • AS400 (Australia)
  • AS500 (Florida)

We need to send data to Spain; the AS numbers are all connected and gives us multiple options to send the data via different autonomous systems.  It wouldn’t make any sense to send the data via AS300, AS400 or AS500, that would cause more latency, rather the router will calculate that the best path is direct to AS500 as this has less hops and is by far more efficient. 

This was a very simplified example of an autonomous system, but in reality, there are thousands of AS and routers, the calculations for best path go far deeper and there are always events such as router failures which cause paths to change which relies on BGP advertisements.

As the Internet is constantly changing with new networks and outages of others, it is important that every AS has up to date information about new paths (routes) and others that are no longer available.  The information is shared via peering sessions where each AS connects to another AS and exchanges routing information.  The hosting provider would often charge their customers for this feature, which save the customer more than setting up an AS.

Autonomous systems can be shared across different businesses, for example a hosting provider may own an AS, whilst its customers or resellers can use that AS to advertise their IP space on rather than maintaining their own AS.

BGP Management

Autonomous systems typically belong to ISPs or large businesses that manage their own networks internally and externally.  For each organisation that wishes to maintain their own AS, they must register and pay a fee to an official RIR (Regional Internet Registry), in the UK area this would be RIPE. 

IANA (Internet Assigned Numbers Authority) assigns ASNs to RIRs such RIPE who then assigns them to ISPs and other large network maintainers. An ASN is made up of 16bit numbers and unique to each autonomous system.  Its also worth noting that these ASN’s are only required on external BGP networks.

BGP Internally And Externally

External BGP (eBGP) is used for autonomous systems to exchange routing information over the internet, whereas internal BGP (iBGP) is used for networks inside the organisation and is fully managed by the business.  Internal BGP is not a requirement for organisations, they can choose other routing protocols such OSPF.

As previously mentioned, external BGP can be compared with mailing a letter to friend or colleague.  It must be delivered to a post box (router), then forwarded to a depot (BGP router) which can then forward the letter to the correct geographical depot (BGP router) which in turn forwards to the collect mailbox (router). 

Unlike internal BGP, there are standards which the protocol must adhere to when using external BGP, however as soon as the letter is inside the autonomous networks, the standards are not so important and the organisations can do as they please with the data (letter).

BGP Attributes

BGP is used to find the most efficient route when sending data to another autonomous system, as previously mentioned one factor taken into consideration is the number of hops the data will have to make until it reaches the destination.

BGP uses other attributes when sending data which the routers will also use to calculate the best path, we will briefly describe each of these.

Weight

The path with the highest weight is the preferred route. This value is local to the router and it’s a Cisco proprietary attribute. The default value is 0 for routes that did not originate from the router.

Local Preference

This a preference used with an AS and is exchange between routers using iBGP. The preferred path with the highest preference is used, the default value being 100.

Originate

Prefer the path that was originated by the local router, if the local router initiated the route, then it will prefer this over a router running BGP.

AS path length

The path with the shortest AS path length is preferred, for example if there are 2 paths, AS500 and AS6000, the best path preferred would be AS500. This attribute can be manipulated by using AS path prepending.

Origin code

Prefer the lowest origin code, there are 3 which are used.

  • IGP
  • EGP
  • INCOMPLETE

IGP is a lower code than EGP and EGP is lower than INCOMPLETE, therefore the path with origin code IGP would be preferred.

MED

The MED attribute is exchanged between autonomous systems, therefore the perferred path would be with the lowest MED.

eBGP path over iBGP path

With this attribute, the preferred path would be external BGP (eBGP) over internal BGP (iBGP)

Shortest IGP path to BGP next hop

The path with the lowest IGP value would be used as the preferred path to the next BGP hop.

Oldest Path

Prefer the oldest path that the router received first.

Router ID

The router ID can be manually entered. The attribute is determined by the highest IP address, for example if you have a loopback interface, then the IP address will be used. The preferred path with the lowest router ID will be used to forward traffic.

Neighbor IP address

This is used when the BGP algorithm is unable to determine the best path based on the other attributes, this can be determined as a tie breaker situation. In this case the path with the lowest neighbor IP address will become the prefered path.

Multiple Path Selection

When BGP has multiple paths in the table, only one will be chosen as the preferred path and added to the routing table.

In case of failure, the routing table will be updated with the next preferred path in the BGP table.

You have now learned what is BGP, how critical it is to the internet and its operation. If you have any questions, please contact us.

Total
0
Shares
Leave a Reply
Previous Post
citrix logo header

ShareFile folder permissions and Sub-Folders

Next Post
citrix logo header

Can’t Connect to Desktop with an Error “Unknown client error 1110, Citrix Workspace App error 2524”