NFWare glossary CGNAT & networking

What Is BGP (Border Gateway Protocol)?

Border Gateway Protocol

Published Dec 1, 2026← Browse all terms

BGP stands for Border Gateway Protocol. It is the routing protocol that networks use to exchange information about reachable IP prefixes and select paths according to routing policy. Its external form, eBGP, connects autonomous systems across the internet; its internal form, iBGP, distributes BGP routes within an autonomous system.

An autonomous system (AS) is a network or group of networks operated under a common routing policy. Internet service providers, cloud providers and enterprises use BGP to exchange reachability information with other networks. BGP-4 is defined in RFC 4271.

What Is BGP?

BGP is a path-vector routing protocol: a route advertisement carries path attributes, including an AS_PATH that records autonomous systems associated with the route. Routers use these attributes, together with local policy, to select routes. The AS_PATH helps prevent routing loops; it is not a map of every router or physical link a packet will cross.

BGP is classified as an exterior gateway protocol because it supports routing between autonomous systems. That classification does not exclude internal use: iBGP carries routes between BGP speakers in the same AS.

Policy control distinguishes BGP from routing based primarily on a shortest-path metric. An operator can prefer a transit provider or a peering connection for commercial or operational reasons, even when another route has a shorter AS_PATH. BGP does not measure application latency or link bandwidth automatically to make that decision.

BGP Meaning in Networking

The internet consists of separately operated networks. An autonomous system number (ASN) identifies an AS in BGP, while an IP prefix identifies a block of addresses being advertised. For example, an ISP can advertise a customer's prefix to upstream providers so that other networks learn a route toward it.

For a telecom operator, BGP governs which routes to accept, which to advertise and which upstream path to prefer. For a developer, it helps explain why an application can become unreachable even though its server is running: the route to the service's address may have changed or disappeared.

For an IPv4 broker or address holder, registration, authorization and routing are separate concerns. Acquiring a prefix does not itself make it reachable. The origin ASN, route announcements, filtering and routing authorization must also be coordinated. Our IP address guide explains how prefixes relate to individual addresses.

How Does BGP Work?

BGP speakers establish sessions, exchange route advertisements and withdrawals, and select routes to install in the routing table. The forwarding plane then uses the resulting forwarding entries to send packets; BGP does not process a new routing negotiation for each packet.

BGP peers and sessions

BGP peers communicate over TCP, with port 179 used to accept BGP connections. Operators configure or provision the peer relationships and routing policies. Some implementations also support dynamic neighbor configuration, so every individual peer does not necessarily require a manually entered configuration. For example, FRRouting documents both dynamic peers and explicit neighbors.

Suppose a provider in AS 64500 exchanges routes with a content network in AS 64510. Their border routers establish an eBGP session. Within AS 64510, iBGP sessions can distribute the learned routes to other routers. These ASNs are reserved for documentation examples, as specified in RFC 5398.

Establishing a session does not prove that every advertised prefix is legitimate. Import and export policies still determine which routes may cross the connection. RFC 8212 specifies default rejection when explicit policies are absent for eBGP sessions.

Exchanging routes: NLRI and path attributes

Network Layer Reachability Information (NLRI) describes the destinations a route can reach. BGP advertisements associate that information with path attributes such as:

  • AS_PATH: the sequence of autonomous systems recorded for the route, subject to mechanisms such as aggregation and AS-path prepending.
  • NEXT_HOP: the next-hop address used to reach the advertised destination.
  • LOCAL_PREF: a preference distributed within an AS; higher values normally favor a particular exit path. It is not normally advertised to external peers.
  • MED: a value that can suggest a preferred entry point to a neighboring AS, subject to that neighbor's policy and comparison rules.
  • ORIGIN: an attribute describing how the route entered BGP; it is separate from the origin ASN used in RPKI validation.

Peers initially exchange the routes permitted by their policies. This can be a default route, a subset of prefixes or a full internet routing table. Subsequent updates announce changes and withdraw routes that are no longer available. Multiprotocol extensions allow BGP to carry additional address families, including IPv6, as described in RFC 4760.

Best-path selection

When several eligible routes lead to the same prefix, the BGP decision process compares their attributes. Routes must first satisfy policy and next-hop reachability requirements. The exact comparison order depends on the implementation, enabled features and configuration.

Common considerations include local preference, whether a route was locally originated, AS_PATH length, ORIGIN, MED and the cost of reaching the next hop. Some implementations, including FRRouting, also provide a router-local WEIGHT attribute. MED comparisons have conditions and should not be treated as a universal ranking of all paths.

An eBGP route can be preferred over an iBGP route at a later comparison step. However, an iBGP route can win because of a higher-priority attribute such as LOCAL_PREF. An operator may also enable multipath installation for eligible equal paths. Consult the platform's selection rules rather than assuming one numbered list applies to every router; FRRouting's route selection documentation provides one implementation example.

eBGP vs iBGP

eBGP and iBGP use the same underlying protocol in different relationships. eBGP exchanges routes between autonomous systems. iBGP distributes BGP routes within one AS, including routes learned externally and routes originated locally.

PropertyeBGPiBGP
PeersRouters in different autonomous systemsRouters within the same AS
Typical purposeExchange routes with providers, peers or customersDistribute BGP routes across the operator's network
Path selectionCan win an eBGP-over-iBGP comparison after earlier attributes tieCan win when an earlier attribute gives it preference
Distribution considerationsImport and export policies define what each neighbor receivesFull-mesh sessions or mechanisms such as route reflectors distribute routes

The diagram shows BGP sessions and route exchange, rather than a physical packet path.

eBGP between autonomous systems and iBGP within an ASAS 64500 has router A. An eBGP session connects A to router B in AS 64510. An iBGP session connects B to router C in AS 64510. Lines represent bidirectional route exchange, not packet paths.AS 64500AS 64510ABCeBGPiBGPBorder routerInternal route distribution
eBGP exchanges routes between ASes; iBGP distributes BGP routes inside AS 64510.

Ordinary iBGP does not re-advertise a route learned from one iBGP peer to another iBGP peer. A full mesh addresses this restriction in small networks; route reflectors reduce the number of sessions needed in larger deployments. RFC 4456 defines route reflection.

BGP at a Glance

AttributeDetail
Full nameBorder Gateway Protocol
Base specificationBGP-4, RFC 4271
TransportTCP; listening port 179
Protocol typePath-vector exterior gateway protocol
ScopeBetween autonomous systems with eBGP; within an AS with iBGP
Address familiesIPv4 and additional families through multiprotocol extensions
Route scaleSupports internet-scale route exchange; table size varies by address family, peer and policy

BGP vs Interior Gateway Protocols: OSPF and EIGRP

Interior gateway protocols (IGPs) such as OSPF and EIGRP provide routing within an autonomous system. BGP provides policy-based route distribution between ASes and within an AS through iBGP. The protocols often work together: an IGP can provide reachability to BGP peers and next hops.

PropertyBGPOSPF / EIGRP
Main rolePolicy-based route exchange across and within AS boundariesInternal routing within an AS
ApproachPath-vectorLink-state / distance-vector with DUAL
Selection inputsPolicy and path attributesProtocol metrics and internal topology
Response to failureDepends on detection, policies, timers and propagationAlso depends on detection, topology and configuration
RelationshipCan rely on an IGP to reach next hopsCan provide the internal paths used by BGP

BGP should not simply be described as always slower than an IGP. Failure detection and convergence depend on the deployment. For a product-specific example, the NFWare vCGNAT high-availability configuration uses BGP advertisements and BFD in a routed topology.

Why BGP Matters and Its Challenges

BGP allows independently operated networks to exchange routes without sharing a single internal topology or routing policy. Operators can add transit providers, establish peering and control route advertisements while maintaining separate administration.

Incorrect advertisements can still disrupt reachability. A route hijack involves an unauthorized announcement; a route leak propagates a route beyond its intended scope. Filtering, prefix limits and explicit routing policy help constrain what a network accepts and exports.

Resource Public Key Infrastructure (RPKI) supports route origin validation: operators can check whether an origin ASN is authorized to announce a prefix of a given length. It does not validate the entire AS_PATH or prevent every route leak. A route with no covering authorization is classified as NotFound, which is distinct from Invalid. The validation model is specified in RFC 6811.

Additional mechanisms address different risks. For example, RFC 9234 defines BGP Roles and the Only to Customer attribute to help prevent and detect route leaks. No single control replaces sound import and export policies.

Benefits and Limitations of BGP

Benefits include:

  • Policy control: select routes according to business relationships and operational requirements.
  • Scalability: exchange large sets of prefixes without requiring a shared view of every internal link.
  • Interoperability: use an open protocol across different routing platforms.
  • Incremental updates: advertise route changes after the initial exchange.

Limitations include:

  • Configuration complexity: policy errors can affect both the local network and external peers.
  • Convergence dependencies: detecting a failure and propagating a replacement route takes time and depends on the design.
  • Security requirements: route authorization, filtering and session protection require separate attention.
  • Limited application awareness: selecting a BGP path does not guarantee low latency, sufficient bandwidth or application availability.

Frequently Asked Questions

What does BGP stand for?

BGP stands for Border Gateway Protocol. It exchanges IP reachability information and selects routes according to policy.

Is BGP an interior or exterior gateway protocol?

BGP is classified as an exterior gateway protocol. eBGP operates between autonomous systems, while iBGP distributes BGP routes within one AS. iBGP does not make BGP an IGP such as OSPF.

What port does BGP use?

BGP uses TCP, with port 179 as its listening port. TCP supplies reliable, ordered delivery for the BGP session.

What is the difference between eBGP and iBGP?

eBGP peers belong to different autonomous systems. iBGP peers belong to the same AS. Both exchange BGP routes, but their advertisement rules and deployment roles differ.

Why is BGP called the routing protocol of the internet?

Because it lets independently administered networks exchange routes on a global scale. Routers use the selected routes to construct the forwarding information that directs internet traffic.

Conclusion

BGP combines reachability advertisements with routing policy. eBGP connects autonomous systems, and iBGP distributes BGP routes within them. Effective operation depends on clear policies, reachable next hops, appropriate failure detection and checks on route authorization.

For related networking concepts, see IP addresses, CGNAT and network functions virtualization.

Talk to NFWare

Let’s talk about
your network.

Have a question about CGNAT or load balancing? Tell us what you’re working on.

[email protected]
CGNATLoad balancingNetwork virtualization
Contact our team

Read our Privacy Policy to learn how we handle your information.

If the form does not load, open the contact form.