BGP interview questions and answers for network engineers
BGP interview questions test whether you understand BGP as a policy protocol, not just another routing protocol: how sessions form over TCP, how path attributes decide the best route, and how you steer inbound and outbound traffic for a multihomed network. Expect fundamentals on eBGP, iBGP and neighbor states, intermediate questions on local preference, MED, communities and route reflectors, and senior scenarios on route leaks, RPKI, data center fabrics and sessions that will not come up.
By Evin JohnPublished 10 min read
Where BGP questions show up
BGP is the core of interviews for network engineers at ISPs, content networks and large enterprises, and it is increasingly asked of cloud networking engineers and SREs, because Direct Connect, ExpressRoute, VPN tunnels and Kubernetes networking with some CNIs all speak it. Panels usually start with a whiteboard topology: two upstream providers, a few routers and a question such as "make traffic prefer link A but fail over to B". The general job interview, with switching, firewalls and on-call, is on network engineer interview questions; the transport underneath is on TCP/IP interview questions.
- Protocol basicsNeighbor states, message types, eBGP and iBGP rules, administrative distance.
- Path selectionThe decision process in order, often with a topology and two competing routes.
- Policy designSteer traffic for a dual-homed site, write a route map, tag routes with communities.
- Troubleshooting and securityA session stuck in Active, a prefix that is not advertised, a leak or hijack, and how RPKI helps.
BGP fundamentals questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Why is BGP called a path-vector protocol? | Design | Each route carries the list of autonomous systems it crossed. Routers reject paths containing their own AS, which prevents loops between ASes, and choose routes by policy rather than by a single metric. |
| What transport does BGP use? | Session basics | TCP port 179. Reliability comes from TCP, so BGP sends incremental updates and keepalives instead of periodic full tables. |
| Walk through the neighbor states. | Session lifecycle | Idle, Connect, Active, OpenSent, OpenConfirm, Established. Active means the router is trying to open the TCP connection and failing, despite the name. |
| What are the BGP message types? | Protocol | OPEN to negotiate, KEEPALIVE to show liveness, UPDATE to advertise or withdraw routes, NOTIFICATION to report an error and close, plus ROUTE-REFRESH to ask a peer to resend. |
| eBGP versus iBGP? | Core rule | eBGP runs between different ASes and usually between directly connected routers. iBGP runs inside one AS, often between loopbacks, and does not change the next hop or prepend the AS by default. |
| Why does iBGP need a full mesh? | Split horizon | A route learned from one iBGP peer is not advertised to another iBGP peer, to avoid loops inside the AS. Without a full mesh, route reflectors or confederations, some routers never learn the route. |
| What is an autonomous system number, and what is a private ASN? | Addressing | A number identifying a routing domain. Private ranges (64512 to 65534 for 2-byte, and a large 4-byte range) are for internal use and should be stripped before routes reach the internet. |
Why does a network statement sometimes not advertise anything? | Origination | In classic implementations the prefix must exist in the routing table with an exact match. A missing static route to Null0 for an aggregate is a common cause. |
| What is next-hop-self and when do you need it? | Next hop | eBGP routes reach iBGP peers with the external next hop unchanged. If internal routers cannot reach that address, the route is unusable; next-hop-self on the border router rewrites it to its own address. |
| How does BGP compare to OSPF in administrative distance on Cisco? | Route preference | eBGP routes have a lower distance than OSPF and iBGP a higher one, so an iBGP route loses to an IGP route for the same prefix. Other vendors use different preference values. |
- Two branch offices use the same private ASN and cannot learn each other's routes over the provider. Why? Each branch sees its own ASN in the AS path and drops the route as a loop. The fix is allowas-in on the branches or AS override on the provider edge, chosen with the provider.
- What is BGP multipath? Installing several equal paths for one prefix so traffic is spread across them. Vendors require certain attributes to match, such as AS path length and neighbor AS, before paths count as equal.
- What does aggregation with summary-only do? It advertises one summary prefix and suppresses the more specific routes behind it, which keeps tables small but hides detail that could be used for traffic steering.
- What was the synchronization rule? An old requirement that an iBGP route also be known through the IGP before use. It is off by default in modern software because full iBGP meshes and reflectors replaced the need.
- Why might a /25 you announce never be seen on the internet? Many networks filter IPv4 prefixes longer than a /24 (and comparable lengths in IPv6), so very specific announcements are commonly dropped. Check with looking glasses rather than assuming.
Path attributes and best-path selection
Interviewers want the order, the direction each attribute influences and its scope. Local preference is shared across your whole AS and decides how traffic leaves. AS path prepending, MED and provider communities are hints to neighbors about how traffic should enter, and neighbors can ignore them. Cisco adds a router-local weight at the very top of the list.
| Step | Prefer | Scope and use |
|---|---|---|
| Weight (Cisco) | Higher | Local to one router, never advertised. |
| Local preference | Higher | Whole AS; the main tool for choosing an exit. |
| Locally originated | Routes this router originated | Network statement, aggregate or redistribution. |
| AS path length | Shorter | Prepending makes a path look longer to neighbors. |
| Origin | IGP, then EGP, then incomplete | Incomplete usually means redistributed. |
| MED | Lower | A hint to a neighboring AS; by default only compared between routes from the same neighbor AS. |
| eBGP over iBGP | eBGP | Hot-potato routing: leave your network as early as possible. |
| IGP cost to next hop | Lower | Ties broken by the internal path to the exit. |
| Tie-breakers | Oldest eBGP route, then lowest router ID, then lowest neighbor address | Stability first, then deterministic choice. |
from dataclasses import dataclass
from functools import reduce
from ipaddress import IPv4Address
ORIGIN_RANK = {"igp": 0, "egp": 1, "incomplete": 2}
@dataclass
class Path:
name: str
local_pref: int
as_path: list
origin: str
med: int
ebgp: bool
igp_cost: int
router_id: str
def better(a, b):
"""Return the preferred of two paths, using a common subset of the decision process."""
if a.local_pref != b.local_pref:
return a if a.local_pref > b.local_pref else b, "local preference"
if len(a.as_path) != len(b.as_path):
return a if len(a.as_path) < len(b.as_path) else b, "AS path length"
if a.origin != b.origin:
return a if ORIGIN_RANK[a.origin] < ORIGIN_RANK[b.origin] else b, "origin"
same_neighbor_as = a.as_path[:1] == b.as_path[:1]
if same_neighbor_as and a.med != b.med:
return a if a.med < b.med else b, "MED"
if a.ebgp != b.ebgp:
return a if a.ebgp else b, "eBGP over iBGP"
if a.igp_cost != b.igp_cost:
return a if a.igp_cost < b.igp_cost else b, "IGP cost to next hop"
return min(a, b, key=lambda p: IPv4Address(p.router_id)), "lowest router ID"
paths = [
Path("via ISP-A", 100, [64500, 64999], "igp", 50, True, 0, "192.0.2.1"),
Path("via ISP-B", 100, [64510, 64999], "igp", 10, True, 0, "192.0.2.2"),
Path("via core (iBGP)", 100, [64500, 64999], "igp", 50, False, 20, "10.0.0.3"),
]
def pick(paths):
def step(best, cand):
winner, reason = better(best, cand)
print(f"{best.name} vs {cand.name}: {winner.name} wins on {reason}")
return winner
return reduce(step, paths)
print("best:", pick(paths).name)
paths[1].local_pref = 200 # prefer ISP-B by policy
print("best:", pick(paths).name)
# Output:
# via ISP-A vs via ISP-B: via ISP-A wins on lowest router ID
# via ISP-A vs via core (iBGP): via ISP-A wins on eBGP over iBGP
# best: via ISP-A
# via ISP-A vs via ISP-B: via ISP-B wins on local preference
# via ISP-B vs via core (iBGP): via ISP-B wins on local preference
# best: via ISP-BNote what the first run shows: ISP-B's lower MED did not matter, because MED is only compared between routes from the same neighboring AS. Candidates who claim MED always wins on lower value miss that, and it is a favorite follow-up.
Policy, scaling and traffic engineering questions
- How do you make outbound traffic prefer one provider? Set a higher local preference on routes learned from that provider, inbound on the session. Every router in your AS then exits through it while the path exists.
- How do you influence inbound traffic? Prepend your AS on announcements to the backup provider, send MED to a provider with several links to you, use the provider's documented communities to lower preference inside their network, or announce more specific prefixes on the preferred link. None of these is guaranteed, because other networks apply their own policy.
- Prefix list or route map? A prefix list matches prefixes and lengths efficiently. A route map is the policy engine: it matches on prefix lists, AS path filters or communities and sets attributes. Most policies use both.
- What are communities used for? Tags attached to routes so policy can act on groups: well-known ones such as no-export and no-advertise, and provider-defined ones for prepending, blackholing or regional control. Large communities fit 4-byte ASNs.
- How does a route reflector work? Clients peer only with the reflector, which re-advertises iBGP routes between them, adding originator ID and cluster list attributes to prevent loops. Use at least two reflectors, and remember a reflector advertises only its own best path unless add-path is used.
- What is a confederation? Splitting one AS into sub-ASes that run eBGP-like sessions between them while appearing as a single AS to the outside. Less common than route reflectors today.
- Why set a maximum-prefix limit? It tears down or warns on a session if a neighbor suddenly sends far more prefixes than expected, which protects your routers from a leaked full table.
- Soft reconfiguration or route refresh? Changing inbound policy requires the routes again. Route refresh asks the peer to resend; soft reconfiguration inbound stores a copy of everything received, costing memory.
- What is route dampening, and why is it less popular? It suppresses prefixes that flap. Aggressive settings can keep a stable prefix suppressed long after a single incident, so many operators use it carefully or not at all.
- How do BFD and timers affect convergence? Hold timers detect a dead neighbor slowly by default. BFD detects loss of the forwarding path quickly and tells BGP to drop the session, which matters for fast failover.
ip prefix-list OUR-PREFIXES seq 10 permit 203.0.113.0/24
ip route 203.0.113.0 255.255.255.0 Null0
route-map ISP-A-IN permit 10
set local-preference 200
route-map ISP-B-IN permit 10
set local-preference 100
route-map TO-ISP-A permit 10
match ip address prefix-list OUR-PREFIXES
route-map TO-ISP-B permit 10
match ip address prefix-list OUR-PREFIXES
set as-path prepend 64496 64496
router bgp 64496
network 203.0.113.0 mask 255.255.255.0
neighbor 198.51.100.1 remote-as 64500
neighbor 198.51.100.1 route-map ISP-A-IN in
neighbor 198.51.100.1 route-map TO-ISP-A out
neighbor 198.51.100.1 maximum-prefix 1200000 90
neighbor 198.51.100.9 remote-as 64510
neighbor 198.51.100.9 route-map ISP-B-IN in
neighbor 198.51.100.9 route-map TO-ISP-B outThe export filter is the line that matters most. Without it, a site with two providers can re-advertise one provider's routes to the other and become a transit path, which is how many route leaks start. The maximum-prefix value here is illustrative; set yours from what the provider actually sends.
Senior and scenario questions
| Scenario | Likely cause | What a strong answer covers |
|---|---|---|
| The session sits in Active and never establishes. | TCP cannot connect | Reachability to the peer address, the source interface or update-source for loopback peering, an ACL or firewall blocking port 179, a wrong remote AS, TTL for multihop eBGP, or an authentication mismatch. |
| The session flaps every few minutes. | Hold timer or path issues | Look for hold timer expired notifications, interface errors, CPU spikes, MTU problems on large updates, or a max-prefix limit being hit. |
| A prefix is in the BGP table but not installed in the routing table. | Best path or next hop | The next hop is unreachable, another protocol with lower distance wins, or a different path was chosen. Check the BGP table detail for the reason. |
| Your prefix is suddenly announced by another AS. | Hijack or leak | Confirm with public looking glasses and route collectors, contact the networks involved, announce more specifics if appropriate, and publish ROAs so validating networks reject the bad origin. |
| How does RPKI route origin validation help, and what does it not do? | Routing security | ROAs state which AS may originate a prefix and up to what length; validating routers drop invalid routes. It checks the origin only, not the full path, so path-level leaks need filtering and newer path validation work. |
| Design BGP for a leaf-spine data center. | Fabric design | eBGP between every leaf and spine, often a private ASN per leaf and a shared one for spines, ECMP across spines, BFD, and unnumbered peering to reduce addressing. EVPN on top if the fabric carries layer 2 overlays. |
| Connect two on-premises sites to a cloud VPC over private links. | Hybrid | BGP over Direct Connect or ExpressRoute with each provider's documented attribute handling, local preference for the primary link on your side, prepending or MED toward the cloud for the return path, and route limits on both sides. |
Fictional example
- Interviewer
- A company has two providers, a 10G link to ISP-A and a 1G link to ISP-B. Both directions should use ISP-A unless it fails.
- Candidate
- Outbound is in our control: I would set a higher local preference on routes learned from ISP-A, so every router exits there. Inbound is only influence, so I would prepend our AS two or three times toward ISP-B and, if ISP-B offers communities to lower local preference inside their network, use those because they are stronger than prepending. I would announce only our own prefixes on both sessions with a strict prefix list so we never become transit, set max-prefix limits on what we receive, and add BFD so failover does not wait for the hold timer. Then I would verify from outside with a looking glass that the internet sees ISP-A as the preferred path, and test by shutting the session in a maintenance window.
BGP practice plan
- Days 1 and 2: write the decision order from memory, then for each step say whether it affects inbound or outbound traffic and how far it travels.
- Days 3 and 4: build a three-router lab in a simulator you already have (or FRRouting containers), bring up eBGP and iBGP, and break it: wrong AS, missing next-hop-self, missing Null0 route.
- Day 5: write the dual-homed policy above for your own lab and verify it with the BGP table, not by assumption.
- Day 6: read your providers' or a large provider's published community guide and explain two communities out loud.
- Day 7: rehearse the scenario table, especially Active state, hijacks and RPKI, under two minutes each.
For larger design rounds, network architect interview questions covers WAN and data center design choices around BGP.
Topology questions are easy to answer out of order, setting MED before you have fixed outbound preference. Natively, an AI interview assistant for Mac and Windows, transcribes a mock networking round on your computer, so afterward you can check that you separated inbound from outbound. During practice it can read a topology diagram or show output from a screenshot and suggest what to look at next, and with Pro or the free trial it uses the résumé and job description you add. Your transcript and notes remain for review.
Questions people ask
What BGP questions are asked in network engineer interviews?
Neighbor states, eBGP versus iBGP, why iBGP needs a full mesh or route reflectors, the best-path decision order, local preference, AS path prepending and MED, communities, next-hop-self and troubleshooting sessions that will not establish.
How do I influence inbound versus outbound traffic with BGP?
Outbound: set local preference on routes learned from the preferred provider. Inbound: prepend toward the backup, send MED, use provider communities or announce more specific prefixes, knowing other networks may ignore these hints.
What does it mean when a BGP neighbor is stuck in Active?
The router is trying to open the TCP session on port 179 and failing. Check reachability, the update source, ACLs or firewalls, the configured remote AS, multihop TTL and authentication.
Is RPKI asked in BGP interviews?
Increasingly. Explain that ROAs state which AS may originate a prefix, that validating routers reject invalid origins, and that origin validation does not stop every route leak.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
