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.
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) typingsrcportanddstportonly once. - Watch
http(andtls,ssh,modbus, ...) inherit those ports and advance 32-bitseq/acknumautomatically. - Stamp real IEEE 802.1Q
vlan 100headers onto every frame without an OS driver eating them.
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.Change
dstport 80todstport 8080on the firsttcp synline. - 2.Add
vlan 100to all 5 lines insidecompile { ... }. - 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 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