NAT is modelled but unreachable, and a ping is not translated even with rules #1366

Closed
opened 2026-11-10 18:07:06 +00:00 by jaylouisw · 0 comments
Owner

NAT is modelled end to end and no lab can use it. Two defects, one behind the other.

engine/nat.js models static one-to-one, dynamic pools and PAT, with a live translation table and ageing.
Simulator calls it on the way out and back in and emits nat-drop when a rule cannot translate. But
config.nat had no writer anywhere — not the CLI, not the UI, not the server, not a catalogue spec — so
_isNat() was always false. docs/SIMULATION.md recorded it plainly: "There is no ip nat inside/outside, no
ip nat inside source. Rules come from config.nat.rules in the topology JSON."

Behind that, the data path had its own hole. Both hooks began:

if (!frame || !frame.l4 || !this._isNat(dev)) return 'pass';

An ICMP echo has no l4 — the engine keeps it in frame.icmp — so a ping crossed a NAT router untouched even
with rules in the file. The docs carried this as "Absent — important": "a ping across a NAT box is not
translated"
. That is the first test anybody runs.

What must be true instead

  1. a console surface for the three rule types the model already implements, validated by the model's own
    validateRule() so the console and the wire cannot disagree;
  2. refusals that name the reason and what would work;
  3. ICMP translated, because a ping is the test;
  4. show ip nat rules | translations | statistics reading the engine's own state, distinguishing nothing has
    crossed
    from traffic crossed and nothing needed translating;
  5. the configuration survives a save and is printed by show running-config, pools before the rules that use them.
NAT is modelled end to end and no lab can use it. Two defects, one behind the other. `engine/nat.js` models static one-to-one, dynamic pools and PAT, with a live translation table and ageing. `Simulator` calls it on the way out and back in and emits `nat-drop` when a rule cannot translate. But `config.nat` had **no writer anywhere** — not the CLI, not the UI, not the server, not a catalogue spec — so `_isNat()` was always false. `docs/SIMULATION.md` recorded it plainly: *"There is no `ip nat inside/outside`, no `ip nat inside source`. Rules come from `config.nat.rules` in the topology JSON."* Behind that, the data path had its own hole. Both hooks began: ```js if (!frame || !frame.l4 || !this._isNat(dev)) return 'pass'; ``` An ICMP echo has no `l4` — the engine keeps it in `frame.icmp` — so a ping crossed a NAT router untouched even with rules in the file. The docs carried this as **"Absent — important"**: *"a ping across a NAT box is not translated"*. That is the first test anybody runs. ## What must be true instead 1. a console surface for the three rule types the model already implements, validated by the model's own `validateRule()` so the console and the wire cannot disagree; 2. refusals that name the reason and what would work; 3. ICMP translated, because a ping is the test; 4. `show ip nat rules | translations | statistics` reading the engine's own state, distinguishing *nothing has crossed* from *traffic crossed and nothing needed translating*; 5. the configuration survives a save and is printed by `show running-config`, pools before the rules that use them.
Sign in to join this conversation.
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#1366
No description provided.