cli: a router's own interface address is a row in show ip route #2176

Merged
jaylouisw merged 1 commit from rev/1119-1542 into main 2026-11-19 16:38:52 +00:00
Owner

The question

When a router has ip address 10.1.1.1 255.255.255.252 on a port, does show ip route carry a row for the address itself - and if so, what code, what mask, what wording, where, and when does it not appear?

Verdict

Two rows, one line apart: the connected subnet (C 10.1.1.0/30 is directly connected, Ethernet0/0) and the address as a /32 local host route (L 10.1.1.1/32 is directly connected, Ethernet0/0). Distance 0, the only job is to be a receive entry, and it is not redistributed by redistribute connected. An address configured with a /32 mask prints one row (C only) - the vendor page says so in its next section.

Sources: Cisco, Local Host Routes Installed in the Routing Table (doc 116264, IOS 15.0(1)S), Cisco, Configure a Gateway of Last Resort (doc 16448), Cisco, Understand Administrative Distance, IOS XE 16 OSPF guide.

What changed

  • engine/device.js: routesTable() emits { code: 'L', type: 'local' } beside each addressed interface whose mask is not /32; the row is directlyConnected (so it prints in the connected row's shape), distance 0 via routeDistance(), and takes its fault note from its port by the same branch the connected row uses.
  • engine/cli.js: legend is now Codes: L - local, C - connected, S - static, B - BGP, O - OSPF, * - candidate default - the new code first, the rest in the box's order (B before O).
  • research/local-route-in-show-ip-route.md: citations, what is inferred (DHCP-learned addresses; IOS 12.x has no L) and what is unresolved (classful heading lines, /31, routeTo() has no receive verdict).
  • docs/CLI.md: legend samples, the R1 walkthrough (now with L rows) and a paragraph stating the rule.

Tests

  • New test/local-route-row.test.js - 23 checks: the pair and its order, wording, distance 0, /32 one-row case, shut-port withdrawal, non-routing switch, receive-entry distinction from routeTo().
  • Four existing suites adjusted where they pinned the old one-row table or the old legend (route-selection, routes-agreement, show-argument-refusal, show-ip-route-host-table, show-ip-route-prefix-one-field).
  • npm test: 380 suites, 12,876 assertions, 0 failed. node scripts/syntax-check.js: 459 files OK. npm run check:citations: OK.
## The question When a router has `ip address 10.1.1.1 255.255.255.252` on a port, does `show ip route` carry a row for the address itself - and if so, what code, what mask, what wording, where, and when does it not appear? ## Verdict Two rows, one line apart: the connected subnet (`C 10.1.1.0/30 is directly connected, Ethernet0/0`) and the address as a `/32` local host route (`L 10.1.1.1/32 is directly connected, Ethernet0/0`). Distance 0, the only job is to be a receive entry, and it is not redistributed by `redistribute connected`. An address configured with a `/32` mask prints one row (C only) - the vendor page says so in its next section. Sources: [Cisco, *Local Host Routes Installed in the Routing Table* (doc 116264, IOS 15.0(1)S)](https://www.cisco.com/c/en/us/support/docs/ip/ip-routing/116264-technote-ios-00.html), [Cisco, *Configure a Gateway of Last Resort* (doc 16448)](https://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/16448-default.html), [Cisco, *Understand Administrative Distance*](https://www.cisco.com/c/en/us/support/docs/ip/ip-routed-protocols/113153-adjust-ad-00.html), [IOS XE 16 OSPF guide](https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_ospf/configuration/xe-16/iro-xe-16-book/iro-sup-vrf.html). ## What changed - `engine/device.js`: `routesTable()` emits `{ code: 'L', type: 'local' }` beside each addressed interface whose mask is not `/32`; the row is `directlyConnected` (so it prints in the connected row's shape), distance 0 via `routeDistance()`, and takes its fault note from its port by the same branch the connected row uses. - `engine/cli.js`: legend is now `Codes: L - local, C - connected, S - static, B - BGP, O - OSPF, * - candidate default` - the new code first, the rest in the box's order (`B` before `O`). - `research/local-route-in-show-ip-route.md`: citations, what is inferred (DHCP-learned addresses; IOS 12.x has no `L`) and what is unresolved (classful heading lines, `/31`, `routeTo()` has no receive verdict). - `docs/CLI.md`: legend samples, the R1 walkthrough (now with `L` rows) and a paragraph stating the rule. ## Tests - New `test/local-route-row.test.js` - 23 checks: the pair and its order, wording, distance 0, `/32` one-row case, shut-port withdrawal, non-routing switch, receive-entry distinction from `routeTo()`. - Four existing suites adjusted where they pinned the old one-row table or the old legend (`route-selection`, `routes-agreement`, `show-argument-refusal`, `show-ip-route-host-table`, `show-ip-route-prefix-one-field`). - `npm test`: **380 suites, 12,876 assertions, 0 failed**. `node scripts/syntax-check.js`: 459 files OK. `npm run check:citations`: OK.
cli: a router's own interface address is a row in show ip route
All checks were successful
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 8s
CI / Server smoke test (pull_request) Successful in 10s
CI / Test (Node 22) (pull_request) Successful in 57s
CI / Test (Node 20) (pull_request) Successful in 59s
CI / Docker build (pull_request) Successful in 23s
CI / Test (Node 18) (pull_request) Successful in 1m1s
CI / Arm auto-merge (pull_request) Successful in 4s
5485ea53e1
`ip address 10.1.1.1 255.255.255.252` installs two rows on IOS, one line
apart: the connected subnet (`C 10.1.1.0/30 is directly connected, Ethernet0/0`)
and the address itself as a /32 local host route
(`L 10.1.1.1/32 is directly connected, Ethernet0/0`). Cisco's note on local
host routes states the rule, prints the pair, gives the one exception (an
address configured with a /32 mask "appears in the routing table only as
connected") and the two numbers that belong to the row: distance 0, and never
redistributed by `redistribute connected`. This console printed only the C row,
so the address a technician had just typed was missing from the table they were
told to check it in.

`routesTable()` now emits the local row beside its subnet (not for a /32
address), priced at distance 0, taking its fault note from the same port. The
`show ip route` legend leads with `L - local` and keeps the box's order (B
before O). Non-routing boxes are untouched.

test/local-route-row.test.js (23 checks); research/local-route-in-show-ip-route.md.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-19 16:08:35 +00:00
jaylouisw deleted branch rev/1119-1542 2026-11-19 16:38:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!2176
No description provided.