You are at:

BGP-4

Border Gateway Protocol version 4 (BGP4) is a protocol used to make routing between Internet Autonomous Systems.

An Autonomous System (AS) is a network or a network group under the same routing policy. AS can be a company network, university, internet service provider (ISP) etc. Are ASs examples, Ansp Network, USPnet, and Telefonica IP network.

Each AS is identified by a number from 1 to 64511. Numbers from 64512 to 65535 are reserved to private ASs. Here in Brasil, these numbers are distributed by LACNIC. The network formed by the interconnection of all ASs existents is the Internet itself.

Routing is a process to collect, mantain and disseminate information about available routes to arrive in each point of the network. Not to be confused with "forwarding" that is the routing of packets in the network. Between ASs, this information exchange is made by external routing protocol, or interdomain, the BGP4. The internal routing of each AS can be done in many ways, normally it uses an internal routing protocol, or intradomain like OSPF.

On the Internet, the connected equipment are identified by IP addresses. Into AS, IP addresses are grouped in CIDR (Classless Inter-domain Routing) blocks that are advertised to neighboring ASs by BGP4. From the notices received, AS routers assemble a routing table and so can refer IP packages according to their destination-addresses.

Figure 1 is an example of BGP4 session between two ASs connected directly. In this example, IP 192.0.2.0/24 network belongs to AS 64520, ie, all IP addresses from 92.0.2.0 a 192.0.2.255 track are into AS 64520 network. A BGP4 session was settled between ASs 64520 and 64530 and the routers start to exchange routing messages. There must be IP connectivity between the routers involved, because BGP4 uses TCP in transport layer, port 179.

Established BGP4 session, the AS 64520 router shall advertise the prefix 192.0.2.0/24 to AS 64530 router, ie, inform AS 64530 router that 192.0.2.0/24 network belongs to AS 64520. AS 64530 router insert this information in its routing table and shall to send to AS 64520 router all the traffic destinated to192.0.2.0/24 network.

Figure 1 – The result of announcing an IP block through BGP4 is to receive traffic.

For all other Internet routers know that the network 192.0.2.0/24 belongs to AS 64520, is necessary that BGP4 ad of AS 64520 router propagating to all other ASs. In the BGP4 message that advertise a IP block, there is an important attribute named "AS path". Initially, AS path contains only AS number where the message was generated, but each router adds its own AS to AS path to pass it to other. AS path is fundamental for BGP4 working, because its size is the metric that uses the protocol to decide between different paths to reach the same destination and also serves to avoid routing "loops".

Figure 2 - Each router adds its own AS to AS path to pass it to another.

In Figure 2, four routers with different ASs exchange messages BGP4. The message that AS 64530 router receive from AS 64520 router contains AS path "64520". In the message the ASs 64540 and 64560 routers receive from AS 64530 router, the AS path is "64530 64520", because AS 64530 router added its own AS to AS path. When AS 64540 router passes the message to AS 64560 router, it also adds its own AS and the AS path becomes "64540 64530 64520". So, AS 64560 router ends up receiving two advertisements for the prefix 192.0.2.0/24, one with AS path "64530 64520" and other with AS path "64540 65530 64520", that corresponds to the two possible paths to go from AS 64560 to AS 64520. BGP4 is a protocol type "distance vector", ie, works with a distance vector whose size is used as a metric for choosing the best path. This vector is the AS path and the chosen path, is what crosses the fewest ASs.

All the Internet ASs are directly or indirectly connected, so, each router running BGP4 protocol can receive ads from all other ASs and know the networks from each one. Nowadays, around 180 000 prefixes are announced by BGP4 on the Internet. A router that has all them in its routing table is working in "full-routing".

In the examples, ASs have only one router, but in practice often have different and not all need to work in "full-routing" or even run BGP4, only those who have connection with neighbors ASs. They are named AS "edge routers".

BGP4 is a very versatile protocol, beyond AS path, many other attributes can be carried by messages exchanged between routers, and each router can manipulate these attributes according with rules configured by AS administrators. The set of rules configurated on the routers defines the AS Routing Policy. More informations and details about BGP4 protocol can be found in references.

References