Protocol 37 of 81Layer 7FrameAssembly v3.1.2
llms-full.txt
dhcpDynamic Host Configuration Protocol — DHCPv4 & DHCPv6

Full DORA Lease Dance & Rogue Server Checks (client <-> dhcp_srv dhcp)

Default Port / Protocol
UDP 68/67 (DHCPv4) · UDP 546/547 (DHCPv6)
Host Endpoint Rule
Dual-Stack Morphing (v4/v6)
Wireshark Display Filter
dhcp || dhcpv6
Standards & Specs
RFC 2131, RFC 2132, RFC 8415
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6UDP 68/67 (DHCPv4) · UDP 546/547 (DHCPv6)DHCPv4 / DHCPv6

What It Does on the Wire

Test switch DHCP Snooping without plugging a rogue home router into the wall: dhcp builds BOOTP + magic cookie 0x63825363 Option TLVs on IPv4 (68 <-> 67) and morphs into DHCPv6 (546 <-> 547) over IPv6.

Dynamic Host Configuration Protocol (dhcp) is a dual-stack morphing protocol in FrameAssembly: over IPv4 endpoints, it compiles a 240-byte RFC 2131 BOOTP header + magic cookie 63:82:53:63 + TLV Options (53 Message Type, 1 Subnet Mask, 3 Router, 6 DNS, 12 Hostname, 51 Lease Time, 255 End) on UDP 68 <-> 67. Over IPv6 endpoints, it automatically morphs into RFC 8415 DHCPv6 (solicit, advertise, request, reply, release) with 24-bit Transaction ID and Client/Server DUID options on UDP 546 <-> 547.

Switch DHCP Snooping, Option 82 & Rogue DHCP Server Audits

Test Catalyst/Arista ip dhcp snooping untrusted-port drops by replaying dhcp offer and dhcp ack frames from unauthorized ports.

Full 4-Packet DHCPv4 DORA & IP Helper Relay Validation

Verify Discover -> Offer -> Request -> Ack lease allocation including yiaddr, subnetmask, router, dnsserver, and leasetime TLV decoding.

IPv6 Stateful DHCPv6 SARR (solicit / advertise / request / reply) Labs

Validate DHCPv6 Guard (ipv6 dhcp guard) and 546 <-> 547 firewall rules across enterprise dual-stack access networks.

Minimal Quickstart (dhcp_quickstart.frasm)

Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.

dhcp_quickstart.frasm7 lines
Open in Playground
host client_pc { ip 0.0.0.0 mac 00:1b:21:44:55:66 }
host dhcp_srv { ip 10.10.10.1 mac 00:1b:21:00:00:01 }
compile {
client_pc -> dhcp_srv dhcp discover xid 0x3903f326 chaddr 00:1b:21:44:55:66 hostname "eng-laptop-04" wait 2ms
client_pc <- dhcp_srv dhcp offer xid 0x3903f326 yiaddr 10.10.10.150 siaddr 10.10.10.1 chaddr 00:1b:21:44:55:66 subnetmask 255.255.255.0 router 10.10.10.1 dnsserver 10.10.10.53 leasetime 86400
}

What the Compiler Calculates So You Don't Have To

  • Selects UDP 68 -> 67 for client messages (discover, request, release) and UDP 67 -> 68 for server messages (offer, ack) on IPv4—or UDP 546 <-> 547 on IPv6.
  • Writes the 4-byte RFC 2132 DHCP magic cookie (0x63825363), packs every specified option TLV (1, 3, 6, 12, 51, 53), and terminates with Option 255 (0xff).
  • Defaults chaddr to the sending host's Ethernet MAC when omitted so BOOTP hardware fields stay consistent.
Multi-Frame Lab · Ready to Compile

Complete 4-Step DHCPv4 DORA Lease Workflow + DHCPv6 SARR Exchange

Captures a full 4-frame IPv4 discover -> offer -> request -> ack cycle on VLAN 10 followed by a 4-frame IPv6 solicit -> advertise -> request -> reply exchange.

dhcp_v4_dora_and_v6_sarr.frasm17 lines
Open in Playground
host phone_v4 { ip 0.0.0.0 mac 00:50:56:aa:10:01 }
host srv_v4 { ip 10.20.10.1 mac 00:50:56:aa:00:01 }
host host_v6 { ip fe80::25 mac 00:50:56:bb:10:25 }
host srv_v6 { ip fe80::1 mac 00:50:56:bb:00:01 }
compile {
// 1. DHCPv4 DORA on VLAN 10 (UDP 68 <-> 67)
phone_v4 -> srv_v4 dhcp discover xid 0x77889900 chaddr 00:50:56:aa:10:01 hostname "voip-desk-12" vlan 10 wait 2ms
phone_v4 <- srv_v4 dhcp offer xid 0x77889900 yiaddr 10.20.10.112 siaddr 10.20.10.1 chaddr 00:50:56:aa:10:01 subnetmask 255.255.255.0 router 10.20.10.1 dnsserver 10.20.10.53 leasetime 43200 vlan 10 wait 1ms
phone_v4 -> srv_v4 dhcp request xid 0x77889900 chaddr 00:50:56:aa:10:01 hostname "voip-desk-12" vlan 10 wait 1ms
phone_v4 <- srv_v4 dhcp ack xid 0x77889900 yiaddr 10.20.10.112 siaddr 10.20.10.1 chaddr 00:50:56:aa:10:01 subnetmask 255.255.255.0 router 10.20.10.1 dnsserver 10.20.10.53 leasetime 43200 vlan 10 wait 5ms
// 2. DHCPv6 SARR over IPv6 link-local endpoints (UDP 546 <-> 547)
host_v6 -> srv_v6 dhcp solicit xid 0x00a1b2c3 dnsserver 2001:db8:20::53 wait 2ms
host_v6 <- srv_v6 dhcp advertise xid 0x00a1b2c3 dnsserver 2001:db8:20::53 wait 1ms
host_v6 -> srv_v6 dhcp request xid 0x00a1b2c3 wait 1ms
host_v6 <- srv_v6 dhcp reply xid 0x00a1b2c3 dnsserver 2001:db8:20::53
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show dhcp_v4_dora_and_v6_sarr.frasm

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

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

All dhcp Keywords & Header Options

Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after dhcp:

src_host -> dst_host dhcp [discover | offer | request | ack | release | solicit | advertise | reply] [xid <number>] [ciaddr <ipv4>] [yiaddr <ipv4>] [siaddr <ipv4>] [chaddr <mac>] [subnetmask <ipv4>] [router <ipv4>] [dnsserver <ip>] [leasetime <number>] [hostname "<text>"]
Keyword / OptionAccepted ValueDefaultEffect on Packet
discover | offer | request | ack | release | solicit | advertise | replyDHCPv4 / DHCPv6 message type keyworddiscover (IPv4) / solicit (IPv6)Sets DHCPv4 Option 53 + BOOTP op (1 request, 2 reply) or DHCPv6 msg-type (1 Solicit, 2 Advertise, 3 Request, 7 Reply, 8 Release).
xid <number>Whole number (24-bit in DHCPv6)0x12345678Sets BOOTP xid (4 bytes) or DHCPv6 transaction-id (lower 3 bytes).
ciaddr <ipv4> | yiaddr <ipv4> | siaddr <ipv4>IPv4 dotted-quad literals0.0.0.0Sets Client IP, Your (offered) IP, and Next Server IP in the DHCPv4 BOOTP header.
chaddr <mac>Colon, hyphen, or Cisco dot MACSource host MACPopulates the 16-byte Client Hardware Address field in DHCPv4.
subnetmask <ipv4> | router <ipv4> | dnsserver <ip>IPv4/IPv6 address literalsOmittedAppends Option 1 (Subnet Mask), Option 3 (Router), and Option 6 / DHCPv6 Option 23 (DNS Recursive Name Server).
leasetime <number> | hostname "<text>"u32 seconds, UTF-8 stringleasetime 86400Appends Option 51 (IP Address Lease Time) and Option 12 (Host Name).

Cross-Layer Wrappers Valid with dhcp

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

10 options
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac>Colon, hyphen, or Cisco dot MACHost MAC / RFC multicast MACOverrides the 14-byte Ethernet II source or destination MAC address for this single packet.
vlan <0..4095> [pcp <0..7>] [dei <0|1>]VLAN ID 0..4095, PCP 0..7, DEI 0..1UntaggedWraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority.
qinq <0..4095> [innervlan <0..4095>]Outer S-VLAN 0..4095, Inner C-VLAN 0..4095Untagged (innervlan 1 when qinq is set)Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100).
mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255Unlabeled (at most 1 mpls tag per packet)Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header.
ttl <0..255> [dscp <0..63>] [ecn <0..3>]TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3ttl 64, dscp 0, ecn 0Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings.
ipid <0..65535> [df] [mf] [fragoffset <0..8191>]IPv4 ID, DF/MF flags, fragment offset 0..8191ipid 1, flags 0, fragoffset 0Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6).
flowlabel <0..1048575>20-bit IPv6 Flow Label (0..1048575)0Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts).
srcport <0..65535> | dstport <0..65535>Port number 0..65535srcport 49152 (remembered), UDP 68/67 (DHCPv4) · UDP 546/547 (DHCPv6)Overrides source or destination port and remembers the port pair automatically on <- replies.

Gotchas & Quick Fixes

Both Endpoints Still Require IP Literals (Use 0.0.0.0 for Unconfigured DHCPv4 Clients)

Avoid
host client_pc { mac 00:1b:21:44:55:66 } client_pc -> dhcp_srv dhcp discover
Valid v3.1.2 Syntax
host client_pc { ip 0.0.0.0 mac 00:1b:21:44:55:66 } client_pc -> dhcp_srv dhcp discover

Because DHCP runs inside IPv4/UDP or IPv6/UDP, FrameAssembly requires an ip address on both hosts. Use ip 0.0.0.0 (the standard RFC 2131 pre-lease source IP) on unconfigured IPv4 clients, or a fe80::... link-local address on IPv6 clients.

Use ack (Not dhcp_ack) for DHCPACK Replies

Avoid
client_pc <- dhcp_srv dhcp dhcp_ack xid 0x1234
Valid v3.1.2 Syntax
client_pc <- dhcp_srv dhcp ack xid 0x1234

On a dhcp line, ack sets DHCP Option 53 to DHCPACK (5) over UDP 67 -> 68 rather than a TCP flag.

Field Guide 04
Encrypted SNMPv3 Traps, Syslog & NetFlow From Your Desk