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.
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) specifyingsrcportanddstportonly once. - Let Layer 7 protocols (
http,tls,ssh,postgres) inherit ports and advance 32-bitseq/acknumcounters automatically. - Attach IEEE 802.1Q
vlan 100headers onto every frame to test trunk ACLs and inter-VLAN firewall policies.
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.Change
dstport 80todstport 8080on the openingtcp synline. - 2.Add
vlan 100to all 5 packet lines insidecompile { ... }. - 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 BreakdownLayer 2 VLAN tag + Layer 4 stateful TCP session opener:
client -> api_srv vlan 100 tcp syn srcport 51400 dstport 8080 win 65535 mss 1460vlan 100802.1Q TagInserts 4-byte 802.1Q header with VID 100 (0x8100)tcp synTCP FlagStarts connection at deterministic initial seq 1000srcport 51400 dstport 80804-Tuple PortsRemembered and auto-swapped across all <- / -> lines that followwin 65535 mss 1460TCP OptionsSets window size + Maximum Segment Size optionQuick Formatting Reference (2 rules)
| Item | Valid .frasm | Avoid |
|---|---|---|
| Port keywords | tcp syn srcport 51400 dstport 8080 | tcp syn sport 51400 dport 8080 |
| HTTP Host header | http get uri "/healthz" hosthdr "api.corp.local" | http get uri "/healthz" host "api.corp.local" |
vlan.id == 100 && tcp.port == 8080