# Verify IPv6 First-Hop Security (RA Guard, NDP, DHCPv6) & Dual-Stack

> **FrameAssembly v3.2.2** · Operational Playbook (IPv6, DDI & Campus NAC) · Canonical URL: https://frameassembly-lang.dev/use-cases/ipv6-ndp-dhcpv6-dual-stack-pcap

Write one parameterized flow(c, s) that runs over both IPv4 and IPv6 hosts—plus Hop-Limit-255 NDP and DHCPv6 SARR.

- **Category:** IPv6, DDI & Campus NAC
- **Capture Filename:** `ipv6_ndp_dualstack.frasm` (18 Ethernet frames)
- **Protocols Exercised:** `vlan`, `ndp`, `dhcp`, `dns`, `tcp`, `http2`

## Operational Problem

Most test captures sitting in team wikis are IPv4-only from 2014—leaving IPv6 RA Guard, DHCPv6 Guard, ICMPv6 pseudo-header rules, and IPv6 application firewall policies completely untested until production turn-up.

Crafting valid IPv6 packets by hand means recalculating 40-byte IPv6 pseudo-header checksums across ICMPv6/TCP/UDP, padding RFC 4861 SLLA/TLLA link-layer options to 8-byte boundaries, and remembering Hop Limit 255 on NDP so switches don’t drop frames as off-link spoofs.

In FrameAssembly, 78 of the 81 protocols morph between IPv4 and IPv6 automatically based solely on the `host` IP literal—so a single parameterized `flow api_probe(c, s)` emits both IPv4 (`0x0800`) and IPv6 (`0x86dd`) captures back-to-back.

## Scenario & Topology: Access VLAN 60 IPv6 SLAAC + DHCPv6 Guard Audit + Dual-Stack HTTP/2 Probe

- **Topology:** `Dual-Stack Client (10.60.1.25 / 2001:db8:60::25) <-> Leaf Switch & Gateway (10.60.1.1 / 2001:db8:60::1)`

Eighteen frames validate both first-hop IPv6 security and dual-stack parity: (1) Hop-Limit-255 `ndp` `routersolicit` -> `routeradvert` + `neighborsolicit` -> `neighboradvert` with SLLA/TLLA MAC TLVs; (2) 4-packet `dhcp` v6 `solicit -> advertise -> request -> reply` on UDP 546/547; and (3) one `dual_stack_http2(c, s)` flow invoked first on IPv4 hosts and then on IPv6 hosts (`flowlabel 0x60200`).

## FrameAssembly Workflow

Emits 18 frames: 4 RFC 4861 IPv6 NDP frames, 4 RFC 8415 DHCPv6 SARR frames, and a 5-frame DNS + TCP + HTTP/2 flow replayed across IPv4 and IPv6.

### Adapt It for Your Network

1. Update client_v6 and gw_v6 to your `2001:db8::` or production `/64` prefix and MACs.
2. To test switch RA Guard drops, emit an unauthorized `ndp routeradvert routerlifetime 1800` from an untrusted host port.
3. Compile -> verify both `ip` and `ipv6` protocol trees in Wireshark -> run against dual-stack firewall and IDS rules.

## Runnable Capture Specification (`ipv6_ndp_dualstack.frasm`)

```frameassembly
host client_v4 { ip 10.60.1.25       mac 00:1b:21:60:00:25 }
host gw_v4     { ip 10.60.1.1        mac 00:1c:73:60:00:01 }
host client_v6 { ip 2001:db8:60::25  mac 00:1b:21:60:00:25 }
host gw_v6     { ip 2001:db8:60::1   mac 00:1c:73:60:00:01 }

flow ipv6_first_hop_onboarding(host6, rtr6) {
    // 1. RFC 4861 Neighbor Discovery (Hop Limit 255 + SLLA / TLLA options)
    host6 -> rtr6 vlan 60 ndp routersolicit slla 00:1b:21:60:00:25 wait 2ms
    host6 <- rtr6 vlan 60 ndp routeradvert routerlifetime 1800 slla 00:1c:73:60:00:01 wait 3ms
    host6 -> rtr6 vlan 60 ndp neighborsolicit target 2001:db8:60::1 slla 00:1b:21:60:00:25 wait 1ms
    host6 <- rtr6 vlan 60 ndp neighboradvert target 2001:db8:60::1 tlla 00:1c:73:60:00:01 wait 2ms

    // 2. RFC 8415 Stateful DHCPv6 SARR on UDP 546 <-> 547
    host6 -> rtr6 vlan 60 dhcp solicit xid 0x006025 dnsserver 2001:db8:60::53 wait 2ms
    host6 <- rtr6 vlan 60 dhcp advertise xid 0x006025 dnsserver 2001:db8:60::53 wait 1ms
    host6 -> rtr6 vlan 60 dhcp request xid 0x006025 wait 1ms
    host6 <- rtr6 vlan 60 dhcp reply xid 0x006025 dnsserver 2001:db8:60::53 wait 4ms
}

flow dual_stack_http2(c, s) {
    // 3. Reusable flow: automatically emits IPv4 or IPv6 + pseudo-header checksums
    c -> s vlan 60 flowlabel 0x60200 dns query txid 0x6001 qname "api.dualstack.internal" qtype "AAAA" wait 2ms
    c -> s vlan 60 flowlabel 0x60200 tcp syn srcport 52443 dstport 443 win 65535 mss 1440 wait 1ms
    c <- s vlan 60 flowlabel 0x60200 tcp syn ack win 65535 mss 1440 wait 1ms
    c -> s vlan 60 flowlabel 0x60200 tcp ack wait 1ms
    c -> s vlan 60 flowlabel 0x60200 http2 settings wait 2ms
}

compile {
    ipv6_first_hop_onboarding(client_v6, gw_v6)
    dual_stack_http2(client_v4, gw_v4)
    dual_stack_http2(client_v6, gw_v6)
}
```

## Equivalent CLI Commands

```bash
# 1. Preview all 18 IPv6 NDP, DHCPv6, and dual-stack IPv4/IPv6 packets
frameassembly show ipv6_ndp_dualstack.frasm

# 2. Compile to nanosecond .pcapng and inspect ICMPv6 NDP + DHCPv6 options in tshark
frameassembly ipv6_ndp_dualstack.frasm ipv6_ndp_dualstack.pcapng
tshark -r ipv6_ndp_dualstack.pcapng

# 3. Replay onto an access trunk to verify RA Guard, DHCPv6 Guard, and dual-stack ACLs
sudo tcpreplay -i eth0 ipv6_ndp_dualstack.pcapng
```

## Protocol Reference Links

- [`vlan` — IEEE 802.1Q Virtual LAN Tagging & 802.1p QoS](https://frameassembly-lang.dev/docs/protocols/vlan) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/vlan.md))
- [`ndp` — IPv6 Neighbor Discovery Protocol](https://frameassembly-lang.dev/docs/protocols/ndp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/ndp.md))
- [`dhcp` — Dynamic Host Configuration Protocol — DHCPv4 & DHCPv6](https://frameassembly-lang.dev/docs/protocols/dhcp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/dhcp.md))
- [`dns` — Domain Name System over UDP or TCP](https://frameassembly-lang.dev/docs/protocols/dns) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/dns.md))
- [`tcp` — Transmission Control Protocol & RFC 7323 Options](https://frameassembly-lang.dev/docs/protocols/tcp) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/tcp.md))
- [`http2` — Hypertext Transfer Protocol Version 2 Binary Framing](https://frameassembly-lang.dev/docs/protocols/http2) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/http2.md))
