OnCallReadyStart learning

conntrack: command line interface for netfilter connection tracking

conntrack -L [table] [options] [-z]
conntrack -G [table] parameters
conntrack -D [table] parameters
conntrack -E [table] [options]
conntrack -F [table]
conntrack -C [table]
conntrack -S

Options you will use

-L, --dump
List connection tracking or expectation table.
-G, --get
Search for and show a particular (matching) entry in the given table.
-D, --delete
Delete an entry from the given table (every entry the filters match).
-E, --event
Display a real-time event log.
-F, --flush
Flush the whole given table.
-C, --count
Show the table counter.
-S, --stats
Show the in-kernel connection tracking system statistics.
-o, --output FORMAT
Display output in a certain format, e.g. extended (with the layer 3 information), xml, timestamp, id.
-s, --src, --orig-src IP_ADDRESS
Match only entries whose source address in the original direction equals the one specified as argument.
-d, --dst, --orig-dst IP_ADDRESS
Match only entries whose destination address in the original direction equals the one specified as argument.
-r, --reply-src IP_ADDRESS
Match only entries whose source address in the reply direction equals the one specified as argument.
-q, --reply-dst IP_ADDRESS
Match only entries whose destination address in the reply direction equals the one specified as argument.
-p, --proto PROTO
Specify layer four (TCP, UDP, ...) protocol. Needed before the protocol options below.
--sport, --orig-port-src PORT
Source port in original direction.
--dport, --orig-port-dst PORT
Destination port in original direction.
--state STATE
TCP state, one of NONE, SYN_SENT, SYN_RECV, ESTABLISHED, FIN_WAIT, CLOSE_WAIT, LAST_ACK, TIME_WAIT, CLOSE or LISTEN.

Examples

$ sudo conntrack -L -p tcp --dport 443

the tracked TCP flows to port 443

$ sudo conntrack -L -d 203.0.113.10

flows to one address

$ sudo conntrack -D -d 203.0.113.10

delete them: the next packet is a new flow

$ sudo conntrack -C

how many entries the table holds

Gotchas

Try conntrack in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.