# Layer 7 DNS, DHCP, Time, AAA & Flow Telemetry

> **FrameAssembly v3.2.2** · Category 05 (Layer 7 · 11 Protocols) · Canonical URL: https://frameassembly-lang.dev/docs/protocols/categories/l7-infra-telemetry

Core DDI (DNS, mDNS, DHCPv4/v6), precision timekeeping (NTPv4, IEEE 1588v2 PTP), network access AAA (RADIUS, TACACS+), structured SIEM logging (RFC 5424 Syslog), and flow collectors (NetFlow v5, IPFIX, sFlow v5) form the operational backbone of campus and data-center telemetry.

FrameAssembly encodes every binary option, port swap, and template dependency automatically—including BOOTP `63:82:53:63` magic cookies, 63-byte RFC 1035 DNS label bounds, independent 8-bit TACACS+ header sequence numbers, self-templated IPv4/IPv6 IPFIX Set 2 + Set 256 datagrams, and `1ns` `IfTsResol=9` `.pcapng` clock deltas for PTPv2.

## Category Wire & Endpoint Rules

- **Dynamic Client/Server Port Swaps:** `dhcp` selects UDP `68 <-> 67` (IPv4) or `546 <-> 547` (IPv6) by message type; `ptp` selects UDP `319` (`sync`/`delayreq`) vs. `320` (`followup`/`delayresp`/`announce`); `radius` selects `1812` (Auth) vs. `1813` (Accounting).
- **Self-Describing IPFIX Templates:** Every `ipfix` packet bundles Template Set `2` alongside Data Set `256` in a single UDP `4739` datagram so Wireshark, ElastiFlow, and Akvorado decode flows immediately with zero external cache wait.
- **Compile-Time RFC 1035 DNS Label Checks:** `dns` and `mdns` enforce label length `<= 63` bytes and total domain length `<= 253` bytes at compile time; `dns transport tcp` prepends the 2-byte RFC 1035 TCP length field automatically.
- **Nanosecond `.pcapng` for IEEE 1588v2 PTP:** Combine sub-microsecond `wait 250ns` / `wait 50us` modifiers with `.pcapng` output (`IfTsResol=9`) to preserve hardware-grade PTPv2 timestamps.

## Multi-Protocol Example: DHCPv4 DORA, DNS Lookup, RADIUS Accept, PTPv2 Sync & IPFIX Export (`infra_ddi_aaa_telemetry.frasm`)

Exercises UDP 68/67 DHCPv4 DORA onboarding, port 53 DNS A-record resolution, UDP 1812 RADIUS Access-Accept, sub-millisecond IEEE 1588v2 PTP Sync + Follow_Up, and self-templated UDP 4739 IPFIX telemetry.

```frameassembly
host client    { ip 10.30.10.50 }
host infra_srv { ip 10.30.10.10 }

compile {
    client -> infra_srv dhcp discover xid 0x77889900 hostname "eng-laptop" wait 2ms
    client <- infra_srv dhcp offer xid 0x77889900 yiaddr 10.30.10.50 router 10.30.10.1 dnsserver 10.30.10.10 leasetime 86400 wait 2ms
    client -> infra_srv dns query txid 0x3101 qname "git.corp.internal" qtype "A" wait 1ms
    client <- infra_srv dns response txid 0x3101 qname "git.corp.internal" qtype "A" rdata "10.30.20.44" ansttl 300 wait 2ms
    client -> infra_srv radius accessrequest id 12 user "alice" nasip 10.30.10.1 wait 2ms
    client <- infra_srv radius accessaccept id 12 framedip 10.30.10.50 wait 500us
    infra_srv -> client ptp sync domain 0 seqid 42 wait 250ns
    infra_srv -> client ptp followup domain 0 seqid 42 wait 1ms
    client -> infra_srv ipfix domainid 1 srcip 10.30.10.50 dstip 10.30.20.44 srcport 51420 dstport 443 proto 6 packets 48 octets 64200
}
```

```bash
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show infra_ddi_aaa_telemetry.frasm

# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly infra_ddi_aaa_telemetry.frasm infra_ddi_aaa_telemetry.pcap
frameassembly infra_ddi_aaa_telemetry.frasm infra_ddi_aaa_telemetry.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse infra_ddi_aaa_telemetry.pcap infra_ddi_aaa_telemetry_edited.frasm

# 4. Verify dissected protocol fields in tshark
tshark -r infra_ddi_aaa_telemetry.pcap -Y "dhcp || dns || radius || ptp || cflow"
```

- **Wireshark Display Filter:** `dhcp || dns || radius || ptp || cflow`

## Protocols in Category 05 (11 Native Builders)

| # | Keyword | Protocol | Default Port / Proto | Endpoint Rule | Wireshark Filter | Spec URL |
| --- | --- | --- | --- | --- | --- | --- |
| 35 | `dns` | Domain Name System over UDP or TCP | `UDP 53 (or TCP 53 via transport tcp)` | Dual-Stack IPv4/IPv6 | `dns` | https://frameassembly-lang.dev/docs/protocols/dns |
| 36 | `mdns` | Multicast DNS Zero-Configuration Discovery | `UDP 5353 -> 5353 (224.0.0.251 / ff02::fb)` | Dual-Stack IPv4/IPv6 | `mdns` | https://frameassembly-lang.dev/docs/protocols/mdns |
| 37 | `dhcp` | Dynamic Host Configuration Protocol — DHCPv4 & DHCPv6 | `UDP 68/67 (DHCPv4) · UDP 546/547 (DHCPv6)` | Dual-Stack Morphing (v4/v6) | `dhcp \|\| dhcpv6` | https://frameassembly-lang.dev/docs/protocols/dhcp |
| 38 | `ntp` | Network Time Protocol v1–v4 | `UDP 123` | Dual-Stack IPv4/IPv6 | `ntp` | https://frameassembly-lang.dev/docs/protocols/ntp |
| 39 | `ptp` | IEEE 1588 Precision Time Protocol v2 | `UDP 319 (Event) / UDP 320 (General)` | Dual-Stack IPv4/IPv6 | `ptp` | https://frameassembly-lang.dev/docs/protocols/ptp |
| 40 | `radius` | Remote Authentication Dial-In User Service (Auth & Accounting) | `UDP 1812 (Auth) / UDP 1813 (Accounting)` | Dual-Stack IPv4/IPv6 | `radius` | https://frameassembly-lang.dev/docs/protocols/radius |
| 41 | `tacacs` | Terminal Access Controller Access-Control System Plus | `TCP 49` | Dual-Stack IPv4/IPv6 | `tacplus` | https://frameassembly-lang.dev/docs/protocols/tacacs |
| 42 | `syslog` | Syslog Event Logging over UDP or TCP | `UDP 514 (or TCP 514 via transport tcp)` | Dual-Stack IPv4/IPv6 | `syslog` | https://frameassembly-lang.dev/docs/protocols/syslog |
| 43 | `netflow` | Cisco NetFlow Version 5 Flow Export | `UDP 2055` | Dual-Stack IPv4/IPv6 | `cflow` | https://frameassembly-lang.dev/docs/protocols/netflow |
| 44 | `ipfix` | IP Flow Information Export (NetFlow v10) | `UDP 4739` | Dual-Stack IPv4/IPv6 | `cflow.version == 10` | https://frameassembly-lang.dev/docs/protocols/ipfix |
| 45 | `sflow` | sFlow Version 5 Switched & Routed Packet Sampling | `UDP 6343` | Dual-Stack IPv4/IPv6 | `sflow` | https://frameassembly-lang.dev/docs/protocols/sflow |
