Chapter 3: VLAN Tags & Stateful TCP (syn -> syn ack -> ack)

Build 802.1Q-tagged TCP sessions where sequence numbers and ports track themselves so stateful firewalls and Suricata actually inspect your payload.

Labs completed0/7
The Situation · 6 min

You need to prove VLAN 100 clients can hit an internal API on TCP 8080, and laptop NIC drivers keep stripping 802.1Q tags from live captures.

What You'll Pull Off Here

  • Open a 3-way handshake (syn -> syn ack -> ack) typing srcport and dstport only once.
  • Watch http (and tls, ssh, modbus, ...) inherit those ports and advance 32-bit seq / acknum automatically.
  • Stamp real IEEE 802.1Q vlan 100 headers onto every frame without an OS driver eating them.
Interactive Lab Check

Lab 3: Move the Session onto vlan 100 & dstport 8080

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

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

1. Why Firewalls & Suricata Ignore Lone Spoofed Packets

Toss a naked HTTP GET or TLS ClientHello at a FortiGate, Palo Alto, or Suricata (flow:established,to_server;) and it goes straight in the trash: no 3-way handshake, no session state.

In FrameAssembly, three quick lines (syn, syn ack, ack) open the session. Type srcport and dstport once on the syn, and every <- and -> line after that remembers the port pair and counts payload bytes into seq and acknum for you.

2. 802.1Q vlan Tags & Why HTTP Uses hosthdr

Adding vlan 100 wedges a real 4-byte 0x8100 tag right between Ethernet II and IP.

One deliberate quirk: because host is already taken at the top of the file to declare network boxes, HTTP and SSDP use hosthdr "api.corp.local" for the 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 .frasm — Labs, Guides & 81 Protocols | FrameAssembly