Let’s Start BGP –
BGP? Border Gateway Protocol is known as Internet Routing Protocol and mostly being used for exchange IP routing details between two or more internetwork and internet via BGP enabled router. BGP protocol designed to provide loop-free routing between separate routing domains that contain independent routing policies in an autonomous systems.
BGP routing protocol wildly used over public network (Internet) as well as Private networks in order to internet connect two different AS (Autonomous systems).BGP is an open standard routing protocol which widely support multi-vendor devices.
This section covers BGP theory and conceptual concepts and will describe some the BGP features. The current version of BGP, Version 4, is defined in RFC 1771 (March 1995).
BGP is dynamic routing protocol and categories as exteriors routing protocol, the primary function of BGP is to provide and exchange network-reachability information between domains or autonomous systems.
The Internet Assigned Numbers Authority (IANA) reserved TCP Port 179 for BGP.Two BGP neighbor routers establish TCP connection and agreed to exchange routing information between them. These routers are called neighboring routers. BGP is a path-vector routing protocol; it is neither a distance-vector nor link-state routing protocol.
BGP is a key Internet protocol that allows access to the providers worldwide. BGP ensures loop free routing between autonomous systems, BGP is the standard way to exchange routes between autonomous systems.
Autonomous Systems (AS) –
Autonomous systems refer as number (16-bit ASN unique number) assigned to a network over the internet or internetworking devices as identity of one common routing domain. Autonomous systems numbered is 1 to 64511 are available by IANA/ARIN (IANA/American Registry for Internet Numbers) for global use. The 64512 to 65535 series is reserved for private and reserved purposes.
- 0 – reserved.
- 1-64.495 – public AS numbers.
- 496 – 64.511 – reserved to use in documentation.
- 512 – 65.534 – private AS numbers.
- 535 – reserved.
16 bit ASN could be exhausted in the near future. Other alternate approaches like 32-bit ASN approaches are currently being explored.
BGP must be assigned and configured with AS. BGP used to enable Routing between Autonomous Systems (inter-AS routing) is external to the AS and allows one AS to exchange routing and send traffic to another AS.
Administrative Distance (AD) –
An administrative distance is a rating of the trustworthiness of a routing information source. By default, BGP uses the administrative distances as shown below –
Distance | Default Value | Function |
External | 20 | eBGP. (External Route) |
Internal | 200 | iBGP. (Internal Route) |
BGP Type’s –
IBGP neighbors – when two neighbors are connected in the same AS.
EBGP neighbors – when two neighbors belong to different AS.
Internal BGP (iBGP) – When two or more router forming neighborship peering in the same AS router is called iBGP connection. iBGP exchange internal routing information between the routers that having same AS number. iBGP requires all the devices in same AS to form full mesh neighborship or either of Route reflectors and Confederation for prefix learning.
- iBGP is BGP used internally as a mechanism to exchange BGP information between multiple BGP border routers.
- iBGP routes have administrative distance of 200
- Routers speaking iBGP must be connected in a full mesh to prevent loops.
- If reflectors or confederations are used, the iBGP mesh may have convergence issues that can cause blackholes
- Internal peers can be anywhere in the local AS and do not have to be directly connected to one another.
- Routes received from an IBGP peer cannot be advertised to another IBGP peer but can be advertised to an EBGP peer.
EBGP neighbors (eBGP) – When two neighbors router belong to different AS and force exchange information between two different service provider and networks are called eBGP router. eBGP is used and implemented at the edge or border router that provides interconnectivity for two or more autonomous system.
- Time to Live (TTL) on BGP packets is set to one. BGP packets drop in transit if a multihop BGP session is attempted (TTL on IBGP packets is set to 255, which allows for multihop sessions).
- EBGP routes have administrative distance of 20
- Routes received from an EBGP peer can be advertised to EBGP and IBGP peers.
- The advertising router modifies the BGP next-hop to the IP address sourcing the BGP connection.
- The advertising router prepends its ASN to the existing AS_PATH.
- The receiving router verifies that the AS_PATH does not contain an ASN that matches the local routers. BGP discards the NLRI if it fails the AS_PATH loop prevention check.
BGP uses the same concept: If a BGP session is established between two neighbors in different autonomous systems, the session is external BGP (EBGP), and if the session is established between two neighbors in the same AS, the session is internal BGP.
BGP Attributes –
BGP Attributes are pieces of information that help in determining the paths to a remote network and further may be used to discover the best route to destination from multiple paths available. There are four basic types of attributes:
Well known BGP attribute types:
- Well known mandatory attributes – Well-known attributes must be recognized by all BGP implementations. Well-known mandatory attributes must be included with every prefix updates.
Attributes – ORIGIN,AS_PATH and NEXT_HOP
- Well known discretionary attributes – well-known discretionary attributes may or may not be included with the every prefix updates of BGP to all neighbors.
Attributes – LOCAL_PREF,ATOMIC_AGGREGATE
Optional BGP attribute types:
- Optional transitive attributes – Optional attributes do not have to be recognized by all BGP implementations. Optional attributes can be set so that they are transitiveand stay with the route advertisement from AS to AS
Attributes – AGGREGATOR , COMMUNITY
- Optional non-transitive attributes – non-transitive attributes are optional as the name implies and will not be passed to other neighbors.
Attributes – MULTI_EXIT_DISC (MED)
BGP Routing Table –
The BGP routing table is a map of the internet and networks. The routing table consist the entire internet transit routing information kept in routing tables. Router use routing table information in order to transfer the ip packet next hop by selecting best route.
BGP Routing Information Base consists of three parts as explained below –
Adj-RIBs-In (BGP Neighbor Table) – This BGP information refers to routing prefix received from neighbor without applying any filtering or attribute manipulation. This table consist information about BGP neighbors.
Loc-RIB (BGP Table) – Contains the network layer reachability information (NLRI) learned in compliance with BGP and NLRI attributes (path attribute, PA) corresponding to these path. Essentially, NLRI is a prefix and its length. BGP table contains all the routes from all the neighbors, several routes to the same network with different attributes.
Adj-RIBs-Out (BGP Routing Table) – The BGP IP routing tables that contains only the best routes from BGP Table. After BGP has selected the best path to a network, that path is added to the main IP routing table.
BGP Neighbor States –
BGP create a TCP session with neighbor routers called peers. BGP routers user unicast-based communication in order to establish neighbor adjacency on TCP port 179 and BGP configuration need to done manually by Network administrator.
The following states are execute BGP systems to become neighbors. Hence, these states are execute in series of stages before it reaches the Established state.
IDLE State – This is the first stage where BGP forming a router adjacency. As BGP router detects an initials connection event and initiate a TCP connection to other BGP peer and also listen a new connection from remote peer, and changes its state to Connect.
If a BGP speaker detects an error, it shuts down the connection and changes its state to Idle.
Connect State – This is second state where BGP initiates the TCP connection with peer BGP router. If the transport protocol connection succeeds, the local system clears the ConnectRetry timer, completes initialization, sends an OPEN message to its peer, and changes its state to OpenSent.
If the transport protocol connect fails due to the local system restarts the ConnectRetry timer, continues to listen for a connection that may be initiated by the remote BGP peer, and changes its state to Active state.
Active State – This state where BGP is trying to obtain a peer connection by initiating a transport protocol connection. If the transport protocol connection succeeds, the local system clears the ConnectRetry timer, completes initialization, and sends an OPEN message to its peer.
OpentSent State – This state where BGP peer waits for an OPEN message from its peer. When an OPEN message is received, all fields are checked for exactness If there are no errors in the OPEN message, BGP sends a KEEPALIVE message and sets a Keep Alive timer. Finally, the state is changed to OpenConfirm State.
If the BGP message header checking or OPEN message checking detects an error the local system sends a NOTIFICATION message and changes its state to Idle.
If a disconnect notification is received as from transport layer, the local BGP router closes the BGP connection and goes into the Active state.
OpenConfirm State – This state where BGP peer waits for a KEEPALIVE or NOTIFICATION message. If the local system receives a KEEPALIVE message, it changes its state to Established.
If the Hold Timer expires before a KEEPALIVE message or disconnect notification is received from the transport layer protocol, it changes its state to Idle.
Established State – This state where BGP can exchange UPDATE, NOTIFICATION, and KEEPALIVE messages with its peer.
If the Hold Timer expires, the local system sends a NOTIFICATION message with Error Code Hold Timer Expired and changes its state to Idle.
BGP Knowledgebase –
- BGP currently running on version 4, based on RFC427.
- BGP use TCP port 179 (Application layer protocol) for established peer connection.
- BGP is unicast communication based protocol.
- BGP is an exterior gateway protocol (EGP).
- BGP speaker – a router that runs BGP protocol.
- Neighbors, peers – any two routers between which a TCP connection for exchanging routing information is open.
- BGP is a path vector routing protocol suited for strategic routing policies.
- BGP user routing-decision based on attributes algorithm.
- BGP is open standard routing protocol supporting multivendor devices.
- BGP use AS numbers as AS_PATH for selecting loop free path toward destination. In case a BGP specking router detects its own AS in AS PATH attribute update, it assumes a loop and discards the route. This is how BGP a built a loop prevention topology.
- BGP maintain three routing table – BGP Neighbor Table, BGP Table and Routing Table.
- Transit autonomous AS – Autonomous system, through which traffic is sent to other autonomous systems
- BGP Keepalive Interval by default is set to 60 seconds.
- BGP Hold Time by default is set to 180 seconds.
- BGP use six Peering states with BGP neighbors for established peer connection.
- BGP set peer configuration manually by administrator.
- BGP are two types –eBGP and iBGP
- BGP AD (Administrative Distance) is 20 for eBGP and 200 for iBGP
- EBGP – the protocol used to exchange routing information within an autonomous system.
- IBGP – the protocol used to transfer exchange information between autonomous systems.
- EBGP Route – Routes received from an EBGP peer can be advertised to EBGP and IBGP peers.
- IBGP Route – Prevent routing loops, iBGP cannot learn iBGP learned prefixes from another iBGP speaker because its own AS will be in the AS_PATH.
Great Article
Also, please Amend the following in the article as they should be the other way around (IBGP – within an AS and EBGP B/w the AS)
EBGP – the protocol used to exchange routing information within an autonomous system.
IBGP – the protocol used to transfer exchange information between autonomous systems