Protocol 26 of 81Layer 3FrameAssembly v3.3.0
Raw .mdllms-full.txt
ipipIP-in-IP & IPv6-in-IPv4 Tunneling

ipip — RFC 2003 IP-in-IP (Proto 4) & 6in4 (Proto 41) Tunnels

Default Port / Protocol
IP Proto 4 (IPv4) / 41 (IPv6)
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
ip.proto == 4 || ip.proto == 41
Standards & Specs
RFC 2003, RFC 4213, RFC 2473
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6IP-in-IP (RFC 2003 / 4213) (IP Proto 4 (IPv4) / 41 (IPv6))
L2 Tagging: vlan · qinq · repeatable mpls · fcsHost Family: Dual-Stack IPv4/IPv6L3 QoS & TTL: ttl · dscp · ecnL4 State: L3 IP / ICMPv6

What It Does on the Wire

Zero GRE shim, zero UDP ports — ipip wraps an inner IPv4 (Proto 4) or IPv6 (Proto 41) header straight inside outer IP for Kubernetes Calico pod overlays and Katran L4 DSR load balancers.

IP-in-IP (ipip, RFC 2003 / RFC 4213 / RFC 2473) encapsulates a complete inner IPv4 (IP Protocol 4) or IPv6 (IP Protocol 41) header directly inside an outer IPv4 or IPv6 delivery packet with zero GRE or UDP shim overhead. It underpins Kubernetes Calico IPIP pod networking, Katran / Maglev L4 Direct Server Return (DSR) load balancers, 6in4 / 4in6 dual-stack transition tunnels, and DDoS scrubbing return pipes.

FrameAssembly automatically sets the outer IP Protocol / Next Header to 4 for inner IPv4 (v4) or 41 for inner IPv6 (v6), formats the 20-byte inner IPv4 header (with valid RFC 1071 inner header checksum) or 40-byte inner IPv6 header, and lets you control srcip, dstip, innerttl, innerdscp, and inner proto independently of the outer tunnel header.

01. Application

Kubernetes Calico IPIP Cross-Subnet Pod Overlay Audits

Verify cloud security groups and underlay ToR switch ACLs permit IP Protocol 4 (ipencap) between worker node underlay IPs carrying inner 10.244.0.0/16 pod addresses.

02. Application

L4 Load Balancer VIP Direct Server Return (Katran / IPVS)

Simulate Maglev/Katran edge directors encapsulating client VIP packets inside ipip (v4 or v6) toward backend real servers while preserving client srcip and VIP dstip.

03. Application

RFC 4213 6in4 & RFC 2473 Dual-Stack Transition Tunnels

Encapsulate inner IPv6 headers (ipip v6 srcip 2001:db8::1 dstip 2001:db8::2) inside outer IPv4 endpoints (IP Protocol 41) to test Hurricane Electric-style 6in4 firewall rules.

Fig. 1 · RFC Octet & Bit Schematic

RFC Wire Header Layout (ipip)

Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.

0 ··············· 15 · 16 ··············· 31 bit
Selected Wire Segment
IP-in-IP (RFC 2003 / 4213) Wire PDU & Payload (Variable)
Controlling .frasm Modifiers
ipip v4 · srcip · innerttl · innerdscp · proto · payload · hexpayload
Compiler Default Behavior
RFC-compliant IP-in-IP (RFC 2003 / 4213) defaults (RFC 2003)

Minimal Quickstart (ipip_quickstart.frasm)

Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.

ipip_quickstart.frasm6 lines
Open in Playground
host k8s_node_a { ip 172.16.10.11 }
host k8s_node_b { ip 172.16.20.22 }
compile {
k8s_node_a -> k8s_node_b ipip v4 srcip 10.244.1.15 dstip 10.244.2.40 innerttl 63 proto 6 payload "calico-pod-probe"
}

Handled Automatically on the Wire

  • Sets outer IPv4 Protocol / IPv6 Next Header to 4 (IPIP) when the inner header is IPv4 or 41 (IPv6 encapsulation) when v6 / version 6 or IPv6 srcip/dstip is selected.
  • Computes both the inner IPv4 RFC 1071 header checksum (innerttl, innerdscp, proto, inner total length) and the outer delivery IPv4 checksum automatically.
  • Supports cross-family encapsulation—such as inner IPv6 (v6) carried over outer IPv4 hosts (6in4) or inner IPv4 (v4) carried over outer IPv6 hosts (4in6).
Multi-Frame Example

L4 Load Balancer Direct Server Return (4in4) & 6in4 Transition Tunnel

Captures a Katran L4 edge director forwarding an encapsulated IPv4 client request (IP Proto 4) to a real server, followed by an RFC 4213 6in4 (IP Proto 41) tunnel packet over the same IPv4 fabric.

ipip_dsr_and_6in4.frasm9 lines
Open in Playground
host lb_director { ip 192.0.2.10 mac 00:1c:73:aa:00:01 }
host real_srv_01 { ip 192.0.2.55 mac 00:1c:73:bb:00:55 }
compile {
// 1. Katran 4in4 DSR: outer lb_director -> real_srv_01 (IP Proto 4), inner client -> anycast VIP
lb_director -> real_srv_01 ipip v4 srcip 198.51.100.42 dstip 203.0.113.10 innerttl 60 innerdscp 34 proto 6 ttl 64 df payload "VIP-SYN-PROBE" wait 2ms
// 2. RFC 4213 6in4 tunnel: outer IPv4 (IP Proto 41) carrying inner IPv6 2001:db8:: endpoints
lb_director -> real_srv_01 ipip v6 srcip 2001:db8:cafe::42 dstip 2001:db8:beef::10 innerttl 62 innerdscp 46 proto 58 payload "ICMPv6-INSIDE-IPV4"
}
Terminal Commands (FrameAssembly CLI v3.3.0)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show ipip_dsr_and_6in4.frasm

# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly ipip_dsr_and_6in4.frasm ipip_dsr_and_6in4.pcap
frameassembly ipip_dsr_and_6in4.frasm ipip_dsr_and_6in4.pcapng

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

# 4. Verify dissected protocol fields in tshark
tshark -r ipip_dsr_and_6in4.pcap -Y "ip.proto == 4 || ip.proto == 41"

All ipip 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 ipip:

src_host -> dst_host ipip [v4 | v6 | version <4|6>] [srcip <ip>] [dstip <ip>] [innerttl <0..255>] [innerdscp <0..63>] [proto <0..255>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
v4 | v6 | version <4|6>Inner IP version selector (4 or 6)Matches inner srcip/dstip or outer host family (v4)Selects a 20-byte inner IPv4 header (outer proto 4) or 40-byte inner IPv6 header (outer proto 41).
srcip <ip> | dstip <ip>IPv4 or IPv6 literal matching inner version10.0.0.1 -> 10.0.0.2 (v4) or 2001:db8::1 -> 2001:db8::2 (v6)Writes the inner encapsulated source and destination IP addresses.
innerttl <0..255>8-bit inner TTL / Hop Limit (0..255)64Sets the inner IPv4 TTL or inner IPv6 Hop Limit independently of outer ttl.
innerdscp <0..63>6-bit inner DiffServ codepoint (0..63)0Sets the upper 6 bits of the inner IPv4 TOS byte or inner IPv6 Traffic Class.
proto <0..255>8-bit IANA protocol number (0..255)59 (No Next Header on v6) / 6 or 17 / raw payloadSets the inner IPv4 Protocol or inner IPv6 Next Header byte (1=ICMP, 6=TCP, 17=UDP, 58=ICMPv6).

Cross-Layer Wrappers Valid with ipip

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

11 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).
comment "<text>"Quoted UTF-8 annotationOmittedAttaches an Enhanced Packet Block opt_comment annotation when compiling to .pcapng (Wireshark pkt_comment filter).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef", "de:ad:be:ef", or "\x01\x02") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac> | ethertype <0..65535>Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800)Host MAC / RFC multicast MAC / auto EtherTypeOverrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType.
fcs | badfcsEthernet CRC-32 trailer flags (choose one)Omittedfcs appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; badfcs XOR-corrupts the CRC-32 for NIC/tap negative tests.
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> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255)Unlabeled (auto bos=0 on outer labels, bos=1 on bottom)Prepends one or more 32-bit MPLS label shims (0x8847, e.g. mpls 16000 mpls 24010) ahead of Layer 2 EoMPLS or Layer 3 payloads.
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>] [routeralert] [badipchecksum]IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum faultipid 1, flags 0, fragoffset 0, valid RFC 1071 checksumSets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (20 04 00 00), or corrupts the 16-bit IPv4 header checksum (badipchecksum).
flowlabel <0..1048575>20-bit IPv6 Flow Label (0..1048575)0Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only).

Gotchas & Quick Fixes

Use innerttl and innerdscp for the Encapsulated Header

Rejected
node1 -> node2 ipip v4 srcip 10.1.0.1 dstip 10.2.0.1 ttl 63
Valid v3.3.0 Syntax
node1 -> node2 ipip v4 srcip 10.1.0.1 dstip 10.2.0.1 innerttl 63 ttl 255

Bare ttl and dscp control the outer delivery IP header, while innerttl and innerdscp control the encapsulated inner IP header.

Keep Inner srcip and dstip in the Same Address Family

Rejected
node1 -> node2 ipip v6 srcip 10.1.0.1 dstip 2001:db8::2
Valid v3.3.0 Syntax
node1 -> node2 ipip v6 srcip 2001:db8::1 dstip 2001:db8::2

While outer hosts can be IPv4 and inner addresses IPv6 (6in4), both inner srcip and dstip must belong to the selected inner IP version (v4 or v6).

Field Guide 05
VLANs, QinQ, MPLS, Tunnel Soup & Dual-Stack IPv6