# tcpdump command and filter explainer

> Paste a tcpdump command or a capture filter and read every option and every primitive in plain words: the hidden defaults made explicit, how and, or and not group, byte-offset tests decoded, and errors placed where libpcap would stop.

- Tool: https://ronutz.com/en/tools/tcpdump-filter-explainer
- Family: Networking

---

## What it does

Paste a tcpdump command line, or just a capture filter, and the tool reads it back to you. For a command it explains every option it finds, then hands the filter expression to the same parser libpcap's grammar describes: the filter becomes a tree, and every part of it is explained in plain words, with the defaults the language leaves implicit written out, the qualifiers a bare value inherits shown, the way `and`, `or` and `not` grouped made visible, byte-offset tests such as `tcp[13] & 2 != 0` decoded into flag names, and every error placed at the position where libpcap would stop. Nothing is captured, run, resolved or sent: the text is parsed in your browser.

It is the reading half of capture work. To write a command for a platform with its own capture syntax, use the [BIG-IP tcpdump builder](https://ronutz.com/en/tools/f5-bigip-tcpdump-builder) or the [FortiOS packet sniffer builder](https://ronutz.com/en/tools/fortios-sniffer-builder).

## Which tcpdump and libpcap

The tool follows the releases tcpdump.org offers, read on 2026-10-27: tcpdump 4.99.7 (stable, 21 September 2026), libpcap 1.10.7 (stable, 5 September 2026) and libpcap 1.11.0 (testing, 13 September 2026). Each is read from its own manual page and its own tagged source code. tcpdump.org publishes no support or end-of-life dates for these releases; its [security page](https://www.tcpdump.org/security.html) says the project aims to release at least once a year, as a best-effort commitment.

The options follow [tcpdump(1) for 4.99.7](https://www.tcpdump.org/manpages/tcpdump.1-4.99.7.html). The filter language follows [pcap-filter(7) for libpcap 1.11.0](https://www.tcpdump.org/manpages/libpcap-1.11.0/pcap-filter.7.html) and the code of both libpcap releases, and where 1.10.7 and 1.11.0 differ the tool says which does what:

- Added in 1.11.0: `vxlan`, the `lldp` and `slow` names for `ether proto`, the 802.11 subtype names `bar` and `ba`, and a new definition of `gateway` (pcap-filter(7), BACKWARD COMPATIBILITY). libpcap 1.10.7 rejects the first three; it compiles `gateway` only in builds without IPv6 support.
- Caps added in 1.11.0: an IP protocol number, an `iso proto` number or a `byte` value above 255, an IS-IS PDU type above 31, an EtherType above 65535, an LLC DSAP above 255 (on Ethernet, `ether proto` reads a number up to 1500 as an LLC DSAP), and an 802.11 direction above 3. libpcap 1.10.7 compiles these without a complaint, usually into a test that can never be true, and 1.11.0 refuses them.
- Older additions the page records: `ifindex` in 1.10.0, the ICMPv6 type names and `tcp-ece`/`tcp-cwr` in 1.9.0, `geneve` in 1.8.0, `%` and `^` in 1.6.2.

The development versions (tcpdump 5.0.0-PRE-GIT and libpcap 1.11.1-PRE-GIT, the [current manual pages](https://www.tcpdump.org/manpages/tcpdump.1.html) on tcpdump.org) are mentioned only where they differ again: `--lengths`, `--print-sampling`, `--skip` and the `-T` types `geneve` and `quic` exist only there, and one compiler quirk of both releases (below) is fixed there.

## The options

Every option of tcpdump 4.99.7 is explained, including the repeated forms (`-v`, `-vv`, `-vvv`; `-t` to `-ttttt`; `-x`/`-xx`; `-X`/`-XX`; `-d` to `-ddd`), short options clustered in one word (`-nnvvX`), arguments attached or separate (`-s96`, `-s 96`, `--snapshot-length=96`), and `--` before the expression. Arguments are checked the way tcpdump.c checks them: `-c` at least 1, `-B` and `-W` at least 1, `-G` at least 0, `-s` from 0 to 262144 (0 means the default, 262144; `0x` makes it hex and a leading 0 octal), `-C` a number with an optional k, m or g suffix (the tool works out the bytes), and `-Q` one of in, out or inout. tcpdump 4.99.7 reads `-c`, `-B`, `-G` and `-W` with C's `atoi()`, which keeps only the leading digits, so `-c 10x` quietly counts 10 there while the development version refuses it; the tool says both.

`-i any` gets the page's notes (all regular interfaces, never promiscuous, Linux and recent macOS and Solaris only). Options present only in some builds are marked: in 4.99.7, `-B` and `-I` need a libpcap with `pcap_create()`, `-D` one with `pcap_findalldevs()`, `-Q` one with `pcap_setdirection()` and `-U` one with `pcap_dump_flush()`; `-E` and `-M` need cryptography, `-z` needs fork, `-j` and `-J` need time stamp type support, and `-m` is ignored with a warning in a build without libsmi. `-E` carries the page's warning that a secret on the command line is visible to other users.

About `-nn`: neither the 4.99.7 page nor the development page gives a second `-n` its own meaning. On both, `-n` alone already stops tcpdump turning host addresses and port numbers into names. tcpdump counts each `-n`, so `-nn` is accepted; if an older or a vendor build documents a difference, its own page is the authority.

The tool also notes how options combine: `-A` does nothing next to `-x` or `-X`, `-x` does nothing next to `-X`, `-C`, `-G`, `-W` and `-z` act only on what `-w` writes, `-W` is ignored (except for file names) when both `-C` and `-G` are given, `-w` saves instead of printing unless `--print` is added, `-F` makes tcpdump ignore the expression on the command line, and `-d`, `-D`, `-L`, `-J`, `-h` and `--version` print something and exit without capturing.

## The shell around the command

A pasted command is first split into words the way a POSIX shell would: single and double quotes, backslashes, `#` comments, redirections (`> file`, `2>/dev/null`), and the operators that end a command (`|`, `&`, `;`, `&&`, `||`). tcpdump(1) advises passing an expression that contains shell metacharacters as one quoted argument, and the development page adds that options first, then `--`, then the quoted expression works with every shell and getopt. The tool shows why: an unquoted `&` ends the command, an unquoted `\tcp` reaches tcpdump as `tcp`, an unquoted `(` is shell syntax, and `$` and `*` may be expanded. When the expression comes as several words, tcpdump joins them with spaces, and so does the tool.

## The filter

**Defaults.** A primitive is an id with up to three qualifiers: a protocol, a direction and a type. pcap-filter(7) fills in what is missing: no type means `host`, no direction means `src or dst`, and no protocol means every protocol consistent with the type. For a host or a network that depends on the address: an IPv4 address covers `ip`, `arp` and `rarp`; an IPv6 address covers `ip6`; a name covers all four, depending on what it resolves to when the filter is compiled. `port 53` covers `tcp`, `udp` and `sctp`, over IPv4 (only an unfragmented packet or the first fragment) or IPv6 (only without extension headers). The tool writes each default out, in the page's own notation, which is a reading rather than always valid syntax.

**The shorthand.** A bare value takes the qualifiers of the most recent primitive: `tcp dst port ftp or ftp-data or domain` is `tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain`, and `not host vs and ace` is `not host vs and host ace` (not `not (host vs and host ace)`). The tool follows libpcap's grammar exactly here: after a parenthesized expression a bare value takes the qualifiers in force before the parenthesis opened, so `(host a) and b` has nothing to inherit and libpcap rejects it; after a bare protocol keyword (`tcp and 80`) there is nothing to inherit either. A list of values in parentheses after a qualifier, `host helios and (hot or ace)`, gives each value the same qualifiers.

**Precedence.** `not` binds tighter than `and` and `or`. `and` and `or` have the same precedence and group from left to right, so `host 192.0.2.1 or host 192.0.2.2 and port 53` means `(host 192.0.2.1 or host 192.0.2.2) and port 53`, which is not how most programming languages read it. The tool rewrites the whole filter with every grouping in parentheses and every inherited qualifier written out, and that rewrite is valid syntax you can paste back.

**Byte offsets.** In a relation such as `tcp[13] & 2 != 0` the arithmetic sits on each side of the comparison, so `&` applies before `!=`. `tcp[tcpflags]` is octet 13 of the TCP header, and `tcp-fin`, `tcp-syn`, `tcp-rst`, `tcp-push`, `tcp-ack`, `tcp-urg`, `tcp-ece` and `tcp-cwr` are the bit values 1, 2, 4, 8, 16, 32, 64 and 128 (the TCP header diagram in tcpdump(1) and libpcap's scanner). The tool reads the common idioms in words: `tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn` is "SYN set and ACK clear". It also names ICMP and ICMPv6 type values, notes that `tcp[ ]`, `udp[ ]`, `icmp[ ]` and the other transport accessors look only at IPv4 packets, rejects a size other than 1, 2 or 4, and warns that `%` and `^` have no declared precedence in libpcap's grammar: when they meet another operator without parentheses the parser's default applies (it shifts), so `a + b % c + d` is `a + (b % (c + d))`.

**Division, modulus and shifts.** libpcap refuses a division or a modulus by zero and a shift by more than 31 bits. A plain number on the right (`tcp[13] / 0`, `len >> 32`) is refused by every version. Both releases have a quirk the tool reproduces: their check looks at the first number in the code generated for the right-hand side, so `len / tcp[0] = 1` is refused with "division by zero" because the offset 0 comes first, and `len << tcp[40] = 1` with "shift by more than 31 bits". The development code checks only a plain number; with a release, write the operand so its code starts with another number (`tcp[1 - 1]`, `tcp[31 + 9]`). A right-hand side that is a constant expression (`len / (5 * 0)`) is caught by the optimizer, so with `-O` it compiles, and the tool says that when the command carries `-O`.

**vlan, mpls and the other encapsulations.** pcap-filter(7) says the first `vlan` (or `mpls`, `pppoes`, `geneve`, `vxlan`) in an expression changes the decoding offsets for the rest of it, and each further `vlan` or `mpls` adds 4 bytes. The tool marks every primitive written after one, and warns when the keyword sits under `or` or `not`, because the offset change then also applies to packets for which the test was false.

**802.11.** Type and subtype numbers are written as they sit in the frame control byte: a type is 0x00 (mgt), 0x04 (ctl), 0x08 (data) or 0x0c, a subtype a multiple of 16 up to 0xf0, so `type 1` and `type mgt subtype 1` are refused by both releases. A direction above 3 (`dir 5`) is refused only from 1.11.0. Names are compared without regard to case.

**Errors.** A filter libpcap's scanner or grammar rejects is reported with the position, what was found and what the grammar expected there, with the likely cause when it is recognizable: a protocol keyword after `proto` that needs a backslash (`ip proto \tcp`), `len-1` read as one name, an uppercase keyword, a single `&` used between primitives, a scoped IPv6 address, unbalanced parentheses. Combinations the compiler refuses are marked on the primitive, in libpcap's own order: an invalid address, a prefix length that is too long, host bits outside the mask, a prefix length or mask without `net`, a protocol qualifier that does not fit the type, a MAC address without `ether`, a port above 65535, a VLAN ID above 4095. A filter no packet can match because it asks for two protocols at the same layer at once (`ip and ip6`, `tcp or udp and icmp`) is flagged too: libpcap compiles it, finds that the code rejects every packet and, with the optimizer on (the default; `-O` turns it off), refuses it with "expression rejects all packets". When the command carries `-O`, libpcap compiles it and tcpdump captures nothing, and the tool says that instead. That check covers bare protocol keywords joined by `and` and `or`; other impossible combinations are left to `tcpdump -d`.

## Things it cannot know

- What a name resolves to. Host names, port and protocol names, network names and `ethers(5)` names are looked up on the capturing machine when the filter is compiled.
- What the capture's link-layer type supports. 802.11, ATM, SS7, pf log, ARCnet and the `inbound`/`outbound` primitives work only on their own link types, and libpcap refuses them elsewhere.
- Your libpcap. The tool states what 1.10.7 and 1.11.0 do; an older libpcap may accept less or more, and a vendor build may differ. Run `tcpdump -d` with your filter to see exactly what your libpcap compiles: it prints the code and captures nothing.
- One documentation conflict, stated where it applies: pcap-filter(7) says `net` may be left out before an address with a prefix length when a direction is given (`src 10.0.0.0/8`), but the compiler of both releases refuses that form, and libpcap 1.10.4 refused it in our test. The tool follows the code and says so.

## Examples

The Example button loads `sudo tcpdump -nn -i eth0 -c 20 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn and host 192.0.2.10 and port 443'`: the prefix, `-nn`, `-i` and `-c` explained; the filter grouped as `(… and host 192.0.2.10) and port 443`; the flag test read as "SYN set and ACK clear"; `host 192.0.2.10` written out as `(ip or arp or rarp) (src or dst) host 192.0.2.10` and `port 443` as `(tcp or udp or sctp) (src or dst) port 443`. The golden vectors add the pages' own examples (`host helios and (hot or ace)`, `gateway snup and (port ftp or ftp-data)`, the VLAN and MPLS (Multiprotocol Label Switching) stacks, the IPv4 HTTP-data filter) and one refusal for each error the tool knows. Every filter vector was also compiled with `tcpdump -d` (tcpdump 4.99.4 with libpcap 1.10.4) to confirm the verdict; the disagreements are the 1.11.0 additions and caps, names that do not resolve, and primitives that need their own link type.

## API

The same engine answers the `/api/v1/tcpdump-filter-explainer` operation of the site's HTTP API, described in the OpenAPI contract on the [API page](https://ronutz.com/en/api), which also says whether this site serves the API.

- **Request.** The command line or the filter as text.
- **Response.** `mode` (`command` or `filter`), `input`, `versions` (the releases the explanation follows, `tcpdump`, `libpcapStable` and `libpcapTesting`, the development versions it mentions, `tcpdumpDev` and `libpcapDev`, and `readOn`), `command` (null for a filter; else `prefix`, `program`, `options` with `flag`, `raw`, `arg`, `count`, `known`, `meaning`, `notes` and `errors`, `expressionWords`, `expressionFrom`, `notes`, `errors`), `shellNotes`, and `filter` (`text`, `empty`, `ok`, `error` with `code`, `start`, `end`, `found`, `expected` and `hints`, `tree`, `canonical`, `notes`, `semanticErrors` and `tokens`). Every explanation comes in `en` and `pt`, every note with its `code` and the `source` it rests on.
- **Errors.** HTTP 400, `invalid_input`, for an empty input or one longer than 4096 characters. A filter that does not parse is not an HTTP error: `filter.error` explains it.

## Share results

Under what was recognized, **Share results** builds a link to this page, only when you press it, that carries the command or filter as pasted (`input`) after the `#`: the option table, the parse tree and the positions of errors read every character, so nothing can be replaced without changing the explanation. Its popover says first what the link carries, then a caution of its own (a command or filter can name internal hosts, networks and interfaces), then offers Copy link and, where the browser has one, its share sheet; the page's address is not changed.

Two options take a secret on the command line, by [tcpdump(1)](https://www.tcpdump.org/manpages/tcpdump.1-4.99.7.html) (4.99.7, read 2026-11-01): `-E spi@ipaddr algo:secret`, "for decrypting IPsec ESP packets", and `-M secret`, "a shared secret for validating the digests found in TCP segments with the TCP-MD5 option (RFC 2385)". A command whose `-E` carries an inline secret, or whose `-M` carries one, gets no link, and the popover names the option: put a placeholder in its place (or, for `-E`, the file name the manual offers instead) and press again. The text also goes through the site's secrets check: a value that is a credential by its format (a password in a URL, a PEM private key, a JWT) means no link, naming its line.

[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) (section 3.5, read 2026-11-01) has the fragment "separated from the rest of the URI prior to a dereference", so the text is not sent to the server when the link is opened; it stays in the address bar and the history of whoever opens it, and anyone who has the link can read it.

- **Opening a link.** The text fills the box as a paste would and the page explains it; nothing is run or resolved. The values then leave the page's address at once, without a request, so a reload or the page's own Share button carries nothing.

## Sources

- [tcpdump.org, Latest Releases](https://www.tcpdump.org/index.html) (read 2026-10-27): tcpdump 4.99.7 and libpcap 1.10.7 stable, libpcap 1.11.0 testing
- [tcpdump.org, Security](https://www.tcpdump.org/security.html) (read 2026-10-27): the release aim; no support or end-of-life dates are published
- [tcpdump(1) for tcpdump 4.99.7](https://www.tcpdump.org/manpages/tcpdump.1-4.99.7.html) (read 2026-10-27): SYNOPSIS, OPTIONS, EXAMPLES, the TCP flags walk-through
- [tcpdump(1), development page (tcpdump 5.0.0-PRE-GIT)](https://www.tcpdump.org/manpages/tcpdump.1.html) (read 2026-10-27): the options only the development version has
- [pcap-filter(7) for libpcap 1.11.0](https://www.tcpdump.org/manpages/libpcap-1.11.0/pcap-filter.7.html) (read 2026-10-27): the whole filter language, BACKWARD COMPATIBILITY
- [pcap-filter(7) for libpcap 1.10.7](https://www.tcpdump.org/manpages/libpcap-1.10.7/pcap-filter.7.html) (read 2026-10-27): the stable release's page
- [pcap-filter(7), development page (libpcap 1.11.1-PRE-GIT)](https://www.tcpdump.org/manpages/pcap-filter.7.html) (read 2026-10-27): the systems that filter `%` and `^` in the kernel
- [libpcap scanner.l, tag libpcap-1.11.0](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/scanner.l) and [tag libpcap-1.10.7](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.10.7/scanner.l) (read 2026-10-27): tokens and named values
- [libpcap grammar.y.in, tag libpcap-1.11.0](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/grammar.y.in) and [tag libpcap-1.10.7](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.10.7/grammar.y.in) (read 2026-10-27): grouping, precedence, qualifier inheritance, the 802.11 value checks
- [libpcap gencode.c, tag libpcap-1.11.0](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/gencode.c), [tag libpcap-1.10.7](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.10.7/gencode.c) and [master](https://github.com/the-tcpdump-group/libpcap/blob/master/gencode.c) (read 2026-10-27): what the compiler refuses, in each version
- [libpcap optimize.c, tag libpcap-1.11.0](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/optimize.c) (read 2026-10-27): constant folding and its refusals
- [libpcap ieee80211.h, tag libpcap-1.11.0](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/ieee80211.h) (read 2026-10-27): the 802.11 frame control masks
- [tcpdump.c, tag tcpdump-4.99.7](https://github.com/the-tcpdump-group/tcpdump/blob/tcpdump-4.99.7/tcpdump.c) and [master](https://github.com/the-tcpdump-group/tcpdump/blob/master/tcpdump.c) (read 2026-10-27): option parsing, argument bounds, build-dependent options
- [GNU Bison manual, 5.3.5 How Precedence Works](https://www.gnu.org/software/bison/manual/html_node/How-Precedence.html) (read 2026-10-27): the default shift
- [IANA, Assigned Internet Protocol Numbers](https://www.iana.org/assignments/protocol-numbers/protocol-numbers-1.csv) (read 2026-10-27): the protocol numbers of tcp, udp, sctp, ah, esp and pim
- [tcpdump(1) for tcpdump 4.99.7](https://www.tcpdump.org/manpages/tcpdump.1-4.99.7.html) (read 2026-11-01): -E and -M, the two options that take a secret on the command line
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, section 3.5](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) (read 2026-11-01): the fragment is "separated from the rest of the URI prior to a dereference", which Share results relies on

## Standards and references

- [tcpdump.org home page, Latest Releases: tcpdump 4.99.7 (stable, 21 September 2026), libpcap 1.10.7 (stable, 5 September 2026), libpcap 1.11.0 (testing, 13 September 2026)](https://www.tcpdump.org/index.html) - which releases are current and how the project labels them
- [tcpdump(1) for tcpdump 4.99.7, the stable release (page dated 2 February 2026), tcpdump.org: SYNOPSIS, DESCRIPTION, OPTIONS, EXAMPLES, the TCP flags walk-through (octets 12 and 13)](https://www.tcpdump.org/manpages/tcpdump.1-4.99.7.html) - every option, the quoting advice for the expression, the TCP flag bits
- [tcpdump(1), the development page on tcpdump.org (documents tcpdump 5.0.0-PRE-GIT, dated 10 September 2026)](https://www.tcpdump.org/manpages/tcpdump.1.html) - what only the development version has: --lengths, --print-sampling, --skip, the -T types geneve and quic, the advice to put -- before the expression
- [pcap-filter(7) for libpcap 1.11.0, the testing release (page dated 12 September 2026), tcpdump.org: DESCRIPTION, PRIMITIVES, ARITHMETIC EXPRESSIONS, PACKET DATA ACCESSORS, NAMED VALUES, COMPOUND EXPRESSIONS, EXAMPLES, BACKWARD COMPATIBILITY](https://www.tcpdump.org/manpages/libpcap-1.11.0/pcap-filter.7.html) - the filter language: qualifiers and their defaults, every primitive, precedence, the shorthand, offsets, vlan and mpls, and what changed in which version
- [pcap-filter(7) for libpcap 1.10.7, the stable release (page dated 13 June 2023), tcpdump.org](https://www.tcpdump.org/manpages/libpcap-1.10.7/pcap-filter.7.html) - the same language as documented for the stable release, before the 1.11.0 additions
- [pcap-filter(7), the development page on tcpdump.org (documents libpcap 1.11.1-PRE-GIT, dated 16 September 2026)](https://www.tcpdump.org/manpages/pcap-filter.7.html) - the systems that run % and ^ in the kernel (the only paragraph the tool takes from it)
- [libpcap scanner.l at tags libpcap-1.11.0 and libpcap-1.10.7 (1.10.7 has no vxlan keyword)](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/scanner.l) - tokens: keywords (case-sensitive), names with hyphens, numbers (octal with a leading 0), MAC and IPv6 forms, named offsets and values
- [libpcap grammar.y.in at tags libpcap-1.11.0 and libpcap-1.10.7 (the same rules apart from vxlan, the 802.11 subtypes bar and ba, and the 802.11 direction check)](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/grammar.y.in) - the grammar: and/or at equal precedence, not, the value lists, qualifier passing, the arithmetic operators and their declared precedence, the 802.11 value checks
- [libpcap gencode.c at tag libpcap-1.11.0, the testing release](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/gencode.c) - which qualifier and value combinations the compiler refuses, the value caps, the right-hand side check of /, %, << and >>, and pcap_compile refusing a filter that rejects every packet when the optimizer runs
- [libpcap gencode.c at tag libpcap-1.10.7, the stable release](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.10.7/gencode.c) - the same refusals as 1.11.0 except the caps 1.11.0 added, and gateway only in builds without IPv6
- [libpcap gencode.c, master (1.11.1-PRE-GIT)](https://github.com/the-tcpdump-group/libpcap/blob/master/gencode.c) - the right-hand side check of /, %, << and >> limited to a plain number, after 1.11.0
- [libpcap optimize.c at tags libpcap-1.11.0 and libpcap-1.10.7](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/optimize.c) - constant folding refusing a division or modulus by zero and a shift by more than 31 bits
- [libpcap ieee80211.h at tags libpcap-1.11.0 and libpcap-1.10.7](https://github.com/the-tcpdump-group/libpcap/blob/libpcap-1.11.0/ieee80211.h) - the 802.11 frame control masks: type 0x0c, subtype 0xf0, direction 0x03 (both tags); Block Ack Request 0x80 and Block Ack 0x90 (1.11.0 only)
- [tcpdump.c at tag tcpdump-4.99.7, the stable release](https://github.com/the-tcpdump-group/tcpdump/blob/tcpdump-4.99.7/tcpdump.c) - the option letters and long options, argument parsing and bounds, -Q values, options present only in some builds, repeated -n
- [tcpdump.c, master (5.0.0-PRE-GIT)](https://github.com/the-tcpdump-group/tcpdump/blob/master/tcpdump.c) - the options and -T types only the development version has, and its stricter argument parsing
- [GNU Bison manual, 5.3.5 How Precedence Works (Bison 3.8.1)](https://www.gnu.org/software/bison/manual/html_node/How-Precedence.html) - with no declared precedence on the rule or the token, the parser shifts (how % and ^ group)
- [IANA, Assigned Internet Protocol Numbers (CSV)](https://www.iana.org/assignments/protocol-numbers/protocol-numbers-1.csv) - the IP protocol numbers of icmp, igmp, tcp, udp, esp, ah, icmp6, pim, vrrp and sctp

## Related reading

- [Capture Points Before Packets](https://ronutz.com/en/learn/capture-points-before-packets.md): The instinct under pressure is to start tcpdump somewhere convenient and stare at the flood. The senior habit is the opposite: decide where to observe, in what order, and what each observation would mean - before a single packet is collected. Evidence is designed, not fished for.
- [Network-derived analytics: watching trading on the wire](https://ronutz.com/en/learn/network-derived-analytics-and-trading-monitoring.md): Trading firms and exchanges copy every packet of their order and market data traffic, stamp it with precise time and decode the trading protocols inside, so that each order's journey can be measured and proved after the fact. After reading, you can explain where packets are captured and who stamps the time, read a pcap header with a nanosecond timestamp, tell hardware stamps from software stamps, follow one order through B3's published measure points and say which latencies a clock error makes meaningless, place Corvil and Pico and the other vendors from their own pages, and list the record-keeping rules in Europe, the United States and Brazil that this record helps to meet.
- [Ports, sockets and the five-tuple: how a host and every box in the path tell one conversation from another](https://ronutz.com/en/learn/ports-sockets-and-the-five-tuple.md): An address gets a packet to a machine; a port gets it to a program; and five fields together, the protocol, two addresses and two ports, name one conversation for the host and for every box that has to follow it. This part opens NetFun III: it reads the definitions in the standards that wrote them, from RFC 147 in 1971 to RFC 9293 and the registry IANA updated this week, works out by hand a laptop's five-tuples, the same flows through a translator, the arithmetic of the ephemeral range and TIME-WAIT, and the hash that pins a flow to one path, and ends with Brazil's port 25 management. After it you can read a socket table, predict when a client or a translator runs out of ports, and explain why a firewall, a load balancer and an ECMP router all key on the same five numbers.
- [Python for log and packet analysis: re, csv, json and Scapy in a lab you own](https://ronutz.com/en/learn/python-for-log-and-packet-analysis.md): Reading the two records a defender has, logs and captures, with Python: an OpenSSH auth log parsed with re (and the user name that tries to fool a careless pattern), timestamps without a year and why Python 3.15 refuses them, a CSV export with csv.DictReader, a JSON-lines access log with a damaged last line, the pcap file header read with struct, and Scapy 2.8.0 reading a capture packet by packet, filtering it with BPF and building test packets that are written to a file and never sent. Everything comes from a lab on 127.0.0.0/8 inside one machine, run on CPython 3.13.16.
- [The TCP Connection Lifecycle: Handshake, Teardown, and Why Connections Fail](https://ronutz.com/en/learn/tcp-connection-lifecycle.md): Every TCP conversation has three acts: the SYN handshake that creates it, the data flow that justifies it, and the FIN or RST that ends it. This part reads them from RFC 9293, the TCP standard of August 2022, and walks them by hand: the flags byte and the options of a real SYN, a handshake and a close with every sequence number written out, the eleven states and the segment that moves each end between them, the initial sequence number clock and why it cycles in 4.55 hours, the SYN retransmission schedule that tells silence from refusal, the TIME-WAIT arithmetic that caps how many connections a client can open per second, the reset rules and the blind-reset odds behind RFC 5961's challenge ACK, SYN floods from Phrack in 1996 to the SYN-ACK reflection discussed at NIC.br's GTS 40, and how Linux, Windows, F5, Palo Alto Networks, Fortinet and Juniper keep the same states with their own timers. After it you can read any capture's opening and closing, say which end holds TIME-WAIT and for how long, and name the short list of causes when a connection fails to establish at all.
- [The TCP Proxy: What a Layer 4 Middlebox Does and Does Not See](https://ronutz.com/en/learn/tcp-proxy-layer-4.md): A TCP proxy terminates the client's TCP connection and opens a separate one to the server, splicing two independent flows together at Layer 4. It rewrites addresses and ports, can pool and reuse connections, and sees nothing of the application payload above the transport header. This part writes the two connections out side by side with their sequence numbers, sets the full proxy against the packet-by-packet fast path on F5 BIG-IP and on HAProxy, NGINX, Envoy, Linux Virtual Server, FortiGate and a cloud network load balancer, works out source NAT and the return path, and decodes the PROXY protocol's version 1 and version 2 headers byte by byte. It ends with what Brazilian law asks an application to log when a proxy stands in front of it. After it you can tell, from a capture or a configuration, whether a box in the path is one connection or two, and where the client's address went.
- [UDP: the protocol that is a header](https://ronutz.com/en/learn/udp-the-protocol-that-is-a-header.md): The User Datagram Protocol is eight bytes and a promise not to promise: two ports, a length and a checksum, and everything else left to the application. This part reads Jon Postel's three pages of 1980 field by field, decodes a real-shaped DNS query from its hexadecimal bytes, computes its checksum by hand over the pseudo-header, checks the arithmetic against RFC 1071's own example, and then follows what UDP leaves undone: loss, order, size, congestion, the middlebox timers, and the missing handshake that makes reflection and amplification possible, with the Brazilian notification programme that cut exposed amplifiers by 79% between 2018 and 2025. After it you can decode a UDP header by eye, verify a checksum on paper, and say what any protocol built on UDP must do for itself.
- [Wireshark: the tool that made packets legible, and the stack underneath it](https://ronutz.com/en/learn/wireshark-and-the-capture-stack.md): In July 1998 a network engineer at a small Kansas City provider announced a program he had written because the commercial analysers cost fifteen hundred dollars and did not run on his platforms. Within days strangers were sending patches. It lost its own name to a trademark in 2006, outlived three corporate sponsors, and is now the reason a practitioner can read a protocol they have never met.
