man: start netsniff-ng.8 man page
[netsniff-ng.git] / man / netsniff-ng.8
blob48e28b0740961acf352076a871e2d8e9ba2764dc
1 .\" netsniff-ng - the packet sniffing beast
2 .\" Copyright 2013 Daniel Borkmann.
3 .\" Subject to the GPL, version 2.
5 .TH NETSNIFF-NG 8 "03 March 2013" "Linux" "netsniff-ng toolkit"
6 .SH NAME
7 netsniff-ng \- the packet sniffing beast
9 .SH SYNOPSIS
11 \fB netsniff-ng\fR { [\fIoptions\fR] [\fIfilter-expression\fR] }
13 .SH DESCRIPTION
15 Blubber.
17 .SH OPTIONS
19 .SS -d <netdev>, --dev <netdev>
20 Networking device to fetch statistics from, e.g. eth0, wlan0.
22 .SS -v, --version
23 Show versioning information.
25 .SS -h, --help
26 Show user help.
28 .SH USAGE EXAMPLE
30 .SS  netsniff-ng --in eth0 --out dump.pcap -s -T 0xa1e2cb12 -b 0 tcp or udp
31 Capture TCP or UDP traffic from the networking device eth0 into the pcap file
32 named dump.pcap, which has netsniff-ng specific pcap extensions (see
33 ``netsniff-ng -D'' for capabilities). Also, do not print the content to the
34 terminal and pin the process and NIC IRQ affinity to CPU 0. The pcap write
35 method is scatter-gather I/O.
37 .SS  netsniff-ng --in wlan0 --rfraw --out dump.pcap --silent --bind-cpu 0
38 Put the wlan0 device into monitoring mode and capture all raw 802.11 frames
39 into the file dump.pcap. Do not dissect and print the content to the terminal
40 and pin the process and NIC IRQ affinity to CPU 0. The pcap write method is
41 scatter-gather I/O.
43 .SS  netsniff-ng --in dump.pcap --mmap --out eth0 -k1000 --silent --bind-cpu 0
44 Replay the pcap file dump.pcap which is read through mmap(2) I/O and send
45 the packets out via the eth0 networking device. Do not dissect and print the
46 content to the terminal and pin the process and NIC IRQ affinity to CPU 0.
47 Also trigger the kernel every 1000us to traverse the TX_RING instead of every
48 10us. Note that the pcap magic type is detected automatically from the pcap
49 file header.
51 .SS  netsniff-ng --in dump.pcap --out dump.cfg --silent
52 Convert the pcap file dump.pcap into a trafgen(8) configuration file dump.cfg.
53 Do not print pcap contents to the terminal.
55 .SS  netsniff-ng --in eth0 --out eth1 --silent --bind-cpu 0 --type host -r
56 Redirect network traffic from the networking device eth0 to eth1 for traffic
57 that is destined to our host, thus ignore broadcast, multicast and promiscuous
58 traffic. Randomize the order of packets for the outgoing device and do not
59 print any packet contents to the terminal. Also, pin the process and NIC IRQ
60 affinity to CPU 0.
62 .SS  netsniff-ng --in team0 --out /opt/probe/ -s -m -J --interval 100MiB -b 0
63 Capture on an aggregated team0 networkoing device and dump packets into multiple
64 pcap files that are split into 100MiB each. Use mmap(2) I/O as a pcap write
65 method, enable support for super jumbo frames up to 64KB, and do not print
66 the captured data to the terminal. Pin netsniff-ng to and NIC IRQ affinity to
67 CPU 0. The default pcap magic type is 0xa1b2c3d4 (tcpdump-capable pcap).
69 .SS  netsniff-ng --in vlan0 --out dump.pcap -c -u `id -u bob` -g `id -g bob`
70 Capture network traffic on device wlan0 into a pcap file called dump.pcap
71 by using normal read(2), write(2) I/O for the pcap file (slower but less
72 latency). Also, after setting up the RX_RING for capture, drop priviledges
73 from root to the user/group ``bob''. Invoke the packet dissector and print
74 packet contents to the terminal for further analysis.
76 .SS  netsniff-ng --in any --filter http.bpf --jumbo-support --ascii -V
77 Capture from all available networking interfaces and install a low-level
78 filter that was previously compiled by bpfc(8) into http.bpf in order to
79 filter HTTP traffic. Enable super jumbo frame support and only print
80 human readable packet data to the terminal, be also more verbose during
81 setup phase.
83 .SS bla
85 .SH NOTE
86 For introducing bit errors, delays with random variation and more
87 while replaying pcaps, make use of tc(8) with its disciplines such
88 as netem.
90 netsniff-ng does only some basic, architecture generic tuning on
91 startup. If you are considering to do high performance capturing,
92 you need to carefully tune your machine, hardware and software-wise.
93 Simply letting netsniff-ng run without thinking about your underlying
94 system might not necessarily give you the desired performance. Note
95 that tuning your system is always a tradeoff and fine-grained
96 balancing act (e.g. throughput vs. latency). You should know what
97 you're doing!
99 One recommendation for software-based tuning is tuned(8). Besides
100 that, there are many other things to consider. Just to throw you
101 a few things that you might want to look at: NAPI networking drivers,
102 tickless kernel, I/OAT DMA engine, Direct Cache Access, RAM-based
103 file systems, multi-queues, and many more things. Also, you might
104 want to read the kernel's Documentation/networking/scaling.txt file
105 regarding technologies such as RSS, RPS, RFS, aRFS and XPS. Also
106 check your ethtool(8) settings, e.g. regarding offloading.
108 Moreover, to get a deeper understanding of netsniff-ng internals
109 and how it interacts with the Linux kernel, the kernel documentation
110 under Documentation/networking/{packet_mmap.txt, filter.txt,
111 multiqueue.txt} might be of interest.
113 If you do not need to dump all possible traffic, you have to consider
114 running netsniff-ng with a BPF filter for the ingress path. For that
115 purpose, read the bpfc(8) man page.
117 Also, to aggregate multiple NICs that you want to capture on, you
118 should consider using team devices, further explained in libteam resp.
119 teamd(8).
121 The following netsniff-ng pcap magic numbers are compatible with other
122 tools, at least tcpdump or Wireshark:
124     0xa1b2c3d4 (tcpdump-capable pcap)
125     0xa1b23c4d (tcpdump-capable pcap with ns resolution)
126     0xa1b2cd34 (Alexey Kuznetzov's pcap)
128 .SH BUGS
130 When replaying pcap files, the timing information from the pcap packet
131 header is currently ignored.
133 Also, when replaying pcap files, demultiplexing traffic among multiple
134 networking interfaces does not work. Currently, it is only sent via the
135 interface that is given by the --out parameter.
137 .SH LEGAL
138 netsniff-ng is licensed under the GNU GPL version 2.0.
140 .SH HISTORY
141 .B netsniff-ng
142 was originally written for the netsniff-ng toolkit by Daniel Borkmann. Bigger
143 contributions were made by Emmanuel Roullit, Markus Amend, Tobias Klauser and
144 Christoph Jaeger. It is currently maintained by Tobias Klauser
145 <tklauser@distanz.ch> and Daniel Borkmann <dborkma@tik.ee.ethz.ch>.
147 .SH SEE ALSO
148 .BR trafgen (8),
149 .BR mausezahn (8),
150 .BR ifpps (8),
151 .BR bpfc (8),
152 .BR flowtop (8),
153 .BR astraceroute (8),
154 .BR curvetun (8)
156 .SH AUTHOR
157 Manpage was written by Daniel Borkmann.