IPv4 (ipv4)
- Layer: L3 (network)
- Header: variable length
- Pseudo header: supplies
src/dstto upper-layer checksums - Notes: Encapsulation and tunnels, IS-IS (P2), MACsec / GTPv2-C / Diameter / SIP / RTP (P2), LDP / RSVP-TE / BFD (P2), Multicast control protocols, User-defined protocols (protocols.d)
Reached from
| Lower layer | Selector | Value |
|---|---|---|
ethernet2 | ethertype | 2048 (0x0800) |
dot1q | ethertype | 2048 (0x0800) |
dot1ad | ethertype | 2048 (0x0800) |
snap | pid | 2048 (0x0800) |
ipv4 | protocol | 4 (0x04) |
ipv6 | next_header | 4 (0x04) |
ipv6_hopopts | next_header | 4 (0x04) |
ipv6_route | next_header | 4 (0x04) |
ipv6_srh | next_header | 4 (0x04) |
ipv6_frag | next_header | 4 (0x04) |
ipv6_dstopts | next_header | 4 (0x04) |
ppp | protocol | 33 (0x0021) |
gre | protocol_type | 2048 (0x0800) |
mpls | First 4 bits of the payload when s = 1 | 4 |
gtpu | First 4 bits of the payload when message_type = 255 (0xff) | 4 |
geneve | protocol_type | 2048 (0x0800) |
pim_register | First 4 bits of the payload when type = 1 | 4 |
Fields
| Field | Type | Default | Auto | Description |
|---|---|---|---|---|
version | uint(4) | 4 | IP version, always 4. | |
ihl | uint(4) | Length of the header in 32-bit words | Header length in 32-bit words, 5 to 15 (Auto, includes the options). | |
dscp | uint(6) | 0 | Differentiated services code point (QoS class, 0 to 63). | |
ecn | uint(2) | 0 | Explicit congestion notification (0 = not ECT, 1 / 2 = ECT, 3 = CE). | |
total_length | uint(16) | Length of the header and payload in octets | Total length of header and payload in octets (Auto). | |
identification | uint(16) | 0 | Identification shared by the fragments of one datagram. | |
flags | flags(3) | 0x0 | Flags: DF (don’t fragment) and MF (more fragments); the top bit is reserved. | |
frag_offset | uint(13) | 0 | Offset of this fragment in 8-octet units. | |
ttl | uint(8) | 64 | Time to live; decremented at every router, 0 is never sent. | |
protocol | enum(8) | 253 (experimental) | Protocol number of the next layer (see Next layer) | Protocol number of the next layer (Auto; 253 = experimental when none is known). |
header_checksum | uint(16) | Internet checksum over the header | Internet checksum over the header (Auto). | |
src | ipv4 | 192.0.2.1 | Source IPv4 address. | |
dst | ipv4 | 192.0.2.2 | Destination IPv4 address. | |
options | tlv — ihl * 4 - 20 octets | IPv4 options as TLVs (EOL, NOP, security, record route, timestamp…). | ||
padding | padding(4) | Zero padding of the options to a 32-bit boundary (Auto). |
flags
| Bit | Mask | Name |
|---|---|---|
| 2 | 4 | reserved |
| 1 | 2 | df |
| 0 | 1 | mf |
protocol
| Value | Name |
|---|---|
| 1 (0x01) | icmp |
| 2 (0x02) | igmp |
| 4 (0x04) | ipip |
| 6 (0x06) | tcp |
| 17 (0x11) | udp |
| 41 (0x29) | ipv6 |
| 46 (0x2e) | rsvp |
| 47 (0x2f) | gre |
| 50 (0x32) | esp |
| 51 (0x33) | ah |
| 58 (0x3a) | ipv6_icmp |
| 88 (0x58) | eigrp |
| 89 (0x59) | ospf |
| 103 (0x67) | pim |
| 112 (0x70) | vrrp |
| 115 (0x73) | l2tp |
| 132 (0x84) | sctp |
| 253 (0xfd) | experimental |
options
- Type 8 bits, length 8 bits.
- The length counts the type and length fields too.
- Unknown types are kept as raw value octets.
| Type | Name | Value fields | Description |
|---|---|---|---|
| 0 (0x00) | eol | (type only, no length or value) | |
| 1 (0x01) | nop | (type only, no length or value) | |
| 148 (0x94) | router_alert | value |
options › router_alert
| Field | Type | Default | Auto | Description |
|---|---|---|---|---|
value | uint(16) |
Next layer
The next layer is selected by protocol; when the field is Auto the builder writes the value of the protocol stacked above.
| Value | Protocol | Note |
|---|---|---|
| 1 (0x01) | icmpv4 | |
| 2 (0x02) | igmp | |
| 4 (0x04) | ipv4 | |
| 6 (0x06) | tcp | |
| 17 (0x11) | udp | |
| 41 (0x29) | ipv6 | |
| 46 (0x2e) | rsvp | |
| 47 (0x2f) | gre | |
| 88 (0x58) | eigrp | |
| 89 (0x59) | ospfv2 | |
| 103 (0x67) | pim | |
| 103 (0x67) | pim_register | |
| 112 (0x70) | vrrpv3 | |
| 112 (0x70) | vrrpv2 | |
| 115 (0x73) | l2tpv3 | |
| 132 (0x84) | sctp |
Constraints
| Level | Rule |
|---|---|
| warning | version = 4 |
| error | ihl within 5..15 |
| warning | ttl ≠ 0 |
Sample templates
- interop-bfd-session-up —
templates/interop/bfd-session-up.wpg.yaml - interop-ldp-link-hello —
templates/interop/ldp-link-hello.wpg.yaml - interop-ospfv2-hello-2way —
templates/interop/ospfv2-hello-2way.wpg.yaml - interop-pim-hello-neighbor —
templates/interop/pim-hello-neighbor.wpg.yaml - interop-ripv2-response-route —
templates/interop/ripv2-response-route.wpg.yaml - interop-vrrpv3-preempt —
templates/interop/vrrpv3-preempt.wpg.yaml - bad-fcs —
templates/malformed/bad-fcs.wpg.yaml - bad-ipv4-checksum —
templates/malformed/ipv4-bad-checksum.wpg.yaml - bad-ipv4-ihl —
templates/malformed/ipv4-bad-ihl.wpg.yaml - bad-ipv4-total-length —
templates/malformed/ipv4-total-length-too-long.wpg.yaml - bad-ipv4-total-length-short —
templates/malformed/ipv4-total-length-too-short.wpg.yaml - truncated-ipv4-udp —
templates/malformed/ipv4-truncated.wpg.yaml - bad-tcp-checksum —
templates/malformed/tcp-bad-checksum.wpg.yaml - bad-udp-checksum —
templates/malformed/udp-bad-checksum.wpg.yaml - bad-udp-length —
templates/malformed/udp-bad-length.wpg.yaml - 6in4 —
templates/protocols/encap/6in4.wpg.yaml - ipip —
templates/protocols/encap/ipip.wpg.yaml - frame-with-fcs —
templates/protocols/frame/fcs-auto.wpg.yaml - jumbo-frame-9000 —
templates/protocols/frame/jumbo-9000.wpg.yaml - dot1ad-qinq-frame —
templates/protocols/l2/dot1ad.wpg.yaml - dot1q-frame —
templates/protocols/l2/dot1q.wpg.yaml - dot3-llc-snap-frame —
templates/protocols/l2/dot3-llc-snap.wpg.yaml - icmpv4-echo-request —
templates/protocols/l3/icmpv4-echo.wpg.yaml - ipv4-dscp-ecn-matrix —
templates/protocols/l3/ipv4-dscp-ecn-matrix.wpg.yaml - ipv4-fragments —
templates/protocols/l3/ipv4-fragment.wpg.yaml - ipv4-router-alert —
templates/protocols/l3/ipv4-router-alert.wpg.yaml - ipv4-udp —
templates/protocols/l3/ipv4.wpg.yaml - sctp-abort —
templates/protocols/l4/sctp-abort.wpg.yaml - sctp-data —
templates/protocols/l4/sctp-data.wpg.yaml - sctp-heartbeat —
templates/protocols/l4/sctp-heartbeat.wpg.yaml - sctp-init-ack —
templates/protocols/l4/sctp-init-ack.wpg.yaml - sctp-init —
templates/protocols/l4/sctp-init.wpg.yaml - sctp-over-udp —
templates/protocols/l4/sctp-over-udp.wpg.yaml - sctp-sack —
templates/protocols/l4/sctp-sack.wpg.yaml - tcp-data-psh-ack —
templates/protocols/l4/tcp-data.wpg.yaml - tcp-syn-options —
templates/protocols/l4/tcp-syn.wpg.yaml - udp-datagram —
templates/protocols/l4/udp.wpg.yaml - diameter-ccr-initial —
templates/protocols/mobile/diameter-ccr-initial.wpg.yaml - diameter-cer —
templates/protocols/mobile/diameter-cer.wpg.yaml - gtpv2-create-session-request —
templates/protocols/mobile/gtpv2-create-session-request.wpg.yaml - gtpv2-create-session-response —
templates/protocols/mobile/gtpv2-create-session-response.wpg.yaml - gtpv2-echo-request —
templates/protocols/mobile/gtpv2-echo-request.wpg.yaml - ldp-hello —
templates/protocols/mpls/ldp-hello.wpg.yaml - ldp-initialization —
templates/protocols/mpls/ldp-initialization.wpg.yaml - ldp-label-mapping —
templates/protocols/mpls/ldp-label-mapping.wpg.yaml - ldp-label-withdraw —
templates/protocols/mpls/ldp-label-withdraw.wpg.yaml - ldp-targeted-hello —
templates/protocols/mpls/ldp-targeted-hello.wpg.yaml - rsvp-hello —
templates/protocols/mpls/rsvp-hello.wpg.yaml - rsvp-path-err —
templates/protocols/mpls/rsvp-path-err.wpg.yaml - rsvp-path-tear —
templates/protocols/mpls/rsvp-path-tear.wpg.yaml - rsvp-te-path —
templates/protocols/mpls/rsvp-te-path.wpg.yaml - rsvp-te-resv —
templates/protocols/mpls/rsvp-te-resv.wpg.yaml - sr-mpls-entropy —
templates/protocols/mpls/sr-mpls-entropy.wpg.yaml - bfd-auth —
templates/protocols/oam/bfd-auth.wpg.yaml - bfd-single-hop —
templates/protocols/oam/bfd-single-hop.wpg.yaml - micro-bfd —
templates/protocols/oam/micro-bfd.wpg.yaml - srv6-h-encaps-ipv4 —
templates/protocols/srv6/srv6-h-encaps-ipv4.wpg.yaml - ptp-announce-udp —
templates/protocols/timing/ptp-announce-udp.wpg.yaml - ptp-delay-req-udp —
templates/protocols/timing/ptp-delay-req-udp.wpg.yaml - ptp-delay-resp-udp —
templates/protocols/timing/ptp-delay-resp-udp.wpg.yaml - ptp-signaling-unicast —
templates/protocols/timing/ptp-signaling-unicast.wpg.yaml - rtcp-feedback-app —
templates/protocols/voip/rtcp-feedback-app.wpg.yaml - rtcp-rr-bye —
templates/protocols/voip/rtcp-rr-bye.wpg.yaml - rtcp-sr-sdes —
templates/protocols/voip/rtcp-sr-sdes.wpg.yaml - rtp-pcmu —
templates/protocols/voip/rtp-pcmu.wpg.yaml - sip-invite —
templates/protocols/voip/sip-invite.wpg.yaml - sip-register —
templates/protocols/voip/sip-register.wpg.yaml - scenario-dhcp-discover-flood —
templates/scenarios/dhcp-discover-flood.wpg.yaml - scenario-frame-size-sweep —
templates/scenarios/frame-size-sweep.wpg.yaml - scenario-jumbo-udp-mtu-probe —
templates/scenarios/jumbo-udp-mtu-probe.wpg.yaml - scenario-mac-flood —
templates/scenarios/mac-flood.wpg.yaml - scenario-ping-sweep-pattern —
templates/scenarios/ping-sweep-pattern.wpg.yaml - scenario-qinq-service-sweep —
templates/scenarios/qinq-service-sweep.wpg.yaml - sr-mpls-prefix-sid-sweep —
templates/scenarios/sr-mpls-prefix-sid-sweep.wpg.yaml - scenario-tcp-syn-port-scan —
templates/scenarios/tcp-syn-port-scan.wpg.yaml - scenario-ttl-sweep —
templates/scenarios/ttl-sweep.wpg.yaml - scenario-udp-qos-matrix —
templates/scenarios/udp-qos-matrix.wpg.yaml - scenario-vlan-id-sweep —
templates/scenarios/vlan-id-sweep.wpg.yaml - scenario-vlan-syn-flood —
templates/scenarios/vlan-syn-flood.wpg.yaml