Can an LLM Read a BGP Table? A Practical Test With Real Router Output

Small, real, reproducible test run 15 November 2026 - six synthetic prefixes (RFC 5737 documentation addressing), not a benchmark claim. Full prompt, raw model reply and the deterministic ground-truth script are linked in Sources. Disclosure: this article was drafted with AI assistance; the test itself was run against a second, independent model instance so the author's own writing didn't also grade its own homework.

"Paste your BGP table into an LLM and ask it what's wrong" is a common pitch for AI-assisted NOC tooling, usually backed by nothing more than a screenshot. We ran an actual small test instead: six synthetic BGP prefixes, two competing paths each, no tie-break rule given in the prompt, and a separate deterministic script implementing RFC 4271 §9.1.2.2 as the ground truth to grade against. Here is what actually came back, not what we expected to come back.

Key takeaways
  • Field-level extraction into JSON (next-hop, AS-path, origin, local-pref, MED, community) was correct on all 12 paths across the 6 test prefixes, including a path with an unknown MED that the model correctly left null instead of guessing a number.
  • With no tie-break rule stated, the model also picked the correct best path on all 6 prefixes, matching our independently-computed RFC 4271 decision in every case - including a tie that only resolves on step 5 (eBGP preferred over iBGP).
  • That result came with a tell: every explanation carried a citation link to a Cisco best-path-selection doc with an utm_source=openai parameter in the URL - strong evidence the model checked the rule order with live web search rather than answering from parametric memory alone.
  • Six prefixes is a demonstration, not a benchmark. It shows unaided reasoning can be right when the model can verify itself; it does not show it always will be, and nothing in the output would have told us if one answer had been wrong.
  • The actionable conclusion is unchanged by this result: diff the model's structured output against a mechanical ground truth before trusting it, because a wrong answer and a right one read identically confident.

Three different skills hiding under one request

"Is this BGP table healthy?" asks a model to do three unrelated things at once:

  1. Lexical parsing - turning fixed-width or semi-structured CLI text into fields: prefix, next-hop, AS-path, local-pref, MED, communities, origin code.
  2. Rule recall - knowing that BGP picks the highest local-pref, then shortest AS-path, then lowest origin code, then lowest MED, then eBGP over iBGP, then lowest IGP metric to next-hop, then oldest route, then lowest router-ID, in that order, per RFC 4271 section 9.1.2.2 (vendor implementations add extra steps before this, which is itself a common source of real-world "the AI got it wrong" reports).
  3. Rule application - walking the specific numbers in front of it through that ordered rule set and landing on the same answer a human or a script would.

Step 1 is pure text transformation. Step 2 is recall of a published, unambiguous spec. Step 3 is the kind of multi-step, order-sensitive task where language models are known to sometimes drop or reorder steps silently. We tested all three together, deliberately, to see what a realistic single prompt actually produces.

The test: six prefixes, one blind prompt, one ground truth

We built six synthetic prefixes using RFC 5737 documentation addresses, each with two competing paths, formatted as plain show bgp-style text. The six were picked to force different tie-break steps: one decided by local-pref, two by AS-path length, one with an unknown (?) MED that shouldn't affect the outcome, one that only resolves at the eBGP-over-iBGP step, and one with both local-pref and AS-path pointing the same direction (a sanity check). A short Python script implementing the RFC 4271 order mechanically computed the "correct" answer for each - that script and its output are linked below, so the ground truth here is checkable independently of our own judgement.

The prompt asked a second, independent model instance (not the one drafting this article) to (1) extract every path as JSON with specific field names and (2) name the best path with a one-line reason - explicitly without being told the tie-break order. That's the condition that matters: if a model needs to be handed the algorithm to get it right, that's very different from a model that already applies it correctly.

What came back

Extraction: all 12 paths (6 prefixes × 2) came back as clean JSON matching the requested schema, field for field, including the path with an unknown MED, which was correctly represented as null rather than a guessed number.

PrefixDeciding rule (ground truth)Model's best-path pickMatch?
198.51.100.0/24local_pref (150 vs 100)203.0.113.1Yes
198.51.101.0/24AS-path length (2 vs 3 hops)203.0.113.10Yes
198.51.102.0/24AS-path length (1 vs 2 hops)203.0.113.13Yes
198.51.103.0/24AS-path length (unknown MED ignored)203.0.113.18Yes
198.51.104.0/24eBGP over iBGP (tie through local_pref/AS-path/origin/MED)203.0.113.21Yes
198.51.105.0/24local_pref (130 vs 120)203.0.113.26Yes

Six for six, including the hardest case in the set - the tie that only resolves at the eBGP/iBGP step, which is easy to skip if a model stops checking after AS-path length. That is a genuinely good result, and it would be dishonest to write this article as if it had gone the other way just because that made a punchier warning.

Every one of the six explanations came back with a citation link to a Cisco BGP best-path-selection support page, and that URL carried an utm_source=openai query parameter. We didn't ask for citations or for web lookup. That parameter is a strong sign the model fired off a live web search mid-answer to check the exact RFC 4271 step order before committing to a decision, rather than relying purely on whatever it had memorized during training.

That changes what this result actually demonstrates. It is evidence that a model with search access, prompted to reason about BGP, will often go verify the rule instead of guessing - which is a meaningfully different (and more reassuring) claim than "the model knows BGP cold." It also means a model running without tool access, or in an environment where that search silently fails, might behave differently on the exact same prompt. We did not test that condition here, so we're not claiming it either way - it's simply the honest boundary of what six prefixes and one run can tell you.

A workflow that stays honest regardless

A clean 6-for-6 does not retire the mechanical check - it's still the only way to know it was a clean 6-for-6, and a seventh prefix tomorrow is not guaranteed to go the same way. The pattern that holds up whether the model gets it right unaided or not:

StepWho does itHow you check it
1. CLI text → structured JSONLLMRegex/parser ground truth on a sample; diff every field, don't eyeball it
2. Best-path / tie-break decisionYour code (RFC 4271 / 7432 order, hard-coded) - or the LLM, diffed against that codeCompare to the router's own best flag or a second independent tool
3. Explain the decision in plain languageLLM, fed the JSON and the already-verified decisionSpot-check that the cited tie-break step matches the verified outcome

For a broader take on keeping an AI agent read-only and bounded around real device state, see our earlier piece on a read-only network change reviewer. Same discipline - mechanically checked output, nothing taken on the model's word alone - applies here even though this task never touches a running config.

Frequently asked questions

Can an LLM reliably tell you which BGP path is best?

In our small test (6 synthetic prefixes, no tie-break rule given), a model got all 6 right against an independently computed RFC 4271 ground truth, apparently by verifying the rule order via live web search rather than pure memory. That's a good result but a sample of six, not a benchmark - keep a mechanical check in place regardless.

What is an LLM reliably good for with router output?

Structured extraction: turning CLI text (show bgp, show route) into clean JSON fields - next-hop, AS-path, local-pref, origin, MED, communities - including correctly leaving unknown values null instead of guessing. This matched a schema check on every field in our test.

How do you verify an LLM's answer about network state without re-reading its explanation?

Diff its structured output against a mechanical ground truth (a parser script, the router's own best-path flag, or a second independent tool) rather than judging whether the prose sounds right. A wrong answer and a right one can read identically confident.

Why did the model's answer include a Cisco documentation link with "utm_source=openai"?

That query parameter is a signature of a live web search performed mid-answer. It suggests the model checked the RFC 4271 tie-break order against a real source rather than answering purely from memorized training data - worth knowing because it means the result may depend on search/tool access being available, which wasn't separately tested here.

Sources

Checked 15 November 2026.

  1. RFC 4271 - A Border Gateway Protocol 4 (BGP-4), section 9.1.2.2 (route selection / tie-breaking)
  2. RFC 5737 - IPv4 Address Blocks Reserved for Documentation (used for all test addressing)
  3. Cisco - BGP Best Path Selection Algorithm (the doc the test model itself cited)

Raw test artifacts (prompt, model reply, ground-truth script and data) are published alongside this run's operational log and available on request.

Try it: CIDR to IP Range - free, runs in your browser.

Comments

Popular posts from this blog

BGP Neighbor States

Reason legend in show ip ospf statistics