Interactive Tutorial · Local Browser WebAssembly · 6 min

Chapter 3: Firewall Rule Testing (802.1Q vlan & Stateful TCP)

Generate VLAN-tagged, stateful 3-way TCP sessions (syn -> syn ack -> ack) so firewalls and Suricata rules inspect your traffic instead of dropping it.

Labs completed0/7
The Situation · 6 min

You need to validate a firewall ACL permitting VLAN 100 clients to reach an internal API on TCP port 8080—and Windows/macOS NIC drivers keep stripping 802.1Q tags from live captures.

What You'll Pull Off Here

  • Establish a 3-way TCP handshake (syn -> syn ack -> ack) specifying srcport and dstport only once.
  • Let Layer 7 protocols (http, tls, ssh, postgres) inherit ports and advance 32-bit seq / acknum counters automatically.
  • Attach IEEE 802.1Q vlan 100 headers onto every frame to test trunk ACLs and inter-VLAN firewall policies.
Interactive Lab Check

Lab 3: Test a VLAN 100 Firewall Rule on TCP Port 8080

Change the opening tcp syn from dstport 80 to dstport 8080 (all 4 subsequent lines inherit 8080 automatically), and tag all 5 frames with vlan 100.

  1. 1.Change dstport 80 to dstport 8080 on the opening tcp syn line.
  2. 2.Add vlan 100 to all 5 packet lines inside compile { ... }.
  3. 3.Click Check Exercise, then select Packet #4 in the inspector to verify VLAN 100 + TCP seq 1001.

1. Why Stateful Firewalls Drop Single Spoofed Packets

If you send a lone HTTP GET or TLS ClientHello through a FortiGate, Palo Alto, Cisco ASA, or Suricata (flow:established,to_server;), it gets dropped immediately because no TCP session exists in the state table.

In FrameAssembly, three short lines (syn, syn ack, ack) build a valid stateful session. Set srcport and dstport once on the opening syn, and every <- and -> line that follows reuses the port pair and counts payload bytes into seq and acknum automatically.

2. 802.1Q vlan Tagging & Why HTTP Uses hosthdr

Adding vlan 100 inserts a real 4-byte IEEE 802.1Q tag (0x8100) between Ethernet II and IP so switch trunk ports and VLAN-aware firewall interfaces see the exact subinterface tag.

One helpful naming rule: because host is used at the top of .frasm files to declare devices, HTTP and SSDP use hosthdr "api.corp.local" for the HTTP Host: header.

Word-by-Word Syntax Breakdown
Layer 2 VLAN tag + Layer 4 stateful TCP session opener:
client -> api_srv vlan 100 tcp syn srcport 51400 dstport 8080 win 65535 mss 1460
vlan 100802.1Q TagInserts 4-byte 802.1Q header with VID 100 (0x8100)
tcp synTCP FlagStarts connection at deterministic initial seq 1000
srcport 51400 dstport 80804-Tuple PortsRemembered and auto-swapped across all <- / -> lines that follow
win 65535 mss 1460TCP OptionsSets window size + Maximum Segment Size option
Quick Formatting Reference (2 rules)
ItemValid .frasmAvoid
Port keywordstcp syn srcport 51400 dstport 8080tcp syn sport 51400 dport 8080
HTTP Host headerhttp get uri "/healthz" hosthdr "api.corp.local"http get uri "/healthz" host "api.corp.local"
vlan100_http_acl.frasmLoading WASM…
Wireshark filter: vlan.id == 100 && tcp.port == 8080
Open in Playground
0 B · 0.000 ms
Compiling capture in WebAssembly…
Learn FrameAssembly: Docs, Protocols & Labs — FrameAssembly