A DUT that reassembles badly, or a path with a smaller MTU than the original capture, is easier to test when you can turn one datagram into a known set of fragments. Pcap Workbench Web Community 1.8.10 does that from the Recipes tab with the Fragmentation tool: it splits an IPv4 or IPv6 payload into a number of fragments you choose, leaves already-fragmented packets and non-IP frames alone, and writes a new capture.

The four-packet teaching file below stays under the Community 10-packet write cap even after a 3-way split (the output has eight frames). This article runs that recipe, inspects the flags and offsets in the Packet editor, opens the reassembled IPv4 datagram with Edit reassembled…, and then confirms with tshark that both datagrams reassemble.

Try it yourself in the browser Download the input PCAP

What is in the file

frag-reassembly-input.pcap is an Ethernet capture in the documentation prefixes 192.0.2.0/24 (RFC 5737) and 2001:db8::/32 (RFC 3849). Two large UDP datagrams carry a 192-byte IP payload (UDP header plus 184 bytes of ASCII starting pcapwb-ipv4-frag-payload/ and pcapwb-ipv6-frag-payload/). 192 bytes divides into three 64-byte pieces on an 8-octet boundary, which is what a 3-fragment request needs. The other two packets are there to show what the tool leaves unchanged: a short ICMP echo (IP payload 8 bytes) and an ARP request. Timestamps start at 0.

No. Time (s) Protocol Length Content
10.000UDP226IPv4 192.0.2.10:53000 → 192.0.2.20:12345, ip.id 0x4242, ip.len 212
20.001ICMP42Echo request, IP payload 8 bytes
30.010UDP246IPv6 2001:db8::10:53000 → 2001:db8::20:12345, ipv6.plen 192
40.020ARP42who-has 192.0.2.20 says 192.0.2.10, Ethernet dest broadcast

tshark 4.4 reports no expert warnings on this file, and the IP and UDP checksums verify as good. The web edition ships no demo captures, so this is the file the article publishes.

Try it yourself: fragment into three

These steps were run on Web Community 1.8.10, the version of the page at packetbuilder.net/pcap-workbench-web/.

  1. Open the page and wait until the status at the bottom right says Ready. The badge in the top right should read Web Community 1.8.10 (or later).
  2. In the Packet editor tab, click Open capture and choose frag-reassembly-input.pcap. The summary should read 4 of 4 packets shown. The list shows UDP 226, ICMP 42, UDP 246 and ARP 42. Select packet 1: Protocol view shows ip.id 0x4242, ip.len 212, ip.flags 0x0, udp.srcport 53000, udp.dstport 12345 and udp.length 192. Packet view starts with the ASCII pcapwb-ipv4-frag-payload/.

Pcap Workbench Packet editor with frag-reassembly-input.pcap open. The summary reads 4 of 4 packets shown. Packet 1 is selected; Protocol view shows ip.id 0x4242, ip.len 212, and UDP ports 53000 and 12345.

  1. Open Recipes (the Recipes button in the toolbar, or the PCAP tools tab, which starts on the Recipes subtab). The hint on that page says tools are chained as a recipe and that each step writes an intermediate capture that the next step reads.
  2. In the tool list, select Fragmentation and click + Add step. Set Number of fragments to 3 (the default is 2; the help says the value must be >= 2). Leave MTU (optional) empty — the help says “Leave empty to calculate automatically.” Leave Pad short fragments to 60 bytes checked (the default) and Packets on All relevant packets.

Pcap Workbench Fragmentation recipe step: Number of fragments 3, MTU left empty, Pad short fragments to 60 bytes checked, Packets set to All relevant packets.

  1. Click the blue Run recipe button. Recipes use the capture that is open in the Packet editor; if none is open, the page asks you to open one first.

The Result panel should show exit code 0 and a Download out.pcap link. The stdout is JSON from the Community runner. In this run it reported packets_in 4, packets_processed 4, community_limited false, a step result of fragmented packets: 2, unchanged/non-relevant: 2, and packets_out 8. The two fragmented packets are the IPv4 and IPv6 UDP datagrams; the ICMP and ARP rows are the two left unchanged.

Pcap Workbench Result panel after running Fragmentation with Number of fragments 3. Exit code 0, community_limited false, step result fragmented packets: 2, unchanged/non-relevant: 2, and a Download out.pcap link.

Inspect the fragments in the Packet editor

Open the downloaded file — or the published copy frag-reassembly-output.pcap — in the Packet editor. The summary should read 8 of 8 packets shown. The original timestamps are kept: the three IPv4 fragments all have time 0.000, the three IPv6 fragments 0.010. Lengths are 98, 98, 98, 42, 126, 126, 126 and 42.

Select packet 1, the first IPv4 fragment. Protocol view shows ip.id still 0x4242, ip.len 84, ip.flags 0x1 (More Fragments) and ip.frag_offset 0. Because this piece starts at offset 0, the UDP header is in this frame: ports 53000 and 12345, udp.length still 192 (the length of the original datagram, not of this fragment), and udp.checksum still 0x5fa1. Only 56 data bytes follow the UDP header in this frame (64 bytes of IP payload minus the 8-byte UDP header). Packet view still begins with pcapwb-ipv4-frag-payload/.

Packet editor on the fragmented output, packet 1 selected. Length is 98. Protocol view shows ip.id 0x4242, ip.flags 0x1, ip.frag_offset 0, and UDP ports 53000 and 12345. Packet view starts with pcapwb-ipv4-frag-payload.

Select packet 3, the last IPv4 fragment. ip.id is still 0x4242, ip.flags is 0x0 (no More Fragments) and ip.frag_offset is 16. That offset is in 8-octet units, so it is 128 bytes into the original IP payload. The list labels this row IPv4, not UDP: only the first fragment carries the UDP header, so the editor does not parse one here. Under the ip layer, Protocol view shows a fragment layer instead: fragment reads IP fragment, offset 128, fragment.proto is 17 (UDP) (the protocol of the whole datagram), fragment.id is 0x4242, fragment.more is 0, fragment.len is 64, and fragment.data holds the 64 raw payload bytes. Packet 2 is the middle piece (ip.flags 0x1, ip.frag_offset 8, IP fragment, offset 64) and is also listed as IPv4.

Packet editor on the fragmented output, packet 3 selected and listed as IPv4. ip.flags is 0x0 and ip.frag_offset is 16. Protocol view shows a fragment layer: IP fragment, offset 128, fragment.proto 17 (UDP), fragment.len 64, and the raw fragment.data.

The IPv6 datagram is packets 5–7, each 126 bytes (Ethernet 14, IPv6 base header 40, Fragment Header 8, 64 bytes of payload). Select packet 7. ipv6.nxt is 44 (Fragment Header), ipv6.plen is 72, and the ipv6.fragment layer shows ipv6.fragment.nxt 17 (UDP), ipv6.fragment.offset 16, ipv6.fragment.more 0 and ipv6.fragment.id 3. In this file that identification is 3, the original packet number of the IPv6 datagram; all three pieces share it. Packet 5 (offset 0, more 1) is the one that still contains the real UDP header, and the list labels it UDP. Packets 6 and 7 are labelled IPv6, and each has the same fragment layer after ipv6.fragment (IP fragment, offset 128 on packet 7) with the raw payload in fragment.data.

Packet editor on the fragmented output, IPv6 packet 7 selected. ipv6.nxt is 44, ipv6.fragment.offset is 16, ipv6.fragment.more is 0, and ipv6.fragment.id is 3.

Look at the reassembled datagram

Select any IPv4 fragment (packet 1, 2 or 3) and click Edit reassembled… in the Packet editor strip (it is also in the Edit menu). The dialog title reads Edit reassembled datagram — packets 1-3, and the text above the hex says 3 fragments, 192 payload bytes (transport header included). The hex starts cf 08 30 39 00 c0 5f a1: the UDP header (ports 53000 and 12345, length 192, checksum 0x5fa1), followed by pcapwb-ipv4-frag-payload/.

Pcap Workbench Edit reassembled datagram dialog for packets 1-3: 3 fragments, 192 payload bytes, hex starting with the UDP header cf 08 30 39 00 c0 5f a1 and the ASCII pcapwb-ipv4-frag-payload.

Editing the hex and clicking Apply to fragments writes the change back into the fragments it came from. With Recalculate the transport checksum/length of the whole datagram checked (the default), the UDP checksum in the first fragment is updated to match, and a single Undo reverts every fragment that changed. Click Cancel to leave the capture as it is. If the selected packet is not a fragment, the editor says so (for example Packet #4 is not an IP fragment).

Confirm reassembly with tshark

tshark 4.4 has ip.defragment and ipv6.defragment on by default. On the published output it lists the last fragment of each datagram as the reassembled UDP message, with length 184, and the earlier pieces as fragments. The IPv4 identification is 0x4242; the IPv6 identification is 0x00000003. The Info column prints fragment offsets in bytes (0, 64, 128), not in 8-octet units.

tshark -r frag-reassembly-output.pcap

The last IPv4 fragment’s protocol tree includes [Reassembled IPv4 length: 192], and the UDP payload starts with pcapwb-ipv4-frag-payload/. The IPv6 datagram reassembles the same way. With checksum checking enabled, every IPv4 header checksum is good, and the reassembled UDP checksums are good:

tshark -r frag-reassembly-output.pcap -T fields \
  -e frame.number -e frame.len -e ip.id -e ip.flags.mf -e ip.frag_offset \
  -e ipv6.fraghdr.ident -e ipv6.fraghdr.more -e ipv6.fraghdr.offset \
  -o ip.defragment:FALSE -o ipv6.defragment:FALSE

That second command turns reassembly off so you can see every piece’s flags and offsets without tshark folding them into the last frame. You can also open your downloaded out.pcap next to the published output in the Compare tab to confirm they match.

What the tool leaves unchanged

The tool description says already-fragmented packets stay unchanged, as do IPv6 packets that already carry other extension headers, and non-IP frames. Running the same recipe again on the published output produced fragmented packets: 0, unchanged/non-relevant: 8. The short ICMP echo (IP payload 8 bytes) and the ARP request were already in that unchanged count on the first run.

Pad short fragments to 60 bytes is checked by default. On this teaching file it did not change any frame: every generated fragment is already 98 or 126 bytes. A side check with the same Community runner, on a 24-byte IPv4 payload split into two, shows what the box is for: with it checked, both frames are 60 bytes and the extra bytes are Ethernet trailer zeros after ip.len; unchecked, the frames are 50 and 42 bytes. tshark reassembled both variants to the same 24-byte payload.

The help under MTU (optional) says to leave it empty to calculate automatically, which is what the published recipe does. A side check that set MTU to 1500 while still asking for 3 fragments of packet 1 produced the same three IPv4 fragments as the empty-MTU run. The tool did not keep an MTU that would have yielded a different number of pieces.

The Recipes list also includes TCP Segmentation, which splits a TCP payload into new TCP segments. That is not IP fragmentation and was not used here.

Editions and limits

Recipes that write a capture are subject to the Community 10-packet write cap. This teaching file has four packets and writes eight, so the runner reported community_limited: false and processed the whole file. On a larger input, Community sees only the first 10 packets of each writing step — and fragmentation can turn those 10 into many more output frames. Compare, by contrast, is read-only and is not capped that way; see How to Compare Two PCAP Files.

This walk-through was verified in Web Community 1.8.10. The desktop app has the same Fragmentation recipe tool and its own Edit reassembled… dialog; the desktop window was not used here.

Related

Companion articles: How to Compare Two PCAP Files — open the published fragmented output next to your own recipe output and confirm they match — How to Truncate and Split a PCAP like editcap, and How to Rewrite IP and MAC Addresses for a Lab.

Other Pcap Workbench guides in this series:

Earlier articles on related workflows: edit a PCAP without breaking checksums, replay a PCAP to a lab device, anonymize a PCAP before you share it, build a PCAP regression set with PASS/FAIL checks, and strip VLAN tags or decapsulate GTP-U.

Try it yourself in the browser Input PCAP Fragmented PCAP Input PCAPNG