General Concepts & Architecture

1.1 Border Gateway Protocol (BGP)
BGP stands for Border Gateway Protocol. It is an open-standard routing protocol defined in RFC 4271. BGP is mainly used to exchange routing information between different Autonomous Systems (ASes). It helps routers select suitable paths to destination networks based on routing policies and BGP path attributes.
BGP is widely used by Internet Service Providers (ISPs), large enterprise networks, and organizations connected to multiple ISPs.
1.2 Autonomous System (AS)
An Autonomous System is a group of IP networks and routers managed by a single administrative authority under a common routing policy.
For example, an ISP may operate hundreds of routers across different cities. These routers can belong to the same Autonomous System if they are managed under the same routing administration.
1.3 Autonomous System Number (ASN)
An Autonomous System Number is a unique number used to identify an Autonomous System in BGP routing.
There are two ASN formats:
2-byte ASN: A 16-bit number.
4-byte ASN: A 32-bit number.
Public ASNs are assigned through Regional Internet Registries (RIRs), while private ASNs can be used in private routing environments according to the applicable rules.
1.4 Network Layer Reachability Information (NLRI)
NLRI stands for Network Layer Reachability Information. It identifies the network prefixes advertised between BGP peers.
For example, a router may advertise 192.168.10.0/24 to inform its neighbor that this network is reachable through it.
BGP uses NLRI together with path attributes to evaluate routes and select an appropriate path.
2. BGP Peering and Neighbor Types
2.1 BGP Peer / Neighbor
A BGP peer, also called a BGP neighbor, is another router with which a BGP router establishes a connection to exchange routing information.
BGP uses TCP port 179 for its peering session. Before exchanging routing updates, both routers must establish a TCP connection and successfully complete the BGP session establishment process.
2.2 External BGP (eBGP)
eBGP is a BGP connection established between routers belonging to different Autonomous Systems.
For example, a customer router in AS 65010 may establish an eBGP session with an ISP router in AS 65020.
By default, directly connected eBGP peers commonly use a TTL of 1. If the peers are not directly connected, eBGP multihop can be configured when supported.
2.3 Internal BGP (iBGP)
iBGP is a BGP connection established between routers belonging to the same Autonomous System.
For example, two routers within AS 65010 can establish an iBGP session to exchange BGP routes.
Unlike eBGP, iBGP does not normally change the AS_PATH attribute when advertising routes to another iBGP peer. A full-mesh arrangement is generally required unless techniques such as Route Reflectors or Confederations are used.
3. BGP Data Structures (Tables)
BGP routers maintain different types of information to manage neighbor sessions, evaluate routes, and select paths for packet forwarding.
3.1 Neighbor Table
The Neighbor Table contains information about configured BGP neighbors and their session status.
Administrators can use it to check whether a BGP peer is connected, which AS it belongs to, and whether the session has reached the Established state.
3.2 BGP Table (Loc-RIB)
The BGP table stores routes learned from BGP peers, along with their associated path attributes.
A router may learn multiple paths to the same destination. BGP evaluates these paths according to its best-path selection process and routing policies.
The Loc-RIB represents the routes selected by the local BGP decision process. The exact contents displayed may vary by vendor and configuration.
3.3 IP Routing Table (RIB)
The IP routing table contains routes selected for use by the router's forwarding process.
A route selected as the best BGP path is not necessarily installed in the main IP routing table. Another routing source may win the route-selection process, or the route may be ineligible for installation.
Once a route is installed and its next hop is reachable, the router can use it to forward packets toward the destination network.
4. BGP Message Types
BGP uses four main message types to establish sessions, exchange routing information, maintain connectivity, and report errors.
4.1 OPEN
The OPEN message is sent after the TCP connection is established. It initiates the BGP session and contains information such as the sender's ASN, BGP Identifier, and proposed Hold Time.
4.2 UPDATE
The UPDATE message advertises new routes, withdraws previously advertised routes, and carries path attributes associated with the advertised NLRI.
For example, when a router wants to advertise a new network prefix to its neighbor, it sends an UPDATE message.
4.3 KEEPALIVE
The KEEPALIVE message helps confirm that the BGP session is still active.
A common default KEEPALIVE interval is 60 seconds on many implementations, but the actual timer depends on the negotiated Hold Time and device configuration.
4.4 NOTIFICATION
The NOTIFICATION message is sent when a BGP protocol error or another session-ending condition is detected.
It normally terminates the BGP session. Administrators can examine the error information and device logs to identify the cause.
5. BGP Finite State Machine (FSM)
The BGP Finite State Machine describes the stages a BGP session passes through while establishing a connection with a neighbor.
There are six main states.
5.1 Idle
BGP waits for a start event and initializes the resources required to establish a session.
5.2 Connect
BGP attempts to establish a TCP connection with its neighbor and complete the TCP three-way handshake.
5.3 Active
The connection attempt has not succeeded as expected. BGP retries or waits for another opportunity to establish the TCP connection.
5.4 OpenSent
The TCP connection has been established, and the router has sent a BGP OPEN message. It waits for an acceptable response from the neighbor.
5.5 OpenConfirm
The router has received and accepted the neighbor's OPEN message. It waits for a KEEPALIVE message to confirm the session.
5.6 Established
The BGP session is operational. The peers can exchange UPDATE messages and advertise routing information.
Troubleshooting tip: If a BGP session remains in Active or repeatedly moves between Connect and Active, check IP reachability, TCP port 179, firewall policies, neighbor configuration, and ASN settings.
6. BGP Path Attributes
BGP path attributes provide additional information about routes. BGP uses these attributes, together with its selection rules and routing policies, to determine the preferred path to a destination.
There are four main attribute categories.
6.1 Well-Known Mandatory
These attributes must be recognized by all BGP implementations and must be present in applicable UPDATE messages that advertise a route.
Examples:
ORIGIN
AS_PATH
NEXT_HOP
These attributes indicate the route's origin type, the Autonomous Systems through which the route has passed, and the next hop used to reach the destination.
6.2 Well-Known Discretionary
These attributes must be recognized by all BGP implementations but are not required in every UPDATE message.
An example is LOCAL_PREF, which expresses the preference for an exit path within an AS. A higher LOCAL_PREF value is generally preferred.
6.3 Optional Transitive
These attributes are optional but can be propagated to other BGP peers even if the receiving router does not recognize them. The Partial flag may be set when required by the protocol.
Examples:
COMMUNITY
AGGREGATOR
COMMUNITY is commonly used to apply routing policies to groups of routes.
6.4 Optional Non-Transitive
These attributes are optional and are not normally propagated further when an intermediate router does not recognize them.
Examples:
MED (MULTI_EXIT_DISC)
ORIGINATOR_ID
CLUSTER_LIST
MED can suggest a preferred entry point into an AS when multiple links are available, subject to BGP comparison rules and routing policy.
7. BGP Scalability Concepts
As the number of routers and BGP peers increases, maintaining a full-mesh iBGP topology becomes more complex. BGP provides techniques to simplify configuration and improve scalability.
7.1 Route Reflector (RR)
A Route Reflector is an iBGP router that can advertise routes learned from one iBGP peer to other eligible iBGP peers, known as clients, according to route-reflection rules.
Without route reflection, iBGP routers generally require a full-mesh arrangement to exchange routes learned through iBGP.
Using a Route Reflector reduces the number of required iBGP sessions and simplifies network design.
7.2 BGP Confederation
A BGP Confederation divides a large Autonomous System into smaller internal sub-ASes for BGP operation.
The sub-ASes can use eBGP-like sessions internally while presenting the confederation as a single AS to external BGP peers, subject to the relevant configuration and protocol behavior.
This approach can reduce the complexity of large iBGP deployments.
7.3 Peer Group
A Peer Group allows a router to group BGP neighbors that share common configuration parameters.
Instead of configuring the same settings individually for each neighbor, an administrator can apply shared settings through the peer group.
This simplifies configuration management and can improve operational efficiency, particularly in networks with many BGP peers.
Discussion
No comments yet. Start the discussion.