engine(vlan): no vlan 22 is accepted while a trunk's list names it #2427

Merged
jaylouisw merged 1 commit from rev/1121-1312 into main 2026-11-21 13:38:49 +00:00
Owner

Question

no vlan 22 while a trunk's switchport trunk allowed vlan list names 22: does a Cisco IOS-style switch refuse the command, and does the list change afterwards?

Verdict

Settled, and the console was wrong. Deleting a VLAN is a VLAN-database operation; the interface line is configuration and survives it, and the port stops carrying the VLAN because a trunk port is a member of a VLAN only while that VLAN exists.

Sources:

  • Cisco Community, "deleting VLAN" (solved 2017) - question is this half verbatim, accepted answer: "No, you need to remove it manually from the trunk interface." https://community.cisco.com/t5/switching/deleting-vlan/td-p/3093024
  • Cisco Community, "removing and deleting a vlan from a trunk" - "It can (just be deleted from the switch), but only deleting it ('no vlan 30') won't make it disappear from the interface's config". https://community.cisco.com/t5/switching/removing-and-deleting-a-vlan-from-a-trunk/m-p/2564927
  • Catalyst 9300 17.17 "Configuring VLAN Trunks" - "A trunk port can become a member of a VLAN if the VLAN is enabled, if VTP knows of the VLAN, and if the VLAN is in the allowed list".
  • Cisco Press SRWE 4.4 Example 4-29 - Vlans allowed on trunk (configuration) vs Vlans allowed and active in management domain (database/STP).

What changed

  • engine/cli.js - no vlan <id> no longer refuses for a live trunk. It deletes the VLAN, prints Fa0/3 stops carrying VLAN 22: the switchport configuration is unchanged (vlan 22 brings it back) (native VLANs marked (native)), and leaves the switchport trunk ... lines exactly as typed. Ports that only reference the VLAN (native/allowed stored on a non-trunk port, voice VLAN) still refuse - unsettled.
  • engine/device.js - Device.knowsVlan(id): built-ins always exist, others only while in config.vlans; null on a box with no VLAN database.
  • engine/simulator.js - frames in a VLAN the database does not hold are dropped at ingress (so nothing is learned in a VLAN show vlan no longer prints) and at egress; L2-only, and LLDP exempt as it already was from the allowed list.
  • Tests: test/vlan-delete-leaves-port-inactive.test.js (39 checks) and test/show-interfaces-port.test.js (47) pin the receipt, the untouched backup, the drop counter and the MAC table; two mismatch fixtures that used a nonexistent native VLAN now create it.
  • docs/CLI.md, docs/plans/interfaces-trunk-view.md, research/trunk-allowed-vlan-on-vlan-delete.md updated; CHANGELOG entry added.

Gates

  • node scripts/syntax-check.js - 534 files, all OK
  • npm test - 454 suites, 15434 assertions, 0 failed

Still open

The native-VLAN variant has no direct transcript (treated the same way, recorded in the research note); show interfaces trunk (where the deleted VLAN would drop out of the "active" list) is still a plan step; references that are stored but not in force still refuse.

### Question `no vlan 22` while a trunk's `switchport trunk allowed vlan` list names 22: does a Cisco IOS-style switch refuse the command, and does the list change afterwards? ### Verdict Settled, and the console was wrong. Deleting a VLAN is a VLAN-database operation; the interface line is configuration and survives it, and the port stops carrying the VLAN because a trunk port is a member of a VLAN only while that VLAN exists. Sources: * Cisco Community, "deleting VLAN" (solved 2017) - question is this half verbatim, accepted answer: "No, you need to remove it manually from the trunk interface." https://community.cisco.com/t5/switching/deleting-vlan/td-p/3093024 * Cisco Community, "removing and deleting a vlan from a trunk" - "It can (just be deleted from the switch), but only deleting it ('no vlan 30') won't make it disappear from the interface's config". https://community.cisco.com/t5/switching/removing-and-deleting-a-vlan-from-a-trunk/m-p/2564927 * Catalyst 9300 17.17 "Configuring VLAN Trunks" - "A trunk port can become a member of a VLAN if the VLAN is enabled, if VTP knows of the VLAN, and if the VLAN is in the allowed list". * Cisco Press SRWE 4.4 Example 4-29 - `Vlans allowed on trunk` (configuration) vs `Vlans allowed and active in management domain` (database/STP). ### What changed * `engine/cli.js` - `no vlan <id>` no longer refuses for a live trunk. It deletes the VLAN, prints `Fa0/3 stops carrying VLAN 22: the switchport configuration is unchanged (vlan 22 brings it back)` (native VLANs marked `(native)`), and leaves the `switchport trunk ...` lines exactly as typed. Ports that only *reference* the VLAN (native/allowed stored on a non-trunk port, voice VLAN) still refuse - unsettled. * `engine/device.js` - `Device.knowsVlan(id)`: built-ins always exist, others only while in `config.vlans`; `null` on a box with no VLAN database. * `engine/simulator.js` - frames in a VLAN the database does not hold are dropped at ingress (so nothing is learned in a VLAN `show vlan` no longer prints) and at egress; L2-only, and LLDP exempt as it already was from the allowed list. * Tests: `test/vlan-delete-leaves-port-inactive.test.js` (39 checks) and `test/show-interfaces-port.test.js` (47) pin the receipt, the untouched backup, the drop counter and the MAC table; two mismatch fixtures that used a nonexistent native VLAN now create it. * `docs/CLI.md`, `docs/plans/interfaces-trunk-view.md`, `research/trunk-allowed-vlan-on-vlan-delete.md` updated; CHANGELOG entry added. ### Gates * `node scripts/syntax-check.js` - 534 files, all OK * `npm test` - 454 suites, 15434 assertions, 0 failed ### Still open The native-VLAN variant has no direct transcript (treated the same way, recorded in the research note); `show interfaces trunk` (where the deleted VLAN would drop out of the "active" list) is still a plan step; references that are stored but not in force still refuse.
engine(vlan): no vlan 22 is accepted while a trunk's list names it
All checks were successful
CI / Server smoke and Docker build (pull_request) Successful in 32s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 7s
CI / Test (Node 18) (pull_request) Successful in 1m3s
CI / Test (Node 20) (pull_request) Successful in 1m3s
CI / Test (Node 22) (pull_request) Successful in 1m3s
CI / Arm auto-merge (pull_request) Successful in 3s
4ca458eaaf
Deleting a VLAN is a VLAN-database operation, and a trunk's `switchport trunk
allowed vlan ...` line is configuration: the list is not rewritten and the port
stops carrying the VLAN because a trunk port is a member of a VLAN only while
that VLAN exists. Two operators answer the exact question on Cisco Community
("No, you need to remove it manually from the trunk interface"; "only deleting
it ('no vlan 30') won't make it disappear from the interface's config"), and the
Catalyst 9300 trunk guide states the three-part membership test.

The console answered with a sentence no box prints ("% VLAN 22 is still carried
by 1 port(s) ...") and kept the VLAN. It now commits the deletion, names the
trunks that stop carrying it, and leaves their lines exactly as typed; the data
path drops frames for a VLAN the database does not hold, on ingress and on
egress, while LLDP stays exempt as it was from the allowed list. Ports that only
reference a VLAN without carrying it still refuse, because no source says what a
box does with a reference that is not in force.

research/trunk-allowed-vlan-on-vlan-delete.md carries the sources and the
native-VLAN paste that is still open.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-21 13:30:32 +00:00
jaylouisw deleted branch rev/1121-1312 2026-11-21 13:38:51 +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!2427
No description provided.