BGP basics: what to know for Network+
BGP in one paragraph
BGP (Border Gateway Protocol, version 4, defined in RFC 4271) is the exterior routing protocol that connects autonomous systems: the separately administered networks of ISPs, large companies and cloud providers that together make up the internet. Where OSPF and EIGRP find the best path inside one organisation by metric, BGP exchanges reachability between organisations and chooses routes by policy and by the list of autonomous systems a route has crossed. The exam rule: inside one network, use an interior protocol; between two autonomous systems, such as a company and its ISP, the answer is BGP. Network+ N10-009 names BGP but only at recognition depth; the CCNA objectives do not list it.
The pieces, layer by layer
Autonomous system (AS). RFC 4271 describes an AS as a set of routers under a single technical administration that uses an interior protocol and common metrics inside it. Each AS has an AS number. Numbers from 64512 to 65534 (16-bit) and 4200000000 to 4294967294 (32-bit) are reserved for private use (RFC 6996), which an organisation can use when it does not need a globally unique one.
Sessions. BGP neighbours, called peers, are configured by hand, and the protocol runs over TCP port 179 (RFC 4271). It does not discover neighbours like OSPF does, and it relies on TCP for reliable delivery instead of sending its own acknowledgements. Once a session is up, the peers exchange their full set of routes and afterwards only changes.
eBGP and iBGP. A session between routers in different autonomous systems is external BGP (eBGP); a session between routers in the same AS is internal BGP (iBGP). When a router sends a route over eBGP, it prepends its own AS number to the AS path. Over iBGP, the AS path is left unchanged. A router must not pass a route learned from one iBGP peer to another iBGP peer, so iBGP peers inside an AS are normally fully meshed, or a route reflector is used to reduce the number of sessions.
Path attributes. Each route carries attributes. The ones worth recognising are the AS_PATH (the list of autonomous systems the route traversed), NEXT_HOP, LOCAL_PREF (a preference shared inside one AS, higher is better), MED (a hint to a neighbouring AS, lower is better) and ORIGIN. A router that sees its own AS number in the AS path of a received route treats it as a loop and excludes it, which is how BGP avoids loops without a metric.
How BGP chooses a route
BGP is a policy protocol, so its decision is a sequence of comparisons rather than one metric. RFC 4271 prefers the route with the higher LOCAL_PREF first; among the remaining candidates it breaks ties in this order: fewest autonomous systems in the AS path, lowest ORIGIN value, lowest MED (only compared between routes from the same neighbouring AS), an eBGP-learned route over an iBGP-learned one, lowest interior cost to the next hop, then the lowest BGP identifier and lowest peer address. Vendors add their own steps (Cisco, for example, has a local “weight” attribute), so the exam-level takeaway is just the two ideas: shorter AS path wins, and policy attributes such as LOCAL_PREF can override it.
BGP also takes part in the normal routing table decision. Cisco’s defaults give external BGP an administrative distance of 20 and internal BGP 200 (Cisco). So an eBGP route is trusted more than any interior protocol, while an iBGP route is trusted less than OSPF (110) or EIGRP (90). See administrative distance and the routing table for how that interacts with prefix length.
BGP compared with interior protocols
| OSPF | EIGRP | BGP | |
|---|---|---|---|
| Scope | Inside one AS | Inside one AS | Between autonomous systems (and iBGP inside) |
| Neighbours | Discovered | Discovered | Configured manually |
| Transport | IP protocol 89 | IP protocol 88 | TCP 179 |
| Chooses by | Lowest total cost | Composite metric | Attributes and policy, AS path length |
| Typical use | Campus, data centre | Cisco-centric enterprise | ISP edge, multi-homed company, cloud connectivity |
A worked example: a company with two ISPs
A company holds AS 65010 (a private number, used here for illustration) and buys connectivity from ISP A (AS 64501) and ISP B (AS 64502). It wants to send outbound traffic through ISP A and use ISP B only if A fails.
- The edge router peers with each ISP over eBGP on TCP 179 and receives a route to a remote network, say via ISP A with AS path
64501 64900and via ISP B with64502 64700 64900. - Without policy, the shorter AS path (two autonomous systems, via A) wins on its own.
- To make the preference explicit, the company sets LOCAL_PREF higher on routes learned from ISP A. LOCAL_PREF is compared before AS path length, so A is chosen even if B ever offers a shorter path.
- If the session to ISP A drops, its routes disappear and the routes via ISP B are used.
This scenario, a multi-homed network, is the one a Network+ question is most likely to use when it asks which protocol fits. Compare it with static vs dynamic routing, where a single ISP link needs only a default route.
Which exams test this
| Exam | How the topic appears | Where on this site |
|---|---|---|
| CompTIA Network+ N10-009 | Network Implementation (20%), 2.1 characteristics of routing technologies: dynamic routing listed as BGP, EIGRP, OSPF. Only the name and role are in the outline. Minor topic | Implementation (20%) |
| CCNA 200-301 | BGP is not named in the v1.1 or v2.0 objectives. Only its AD value (20) appears in common routing-table material | IP routing explained lists the eBGP AD |
How exam questions are built around BGP
Questions at this level are classification questions. The scenario mentions two organisations, an ISP, “autonomous systems” or “the internet”, and the options list OSPF, EIGRP, RIP and BGP; BGP is the answer. The trap is picking OSPF because it is the most familiar dynamic protocol, or choosing a static route when the requirement says the company has several ISPs. Another is confusing the roles: BGP is not the fastest-converging protocol and does not pick the lowest-cost path; it picks policy and AS path. Watch the words “between autonomous systems”, “exterior”, “multi-homed”, “policy” and “TCP 179”. The port is on the common ports cheat sheet, and OSPF explained shows the interior contrast.
Two practice questions
Question 1. A company connects to two internet service providers and wants to exchange routes with both using a protocol designed for routing between autonomous systems. Which protocol should it use?
- A. OSPF
- B. EIGRP
- C. RIP
- D. BGP
Show answer
Answer: D
BGP is the exterior gateway protocol used between autonomous systems, such as a company and its ISPs. OSPF and EIGRP are interior protocols designed for use inside one administrative domain. RIP is also an interior protocol and its 15-hop limit makes it unsuitable at that scale.
Question 2. A router receives the same remote prefix from two eBGP peers with equal LOCAL_PREF. One route has an AS path of three autonomous systems, the other of five. Assuming no other policy differs, which route is preferred?
- A. The five-AS route, because longer paths carry more information
- B. The three-AS route, because the AS path is shorter
- C. Both, load balanced by default
- D. Neither, because BGP needs a metric
Show answer
Answer: B
With LOCAL_PREF equal, the next comparison is AS path length, and the route crossing fewer autonomous systems wins, so the three-AS route is chosen. The longer path is not preferred because it is learned second or because it has more detail. The two routes are not treated as equal, because the AS path lengths differ.