Addressing and routingIntermediate39 min read

What Is BGP in Networking?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security
On This Page

Quick Definition

BGP is a system that routers use to share information about how to reach different networks on the internet. It helps data find the most efficient path from one network to another, even when those networks are owned by different companies. Think of it like a global postal service that decides the best route for your package based on traffic, distance, and rules set by each post office.

Common Commands & Configuration

router bgp 65001

Enters BGP configuration mode for autonomous system 65001. This is the first command to configure BGP on a router.

The exam tests that the AS number must match what is assigned to your organization. Private AS numbers (64512-65535) are often used in labs.

neighbor 10.0.0.1 remote-as 65002

Configures a BGP neighbor at IP 10.0.0.1 in AS 65002. This establishes an eBGP session.

Common exam question: what is the purpose of the remote-as command? It specifies the AS of the neighbor. Mismatch causes session to stay in OpenSent.

network 192.168.1.0 mask 255.255.255.0

Advertises the 192.168.1.0/24 network into BGP. The network must be in the routing table.

The exam often tests that BGP does not automatically advertise directly connected networks. You must explicitly use the network command or redistribute.

neighbor 10.0.0.1 route-reflector-client

Designates neighbor 10.0.0.1 as a route reflector client. Used to reduce iBGP sessions.

Know that route reflectors are a key iBGP scaling technique. The exam may ask about the effect of this command: it allows the neighbor to receive reflected routes.

neighbor 10.0.0.1 weight 200

Sets the weight for routes received from this neighbor to 200. Weight is Cisco proprietary and local to the router.

The exam tests that weight is the first criterion in BGP path selection. A higher weight means a more preferred path.

show ip bgp

Displays the BGP routing table, including prefixes, next hops, and path attributes.

Used in troubleshooting to verify if routes are learned. The exam may ask about the meaning of the '>' symbol which indicates the best path.

clear ip bgp *

Resets all BGP sessions. This is a disruptive command but useful for resetting state or after configuration changes.

The exam cautions that this can cause temporary routing outages. It is more controlled to reset specific neighbors with 'clear ip bgp 10.0.0.1'.

neighbor 10.0.0.1 ebgp-multihop 2

Allows an eBGP neighbor to connect via multiple hops (TTL=2). Useful for loopback interfaces.

The exam tests that eBGP peers are typically directly connected. Use ebgp-multihop when they are multiple hops away, and also update-source to use loopback.

BGP appears directly in 849exam-style practice questions in Courseiva's question bank — one of the most-tested concepts on CompTIA Network+. Practise them →

Must Know for Exams

BGP is a topic covered in the CompTIA Network+ exam, but at a relatively high level. The network+ exam objectives expect candidates to understand the purpose of BGP, its basic characteristics, and where it is used. Specifically, under domain 2.1 (Explain the characteristics of routing technologies), candidates must be able to distinguish between routing protocols. BGP is listed as an exterior gateway protocol (EGP) and a path vector protocol. Candidates should know that BGP uses AS path as its metric, that it uses TCP port 179, and that it is slower to converge than OSPF.

In the Network+ exam, BGP questions are usually multiple-choice and scenario-based. A typical question might ask: “Which routing protocol would you use to connect two different autonomous systems?” with the correct answer being BGP. Another question might ask about the purpose of AS numbers in BGP or the transport protocol BGP uses. There may also be questions about the administrative distance of BGP compared to other protocols.

While the Network+ exam does not explore BGP configuration, it does expect candidates to understand that BGP is used at the edge of networks, between ISPs, and that it is not typically used within a small office LAN. Understanding the difference between interior gateway protocols (IGPs like OSPF, RIP, EIGRP) and exterior gateway protocols (EGPs like BGP) is essential.

For more advanced certifications like the Cisco CCNA, BGP is covered in more depth, including configuration and troubleshooting. But for Network+, the focus is on foundational knowledge. Candidates should memorize the key facts: BGP is a path vector protocol, runs on TCP port 179, uses AS path length for loop prevention and path selection, and is classified as an EGP.

In exam questions, BGP often appears in the context of network types (such as WAN or internet connectivity). It may also appear in questions about routing metric types, where the correct answer is “AS path length.” Additionally, candidates should be aware that BGP is slower than some other protocols because it relies on TCP and can hold a large routing table (the global BGP table has over 900,000 routes as of 2025).

Focus on memorizing the acronym, the port number, the metric, the category (path vector), and the typical use case (between autonomous systems). If you can recall these five points, you will be prepared for the BGP questions on the Network+ exam.

Simple Meaning

Imagine you need to mail a letter from New York to a friend in Tokyo. You drop it in a mailbox, and the postal service handles the rest. But the postal service doesn’t just pick one route and stick with it forever. It has to consider many things: which roads are clear, how much mail is being processed at each sorting center, whether certain countries have agreements to accept mail from each other, and even whether some routes are temporarily closed due to weather. The postal service uses a giant map of all the post offices and their connections, and it continuously updates that map as conditions change.

BGP does the same thing for the internet. The internet is not one giant network. It is a collection of thousands of smaller networks called Autonomous Systems (AS). Each AS is like a separate postal service, and BGP is the system that allows these different postal services to talk to each other and coordinate the delivery of data. When you type a website address into your browser, your request travels across many different networks before reaching the server that hosts the site. BGP is the protocol that tells each router along the way which direction to send your data next.

BGP does not just look for the shortest path in terms of distance or hops. Instead, it uses policies that network administrators configure. For example, a company might have a rule that says “use this connection for all traffic to Asia unless it fails, then use this other one.” BGP is designed to respect those business rules. It is often described as a routing protocol that concerns itself with reachability and policy, not just speed. That is why it is called a path vector protocol, it keeps track of the path that data takes through different AS numbers so it can check for loops and apply policies at each step.

In the real world, BGP makes the internet work even when parts of it break. If a cable is cut under the ocean, BGP quickly recalculates routes around the damage. If a network goes down, BGP withdraws those routes and finds alternatives. It is the reason you can still watch videos or send emails even when a major internet provider has an outage. Without BGP, the internet would be a collection of isolated networks that could not communicate with each other.

For IT learners, understanding BGP means understanding how the internet actually functions at a structural level. It is not about how data is packaged (that is TCP/IP) or how devices find each other on a local network (that is ARP). It is about how separate organizations trust each other enough to pass traffic, how redundancy is built into the global network, and how network engineers manage complexity through policy. BGP is often called “the glue that holds the internet together.” That is a good way to remember its role.

Full Technical Definition

BGP (Border Gateway Protocol) is a standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the internet. It is classified as a path vector protocol, which means it maintains the path of AS numbers that a route has traversed, allowing it to detect and prevent routing loops. BGP version 4 (BGP-4) is the current standard, defined in RFC 4271, and it supports Classless Inter-Domain Routing (CIDR) and route aggregation.

BGP operates on top of TCP, using port 179. This makes BGP a reliable protocol because TCP handles retransmission and flow control. When two BGP routers establish a connection, they complete a three-step process: first, they form a TCP connection on port 179; second, they exchange BGP open messages to negotiate capabilities and set hold timers; third, they exchange update messages containing routing information. Keepalive messages are sent periodically (usually every 30 seconds if no update is sent) to maintain the session. Notification messages are sent when errors occur.

BGP routers can be configured as either internal BGP (iBGP) or external BGP (eBGP). eBGP is used between routers in different autonomous systems, such as when an internet service provider (ISP) connects to another ISP. iBGP is used within the same autonomous system to distribute routes learned from eBGP to all routers inside that AS. In iBGP, all routers in the AS must be fully meshed (each router peers with every other iBGP router) or use route reflectors to reduce the number of peerings. The BGP split horizon rule states that a route learned via iBGP cannot be advertised to another iBGP peer, which is why full mesh or route reflectors are necessary.

BGP uses several path attributes to determine the best path to a destination. The most important attributes, in order of preference when selecting a path, are: Weight (Cisco proprietary, highest weight wins), Local Preference (highest value wins, used within an AS), Locally Originated routes (routes that the router itself injects), AS Path length (shortest path wins), Origin code (IGP is preferred over EGP, which is preferred over Incomplete), Multi-Exit Discriminator (MED, lowest value wins), Paths (eBGP over iBGP if the next-hop is the same), and IGP metric to the next-hop (lowest metric wins). The tie-breaking continues until only one route remains, or the route with the lowest neighbor address is chosen.

BGP tables are stored in three separate tables within a router: the BGP table (also called the BGP RIB, Routing Information Base), which contains all routes learned from BGP peers; the BGP table is used to select the best path; the best path is installed into the IP routing table (the global RIB) if it is the best route for that destination among all routing protocols. This means BGP can control routing policy in a way that OSPF or EIGRP cannot, because BGP can hold multiple routes for the same prefix and only install the best one.

In real IT implementations, BGP is used primarily at the network edge, on routers that connect to other networks. Large enterprises with multiple internet connections often use BGP to advertise their public IP address blocks and to receive the full internet routing table. ISPs use BGP to exchange routes with their customers, their peers, and their upstream providers. BGP peering can be either transit (one AS pays another to carry traffic) or peering (two ASes exchange traffic without payment). Route filtering and prefix lists are commonly used to control what routes are advertised and accepted.

Security is a major concern in BGP. Without proper configuration, BGP can be vulnerable to route hijacking, where a malicious AS advertises a prefix it does not own, redirecting traffic. Resource Public Key Infrastructure (RPKI) and BGP Flowspec are used to add cryptographic validation. BGP also supports MD5 authentication between peers to prevent spoofed TCP resets.

For the Network+ exam, candidates need to understand BGP’s basic characteristics: it is a path vector protocol, it uses TCP port 179, it is used between autonomous systems, its primary metric is the AS path length, and it is slower to converge than interior gateway protocols like OSPF. BGP is considered a distance vector protocol by some because it relies on hop count (AS path) though it is more correctly called a path vector protocol.

Real-Life Example

Think about the global airline system. Every airport is like a router. Airlines are like autonomous systems. When you want to fly from a small city to a remote island, you don’t have a direct flight. Instead, you fly from your city to a major hub, then to another hub, then to a regional airport, and finally to the island. The airline industry does this because it is more efficient to route passengers through hubs than to have direct flights between every pair of cities.

BGP works similarly. When you send data from a computer in New York to a server in Australia, your data does not travel through a single direct cable. Instead, it hops through multiple networks. Each network (each autonomous system) acts like an airline. At each hop (each router), a decision is made about which “airline” (which next AS) should carry the data next. That decision is based on BGP’s path selection process.

In the airline analogy, the BGP table is like the global flight schedule that each airport keeps. When a new route opens, the schedule is updated. When a flight is canceled due to weather, that cancellation is announced, and airports update their schedules. BGP does the same thing when a network link goes down. A BGP withdrawal message is sent out, and routers recalculate their best path.

Now imagine that some airlines have special agreements. One airline might offer a cheaper fare if you fly through its hub. Another airline might have a code-share agreement with a partner. BGP works the same way with routing policies. A network administrator can configure BGP to prefer a certain path because it is cheaper (maybe it is a peering relationship where no money is exchanged) or because it is more reliable (maybe it is a fiber path versus a satellite link).

Finally, think about how airlines avoid loops. If you try to book a flight from New York to London that goes New York – Chicago – New York – London, you would realize that it makes no sense because you are going back to where you started. BGP prevents loops by keeping a list of AS numbers in the AS path attribute. If a router sees its own AS number in the path, it knows the route is a loop and discards it. This is exactly like an airline that checks if you have already been through an airport and won’t send you back there.

So, BGP is the global coordination system that prevents chaos on the internet, just as airline schedules and ticketing systems prevent chaos in air travel.

Why This Term Matters

BGP matters because it is the protocol that makes the internet possible as a single, coordinated global network. Without BGP, each ISP would only be able to route traffic within its own network, and there would be no way for a user on one network to reach a server on another. The internet would fragment into a collection of disconnected islands. BGP provides the mechanism for different organizations to exchange routing information in a controlled, policy-driven way.

For IT professionals, BGP is critical because it is the protocol that ensures redundancy and resilience. When a primary internet link fails, BGP automatically reroutes traffic through backup connections. This is essential for business continuity. Companies that rely on cloud applications, remote workers, or e-commerce need BGP to maintain connectivity even when parts of the network fail.

BGP also affects performance and cost. By choosing the best path based on policies, network engineers can control which links carry traffic, reducing latency for critical applications, and minimizing bandwidth costs by using settlement-free peering relationships. Understanding BGP allows an IT professional to troubleshoot slow internet connections, diagnose routing issues, and explain why a website might be unreachable from certain locations.

BGP has security implications. Route hijacking, where a malicious actor advertises a route they do not own, can redirect traffic and enable interception or denial of service. IT professionals who understand BGP are better equipped to implement security measures like BGP prefix filtering, RPKI, and route authorization.

Finally, BGP matters because it is a foundational concept for many advanced networking topics, including MPLS, SD-WAN, and cloud networking. Professionals working with AWS Direct Connect, Azure ExpressRoute, or Google Cloud Interconnect will encounter BGP directly. It is not just an exam topic; it is a real-world skill.

How It Appears in Exam Questions

In the Network+ exam, BGP questions tend to be straightforward and factual, but they can also be scenario-based. A common pattern is to present a networking scenario and ask which protocol should be used. For example, “A company connects to two different internet service providers. Which routing protocol should be used to exchange routes between the company’s routers and the ISP routers?” The correct answer is BGP.

Another common question type asks about protocol characteristics. “Which of the following routing protocols uses AS path as its metric?” The answer is BGP. “Which port does BGP use to establish TCP connections?” The answer is 179.

Troubleshooting scenarios may appear, but they are less common in Network+ than in CCNA. For instance, “A network administrator notices that routers in different autonomous systems are not exchanging routing information. The routers are configured with OSPF. What is the likely issue?” The answer involves understanding that OSPF is an interior gateway protocol and cannot route between different autonomous systems; BGP is needed.

Another pattern involves comparing routing protocols. “Which of the following is an exterior gateway protocol?” Options might include OSPF, EIGRP, BGP, and RIP. The correct answer is BGP. “Which of the following uses TCP for transport?” Again, BGP.

Some questions test understanding of BGP’s stability. “Why is BGP considered slower to converge than OSPF?” The answer is because BGP uses TCP and maintains a large number of routes, requiring more processing and time.

Occasionally, there might be a question about BGP path attributes, but only at a high level. “Which BGP attribute is used to choose the shortest path?” The answer is AS path length.

For scenario-based questions, the best approach is to identify where the routers are located. If they are within the same organization and only need to route internal traffic, choose an IGP like OSPF. If they are connecting to a different organization or ISP, choose BGP. Remember that BGP is for inter-AS routing, and that it is policy-driven, not just metric-driven.

Finally, watch out for distractor answers. Some questions might try to confuse BGP with RIP because both use hop count, but BGP uses AS path length, not hop count. Another distractor is confusing BGP with OSPF because both support CIDR, but OSPF is an IGP and BGP is an EGP.

Practise BGP Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

Your company, ABC Corp, has two internet connections: one from ISP A and one from ISP B. Your company owns a block of public IP addresses: 203.0.113.0/24. You want to make sure that if ISP A goes down, traffic can still reach your servers through ISP B. You also want to balance traffic so that users in Asia use ISP A and users in Europe use ISP B.

To achieve this, you would configure BGP on your edge routers. You would establish two BGP sessions: one to ISP A’s router and one to ISP B’s router. Your router would advertise your IP block to both ISPs. The ISPs, in turn, would advertise that route to the rest of the internet. When users in Asia request your website, the internet routers will see two paths to your network: one through ISP A and one through ISP B. BGP path selection on the user’s ISP will determine which path is used, but you can influence that by setting BGP attributes on your advertisements. For example, you could set a higher local preference on the route advertised to ISP A for traffic from Asia, making that path preferred.

If ISP A fails, the BGP session between your router and ISP A’s router goes down. Your router will withdraw the route from ISP A. The rest of the internet will then use ISP B as the only path. This failover happens automatically, though it can take several seconds to minutes depending on BGP timers and convergence.

This scenario demonstrates why BGP is important for multi-homed networks. Without BGP, you would need to manually switch traffic to a backup connection, and users would experience downtime. BGP automates this process and gives you granular control over traffic flows.

Common Mistakes

Thinking BGP is a distance vector protocol like RIP.

BGP is a path vector protocol, not a distance vector protocol. While both use a form of hop count, distance vector protocols like RIP use the number of routers (hops) between source and destination. BGP uses the list of autonomous systems (AS path), which is different and provides loop prevention at the AS level.

Memorize that BGP is a path vector protocol. Remember that “path” refers to the AS path attribute, which is a sequence of AS numbers.

Confusing BGP’s port number with other protocols, e.g., saying BGP uses UDP port 179.

BGP uses TCP port 179 for reliable transport. TCP ensures that routing updates are delivered and acknowledged. UDP does not provide this reliability.

Remember port 179 for BGP. Associate “BGP” with “Big TCP Port” or just memorize the number. Review a list of common protocol port numbers regularly.

Assuming BGP is used inside a small office or home network.

BGP is designed for large-scale routing between autonomous systems, such as ISPs and large enterprises. Small office networks use dynamic routing protocols like OSPF or static routes. BGP is overkill and adds unnecessary complexity.

When you see a question about a small LAN or a small office, eliminate BGP immediately. BGP is for connecting to the outside world, not for internal routing.

Thinking BGP converges as fast as OSPF or EIGRP.

BGP converges more slowly because it relies on TCP, maintains a large routing table, and uses timers (like the hold timer, default 90 seconds) to detect failures. OSPF and EIGRP are interior protocols designed for fast convergence in smaller domains.

Know that BGP is slower but more scalable for the internet. If a question asks which protocol has the fastest convergence, do not choose BGP.

Believing BGP uses hop count (number of routers) as its metric.

BGP uses AS path length, which counts the number of autonomous systems a route traverses. This is different from hop count. For example, a route that goes through three ASes has an AS path length of 3, even if it passes through ten routers inside each AS.

When you think of BGP’s metric, think “AS path length” not “hop count.” Use the mnemonic “BGP: Big AS Path.”

Thinking BGP routes are always preferred over OSPF or static routes.

Administrative distance (AD) determines which route is installed in the routing table when multiple protocols know about the same destination. BGP’s AD is 20 for eBGP and 200 for iBGP on Cisco devices. A static route (AD 1) or an OSPF route (AD 110) would be chosen over iBGP if both are available.

Remember that administrative distance matters. eBGP (AD 20) is preferred over most IGPs, but iBGP (AD 200) is the least preferred of the common protocols. Check the AD values for the Network+ exam.

Exam Trap — Don't Get Fooled

{"trap":"A question says “Which routing protocol uses the shortest path first algorithm?” and lists BGP as an option. Learners see “path” in BGP and choose it incorrectly.","why_learners_choose_it":"Because BGP is the only protocol among the options that has the word “path” in its description (path vector), learners incorrectly associate it with the shortest path first algorithm, which belongs to OSPF."

,"how_to_avoid_it":"Know that BGP is a path vector protocol and does not use the Dijkstra SPF algorithm. OSPF uses SPF. BGP uses a decision process based on policies and path attributes, not the SPF algorithm.

When you see “shortest path first,” immediately think OSPF, not BGP."

Commonly Confused With

BGPvsOSPF

BGP is an exterior gateway protocol (EGP) used between different autonomous systems, while OSPF is an interior gateway protocol (IGP) used within the same autonomous system. BGP uses AS path as its metric and is a path vector protocol; OSPF uses cost and is a link-state protocol. OSPF converges much faster than BGP.

You would use OSPF to route traffic between different departments in your company building. You would use BGP to route traffic between your company and your internet service provider.

BGPvsRIP

Both BGP and RIP use a form of hop count, but RIP counts the number of routers (max 15 hops), while BGP counts the number of autonomous systems (AS path length). RIP is a distance vector protocol; BGP is a path vector protocol. RIP is used in small networks; BGP is used on the global internet.

RIP is like a local delivery driver who knows each street. BGP is like the global shipping company that tracks routes between countries.

BGPvsEIGRP

EIGRP is Cisco proprietary and is an interior gateway protocol. It uses composite metrics (bandwidth, delay, load, reliability) and is a hybrid protocol (distance vector and link-state). BGP is an open standard and is an exterior gateway protocol that uses AS path.

If your company uses only Cisco routers and needs fast convergence inside the network, you might use EIGRP. If you need to connect to a different company’s network, you would use BGP.

BGPvsBabel

Babel is a distance-vector routing protocol designed for wireless and mesh networks. It is less common than BGP and is not used for global internet routing. Babel uses expected transmission count (ETX) as its metric, while BGP uses AS path length.

Babel is like a local Wi-Fi mesh network in a neighborhood; BGP is like the worldwide telephone network.

BGPvsIS-IS

IS-IS is an interior gateway protocol that is often used by large ISPs within their own network. It is a link-state protocol like OSPF. BGP is the exterior protocol used between different ISPs. IS-IS uses CLNS addressing; BGP uses IP.

IS-IS is what the ISP uses to route traffic inside its own infrastructure. BGP is what the ISP uses to connect with other ISPs and the rest of the internet.

Step-by-Step Breakdown

1

TCP Connection Establishment

Two BGP routers first establish a TCP connection on port 179. This ensures reliable communication because TCP handles retransmission if packets are lost. Without this step, BGP cannot exchange routing information.

2

BGP Open Message Exchange

After the TCP connection is established, each router sends an OPEN message containing its BGP version, its AS number, a hold time, and a BGP ID (usually the highest IP address on the router). Both routers must agree on the BGP version; if they do not, the session will fail. The hold time is the maximum time a router will wait for a keepalive or update before declaring the peer down.

3

BGP Keepalive Exchange

Once OPEN messages are exchanged and accepted, the routers send KEEPALIVE messages to confirm the session is up. Keepalives are sent periodically (usually every one-third of the hold time) to maintain the session. If no keepalive is received within the hold time, the session is torn down.

4

Initial Route Exchange

The two routers exchange their entire BGP routing tables using UPDATE messages. This is the bulk transfer of all known routes. In the early days of the internet, this could take a long time. Today, with route optimization, it is still significant.

5

Incremental Updates

After the initial exchange, BGP only sends incremental updates. When a route changes, the router sends an UPDATE message with the new attributes or a WITHDRAW message for routes that are no longer available. This keeps bandwidth usage low after the initial sync.

6

Path Selection Process

When a router receives multiple routes to the same destination prefix from different peers, it runs the BGP best path selection algorithm. It evaluates path attributes in order: highest weight, highest local preference, locally originated routes, shortest AS path, lowest origin code, lowest MED, eBGP over iBGP, lowest IGP metric to next-hop, and finally lowest neighbor IP address. This is why BGP is policy-driven: administrators can set these attributes to influence path selection.

7

Route Installation in Routing Table

After the best path is selected, BGP checks whether that route has the lowest administrative distance among all routing protocols that know the same prefix. If it does, the route is installed into the IP routing table. If another protocol (like OSPF) provides a route with a lower AD, BGP’s route may not be used, even if it is the best BGP path.

8

Route Advertisement to Other Peers

The router then advertises the best path (if allowed by policy) to its other BGP peers. For eBGP, routes are advertised with the next-hop set to the router’s own IP. For iBGP, the next-hop is usually left unchanged. The route advertisement includes the AS path with the router’s own AS number prepended, which helps prevent loops.

9

Continuous Monitoring and Convergence

BGP continuously monitors the state of its peers and the routes. If a peer fails (no keepalive), the router removes all routes learned from that peer, recalculates the best paths, and sends updates to other peers. This convergence process is relatively slow compared to IGPs, but it is designed for stability over speed.

Practical Mini-Lesson

In practice, configuring BGP is not something you do every day unless you work at an ISP or a large enterprise with multiple internet connections. But understanding the concepts is crucial for network troubleshooting and design.

When you configure BGP on a router, you start by entering global configuration mode and creating a BGP process with the command “router bgp [AS number]”. Then you specify which networks you want to advertise, using the “network” command with a mask. You also define BGP neighbors (peers) with the “neighbor [IP address] remote-as [AS number]” command. For example, if your router’s AS is 65001 and you are connecting to an ISP with AS 64500 at IP 10.0.0.1, the command would be “neighbor 10.0.0.1 remote-as 64500”.

One of the most important practical concepts is that BGP does not automatically advertise all routes; you must explicitly tell it which networks to advertise. If you forget to include the “network” statement, your router will not advertise any local prefixes, and no traffic will reach your servers from the internet. Also, you can use redistribution, but that is more advanced.

In real-world BGP operation, you will deal with route filtering. You do not want to accept all routes from your ISP; you may only want a default route or a partial routing table. You can use distribute-lists, prefix-lists, and route-maps to filter incoming and outgoing routes. For example, a route-map can set the local preference on routes from a specific peer to make them preferred.

What can go wrong? BGP sessions can flap (go up and down repeatedly) due to misconfiguration, mismatched AS numbers, or bad network design. A flapping session can cause instability across the internet because each time it goes up, routes are announced, and each time it goes down, they are withdrawn. Network operators use tools like BGP dampening to penalize flapping routes and suppress them temporarily.

Another common issue is BGP convergence delays. If you change a route, it can take minutes for the change to propagate through the internet. This is why BGP is not suitable for networks that require rapid failover within seconds. For that, you might use BGP fast external failover or adjust timers, but with caution.

For IT professionals working in cloud environments, BGP is used in Direct Connect and VPN connections. For example, AWS requires you to establish a BGP session with their virtual private gateway. The BGP session carries routes for your VPC and on-premises networks. If the BGP session goes down, the VPN may fail over, so understanding BGP keepalives and timers is essential.

Finally, remember that BGP is not a plug-and-play protocol. It requires careful planning, especially when you are dealing with the full internet routing table. Each BGP session consumes memory and CPU. A router running BGP with full internet routes needs a large amount of RAM (at least 8 GB for a small provider). So part of practical BGP knowledge is knowing how to scale by using route summarization and BGP communities.

For the Network+ exam, you do not need to know configuration commands, but you should be familiar with these real-world implications. It will help you answer scenario questions that ask about BGP’s strengths and weaknesses.

BGP as a Path Vector Protocol

BGP, or Border Gateway Protocol, is the routing protocol that powers the global internet. Unlike interior gateway protocols such as OSPF or EIGRP which use link-state or distance-vector algorithms, BGP is a path vector protocol. This fundamental difference means BGP does not simply exchange shortest path metrics.

Instead, it propagates routing information by advertising entire paths to a destination, expressed as sequences of autonomous system numbers. This design is critical for the internet because it allows policy-based routing rather than pure shortest-path routing. In the context of the Network+ exam, understanding that BGP is a path vector protocol helps you distinguish it from OSPF (link-state) and RIP (distance-vector).

BGP's path vector approach prevents routing loops by including the AS path in each update. A router receiving a BGP update will check if its own AS is already in the path list; if so, it discards the update to avoid creating a loop. This is a key concept tested on the Network+ exam, where you may be asked to identify which protocol uses AS path information for loop prevention.

BGP uses a variety of attributes, such as local preference, multi-exit discriminator, and weight, to select the best path. These attributes are not present in IGPs. When preparing for the exam, remember that BGP's main role is routing between autonomous systems, while IGPs handle routing within them.

BGP's path vector design makes it highly scalable and policy-rich, but also more complex to configure. You will often see BGP used by internet service providers and large enterprises with multiple connections to the internet. The Network+ exam may ask why BGP is preferred over OSPF for inter-AS routing, and the answer lies in its ability to enforce administrative policies via attributes like the AS path.

BGP's path vector nature is its defining characteristic, enabling it to manage the global routing table with thousands of prefixes while maintaining loop-free operation through AS path checking. This is a cornerstone concept for any networking certification, including Network+.

BGP Neighbor States and Session Establishment

BGP forms neighbor relationships through a structured state machine that progresses through several states: Idle, Connect, Active, OpenSent, OpenConfirm, and Established. Understanding this state machine is essential for troubleshooting BGP sessions and is a frequent topic on the Network+ exam. The process begins in the Idle state, where BGP waits for a start event, typically a router configuration command.

When started, BGP moves to the Connect state and attempts to establish a TCP connection to the neighbor on port 179. If the TCP handshake fails, the router moves to the Active state. In the Active state, the router actively listens for incoming connections while continuing to retry outgoing connections.

This toggling between Connect and Active often indicates connectivity issues, such as incorrect IP addresses, ACLs blocking TCP 179, or MTU mismatches. Once TCP is established, BGP sends an Open message and enters the OpenSent state. The Open message contains parameters like the BGP version, AS number, hold time, and router ID.

If the parameters are acceptable, the neighbor responds with a Keepalive message, and the state transitions to OpenConfirm. Finally, upon receiving a Keepalive in OpenConfirm, BGP moves to the Established state. In Established, BGP can exchange Network Layer Reachability Information (NLRI) and updates using UPDATE messages.

The Network+ exam often tests your ability to identify which state a BGP session is in given a scenario. For example, if a neighbor is flapping between Active and Connect, it suggests a layer 3 connectivity problem. If it stays in OpenSent, it might indicate an AS number mismatch.

Keepalive messages are sent every 60 seconds by default, and the hold time is typically 180 seconds. If no Keepalive is received within the hold time, the session drops back to Idle. This state machine is also where you see the importance of the BGP router ID, which is usually derived from the highest loopback IP or manually configured.

A duplicate router ID can cause persistent session resets. Memorize the key transitions: Idle to Connect (TCP start), Connect to OpenSent (TCP established), OpenSent to OpenConfirm (parameters agreed), OpenConfirm to Established (keepalive received). Common exam questions involve troubleshooting a session stuck in Active, often due to a missing route to the neighbor or a firewall blocking BGP traffic.

By mastering the BGP state machine, you will be better prepared for both the Network+ exam and real-world network operations.

BGP Path Selection and Attributes

BGP paths are selected based on a set of attributes that allow network administrators to enforce routing policies. The Network+ exam focuses on the key attributes and the order in which they are evaluated. The BGP best path selection process first prefers the path with the highest weight, a Cisco proprietary attribute.

If weight is equal, the path with the highest local preference is chosen. Local preference is typically used to influence outbound traffic from an autonomous system. Next, if local preferences are the same, BGP prefers the path that was originated by the router itself (local pref is 100 by default).

Then, the shortest AS path is preferred. This is why AS path prepending is used to make a path appear longer and less desirable. After AS path length, BGP considers the origin code, with IGP (i) preferred over EGP (e) and EGP preferred over incomplete (?

). Then comes the multi-exit discriminator (MED), where a lower MED value is preferred when comparing paths from the same neighboring AS. The next criteria is path preference for eBGP over iBGP.

If all else is equal, BGP chooses the path via the nearest IGP neighbor based on the lowest IGP metric to the next hop. Then, the oldest path (the one that has been established the longest) is preferred. If all conditions are still tied, BGP selects the path from the neighbor with the lowest router ID.

Finally, if the router IDs are the same, the path from the neighbor with the lowest peer IP address is chosen. In the Network+ exam, you may be asked to determine which path will be selected given a scenario with specific attribute values. For instance, if Router A has a local preference of 200 for one path and 150 for another, the path with local preference 200 will win.

Another common question involves AS path prepending: a network engineer adds the same AS number multiple times to a route advertisement to make it less preferred. The exam also tests the difference between weight (local to the router) and local preference (propagated within the AS). Remember that weight is Cisco-only and not a standard attribute.

MED is used to influence inbound traffic and is considered after AS path length and origin. When studying BGP attributes, focus on the most commonly tested ones: weight, local preference, AS path, origin, MED, and router ID. Understanding this selection process is critical for configuring BGP policies and for passing the Network+ certification exam.

BGP Route Reflectors and Scaling

In a large autonomous system with many BGP routers, a full mesh of iBGP sessions is required for all routers to receive external routes without causing routing loops. However, this full mesh requirement scales poorly. For N routers, (N*(N-1))/2 iBGP sessions are needed, which can become unmanageable in large networks.

BGP route reflectors solve this problem by allowing a router to reflect iBGP routes to other iBGP peers, reducing the number of sessions. On the Network+ exam, you need to understand the role of route reflectors and the rules they follow. A route reflector and its clients form a route reflector cluster.

The route reflector reflects routes learned from one client to other clients and to non-client iBGP peers. It also reflects routes learned from non-client peers to clients. However, to avoid loops, a route reflector will not reflect routes learned from a client to another non-client peer if the path already contains the cluster ID.

The exam may ask you to identify a valid iBGP design. For instance, a small network might not need route reflectors, but a large ISP network almost certainly uses them. Another alternative is BGP confederations, which divide the AS into sub-ASes, but route reflectors are more common.

When configuring a route reflector, you designate the router as the reflector and specify which peers are clients using the neighbor route-reflector-client command. The cluster ID is set using the bgp cluster-id command. A single cluster can have multiple route reflectors for redundancy.

The Network+ exam may test your understanding of the hierarchical nature of route reflectors and how they improve scalability. Remember that route reflectors do not change the next-hop attribute, but they do modify the cluster-list and originator-id attributes. These attributes prevent loops within the cluster.

For example, if a route reflector receives an update with its own cluster ID in the cluster list, it discards the update. The exam could present a scenario where a network grows and the number of iBGP sessions becomes too high, asking you to recommend a solution. The correct answer would be to implement route reflectors.

You should know that route reflectors do not eliminate the need for a full mesh between route reflectors in different clusters; they only reduce sessions within a cluster. BGP route reflectors are a vital tool for scaling iBGP deployments, and understanding how they work will help you both in the real world and on the Network+ exam.

Troubleshooting Clues

BGP Session Stuck in Active State

Symptom: The BGP neighbor shows a state of Active in the show ip bgp summary output.

This occurs when the router cannot establish a TCP connection to the neighbor. Possible causes include missing IP routes, ACLs blocking TCP port 179, or the neighbor not having BGP configured.

Exam clue: The exam will present a scenario where a BGP session is stuck in Active, and you must identify that the issue is layer 3 connectivity or firewall filtering.

BGP Session Stuck in Idle State

Symptom: The neighbor state remains Idle and does not transition to Connect.

This can happen if BGP is administratively suppressed, the neighbor IP is not reachable, or there is a misconfiguration like a missing router-id. Also, if the BGP process is not started or the neighbor command is incorrect.

Exam clue: The exam may ask why a BGP session never starts. Answer could be missing 'router bgp' or a shut down neighbor.

BGP Session Flapping

Symptom: The neighbor state oscillates between Established and Idle or Connect.

This is often due to unstable connectivity, intermittent packet loss, or mismatched hold timers. Also, if the BGP update packet is too large it may fragment. Keepalive failures are common causes.

Exam clue: The exam tests troubleshooting flapping by checking log messages for BGP-3-NOTIFICATION. Look for mismatched AS numbers or hold timer issues.

Routes Not Being Learned via BGP

Symptom: The show ip bgp output does not show expected prefixes from a neighbor.

Possible reasons include: the neighbor is not advertising the route, inbound prefix-lists filtering, next hop unreachable, or the network command missing on the advertising router. Also, BGP synchronization may prevent routes from being used if the next hop is not in the IGP.

Exam clue: The exam might show that a route is not in the BGP table. The candidate must check if the network command is configured or if a filter is blocking it.

BGP Next Hop Unreachable

Symptom: The BGP table shows the route but it is not installed in the routing table. The next hop IP is unreachable.

BGP requires that the next hop be reachable via an IGP or static route. If the next hop is not reachable, BGP will not install the route. This often happens in eBGP when the next hop is a directly connected interface but that interface is down.

Exam clue: The exam often tests that you need to ensure the next hop is reachable. You may need to use 'neighbor next-hop-self' on a route reflector or eBGP router to change the next hop.

AS Path Loops Detected

Symptom: Routes are not being advertised to a peer, and logs indicate BGP loop detection.

BGP discards routes that contain the local AS number in the AS path. This happens if the route was originated by the local AS or if there is a configuration error like incorrectly setting the remote-as of a peer.

Exam clue: The exam may present a scenario where a route is not being propagated because a router sees its own AS in the path. Answer: BGP loop prevention mechanism.

Wrong Path Selected Due to Attribute Miscompare

Symptom: Traffic takes a suboptimal path, even though there is a better path available.

BGP path selection uses attributes in order. If local preference is not set correctly, or if one path has a longer AS path, the wrong path may be chosen. For example, if you want inbound traffic to use a specific link, you need to manipulate MED or AS path.

Exam clue: The exam will ask you to adjust local preference or MED to influence path selection. For instance, to prefer a path, you set a higher local preference.

BGP Neighbor Authentication Failure

Symptom: The BGP session never establishes, with error messages about authentication.

BGP can use MD5 authentication between peers. If one side has authentication configured and the other does not, or if the passwords do not match, the TCP connection will be rejected. This prevents session establishment.

Exam clue: The exam may include a scenario where a BGP session fails due to authentication. The solution is to ensure both sides have the same password using the 'neighbor password' command.

Memory Tip

Think of BGP as the Big Global Post office for the internet: it uses TCP port 179 (the year is 1791 when the USPS was founded, a stretch but helpful), and its metric is the AS path length (the number of stops the mail makes).

Learn This Topic Fully

This glossary page explains what BGP means. For a complete lesson with labs and practice, see the topic guide.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Related Glossary Terms

Quick Knowledge Check

1.Which BGP attribute is considered first in the best path selection process?

2.A BGP session is stuck in the Active state. What is the most likely cause?

3.What is the purpose of the 'neighbor route-reflector-client' command?

4.Which BGP attribute can be used to make a path appear longer and less preferred?

5.What is the default BGP hold time?

Summary

BGP, the Border Gateway Protocol, is the routing protocol that holds the internet together. It operates between autonomous systems, using a path vector algorithm and TCP port 179 to exchange route information. Unlike interior protocols that focus on speed and topology within a network, BGP is policy-driven, allowing network administrators to control traffic flow based on business agreements and operational requirements.

For IT certification learners targeting the CompTIA Network+, understanding BGP at a conceptual level is essential. You need to know its role, its key characteristics, and how it differs from OSPF and EIGRP. While you will not be configuring BGP on the exam, you will be expected to identify when BGP is the appropriate protocol for a given scenario, such as multi-homing or connecting to the internet.

BGP is not a beginner topic. It is complex, powerful, and carries significant responsibility. A single misconfiguration can affect global connectivity. However, mastering BGP opens doors to advanced networking roles in ISPs, data centers, and cloud infrastructure. For now, focus on the fundamentals: BGP is an exterior path vector protocol that uses TCP and AS paths to route between networks on the internet.