Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   netsniff-ng    ( 8 )

зверь, обнюхивающий пакеты (the packet sniffing beast)

Параметры (Options)

-i <dev|pcap|->, -d <dev|pcap|->, --in <dev|pcap|->, --dev
       <dev|pcap|->
              Defines an input device. This can either be a networking
              device, a pcap file or stdin ('-'). In case of a pcap
              file, the pcap type (-D option) is determined
              automatically by the pcap file magic. In case of stdin, it
              is assumed that the input stream is a pcap file. If the
              pcap link type is Netlink and pcap type is default format
              (usec or nsec), then each packet will be wrapped with pcap
              cooked header [2].

-o <dev|pcap|dir|cfg|->, --out <dev|pcap|dir|cfg|-> Defines the output device. This can either be a networking device, a pcap file, a folder, a trafgen(8) configuration file or stdout ('-'). If the output device is a pcap or trafgen(8) configuration file, it may include a time format as defined by strfime(3). If used in conjunction with the -F option, each rotated file will have a unique time stamp. In the case of a pcap file that should not have the default pcap type (0xa1b2c3d4), the additional option -T must be provided. If a directory is given, then, instead of a single pcap file, multiple pcap files are generated with rotation based on maximum file size or a given interval (-F option). Optionally, sending the SIGHUP signal to the netsniff-ng process causes a premature rotation of the file. A trafgen configuration file can currently only be specified if the input device is a pcap file. To specify a pcap file as the output device, the file name must have '.pcap' as its extension. If stdout is given as a device, then a trafgen configuration will be written to stdout if the input device is a pcap file, or a pcap file if the input device is a networking device. If the input device is a Netlink monitor device and pcap type is default (usec or nsec) then each packet will be wrapped with pcap cooked header [2] to keep Netlink family number (Kuznetzov's and netsniff-ng pcap types already contain family number in protocol number field).

-C <id>, --fanout-group <id> If multiple netsniff-ng instances are being started that all have the same packet fanout group id, then the ingress network traffic being captured is being distributed/load- balanced among these group participants. This gives a much better scaling than running multiple netsniff-ng processes without a fanout group parameter in parallel, but only with a BPF filter attached as a packet would otherwise need to be delivered to all such capturing processes, instead of only once to such a fanout member. Naturally, each fanout member can have its own BPF filters attached.

-K <hash|lb|cpu|rnd|roll|qm>, --fanout-type <hash|lb|cpu|rnd|roll|qm> This parameter specifies the fanout discipline, in other words, how the captured network traffic is dispatched to the fanout group members. Options are to distribute traffic by the packet hash ('hash'), in a round-robin manner ('lb'), by CPU the packet arrived on ('cpu'), by random ('rnd'), by rolling over sockets ('roll') which means if one socket's queue is full, we move on to the next one, or by NIC hardware queue mapping ('qm').

-L <defrag|roll>, --fanout-opts <defrag|roll> Defines some auxiliary fanout options to be used in addition to a given fanout type. These options apply to any fanout type. In case of 'defrag', the kernel is being told to defragment packets before delivering to user space, and 'roll' provides the same roll-over option as the 'roll' fanout type, so that on any different fanout type being used (e.g. 'qm') the socket may temporarily roll over to the next fanout group member in case the original one's queue is full.

-f, --filter <bpf-file|-|expr> Specifies to not dump all traffic, but to filter the network packet haystack. As a filter, either a bpfc(8) compiled file/stdin can be passed as a parameter or a tcpdump(1)-like filter expression in quotes. For details regarding the bpf-file have a look at bpfc(8), for details regarding a tcpdump(1)-like filter have a look at section 'filter example' or at pcap-filter(7). A filter expression may also be passed to netsniff-ng without option -f in case there is no subsequent option following after the command-line filter expression.

-t, --type <type> This defines some sort of filtering mechanisms in terms of addressing. Possible values for type are 'host' (to us), 'broadcast' (to all), 'multicast' (to group), 'others' (promiscuous mode) or 'outgoing' (from us).

-F, --interval <size|time> If the output device is a folder, with '-F', it is possible to define the pcap file rotation interval either in terms of size or time. Thus, when the interval limit has been reached, a new pcap file will be started. As size parameter, the following values are accepted '<num>KiB/MiB/GiB'; As time parameter, it can be '<num>s/sec/min/hrs'.

-J, --jumbo-support By default, in pcap replay or redirect mode, netsniff-ng's ring buffer frames are a fixed size of 2048 bytes. This means that if you are expecting jumbo frames or even super jumbo frames to pass through your network, then you need to enable support for that by using this option. However, this has the disadvantage of performance degradation and a bigger memory footprint for the ring buffer. Note that this doesn't affect (pcap) capturing mode, since tpacket in version 3 is used!

-R, --rfraw In case the input or output networking device is a wireless device, it is possible with netsniff-ng to turn this into monitor mode and create a mon<X> device that netsniff-ng will be listening on instead of wlan<X>, for instance. This enables netsniff-ng to analyze, dump, or even replay raw 802.11 frames.

-n <0|uint>, --num <0|uint> Process a number of packets and then exit. If the number of packets is 0, then this is equivalent to infinite packets resp. processing until interrupted. Otherwise, a number given as an unsigned integer will limit processing.

-O <N>, --overwrite <N> A number from 0 to N-1 will be used in the file name instead of a Unix timestamp. The previous file will be overwritten when number wraps around. The maximum value is 2^32 - 1. Intended for rotating capture files when used with options -F and -P.

-P <name>, --prefix <name> When dumping pcap files into a folder, a file name prefix can be defined with this option. If not otherwise specified, the default prefix is 'dump-' followed by a Unix timestamp. Use '--prefex ""' to set filename as seconds since the Unix Epoch e.g. 1369179203.pcap

-T <pcap-magic>, --magic <pcap-magic> Specify a pcap type for storage. Different pcap types with their various meta data capabilities are shown with option -D. If not otherwise specified, the pcap-magic 0xa1b2c3d4, also known as a standard tcpdump-capable pcap format, is used. Pcap files with swapped endianness are also supported.

-D, --dump-pcap-types Dump all available pcap types with their capabilities and magic numbers that can be used with option '-T' to stdout and exit.

-B, --dump-bpf If a Berkeley Packet Filter is given, for example via option '-f', then dump the BPF disassembly to stdout during ring setup. This only serves for informative or verification purposes.

-r, --rand If the input and output device are both networking devices, then this option will randomize packet order in the output ring buffer.

-M, --no-promisc The networking interface will not be put into promiscuous mode. By default, promiscuous mode is turned on.

-N, --no-hwtimestamp Disable taking hardware time stamps for RX packets. By default, if the network device supports hardware time stamping, the hardware time stamps will be used when writing packets to pcap files. This option disables this behavior and forces (kernel based) software time stamps to be used, even if hardware time stamps are available.

-A, --no-sock-mem On startup and shutdown, netsniff-ng tries to increase socket read and write buffers if appropriate. This option will prevent netsniff-ng from doing so.

-m, --mmap Use mmap(2) as pcap file I/O. This is the default when replaying pcap files.

-G, --sg Use scatter-gather as pcap file I/O. This is the default when capturing pcap files.

-c, --clrw Use slower read(2) and write(2) I/O. This is not the default case anywhere, but in some situations it could be preferred as it has a lower latency on write-back to disc.

-S <size>, --ring-size <size> Manually define the RX_RING resp. TX_RING size in '<num>KiB/MiB/GiB'. By default, the size is determined based on the network connectivity rate.

-k <uint>, --kernel-pull <uint> Manually define the interval in micro-seconds where the kernel should be triggered to batch process the ring buffer frames. By default, it is every 10us, but it can manually be prolonged, for instance.

-b <cpu>, --bind-cpu <cpu> Pin netsniff-ng to a specific CPU and also pin resp. migrate the NIC's IRQ CPU affinity to this CPU. This option should be preferred in combination with -s in case a middle to high packet rate is expected.

-u <uid>, --user <uid> resp. -g <gid>, --group <gid> After ring setup drop privileges to a non-root user/group combination.

-H, --prio-high Set this process as a high priority process in order to achieve a higher scheduling rate resp. CPU time. This is however not the default setting, since it could lead to starvation of other processes, for example low priority kernel threads.

-Q, --notouch-irq Do not reassign the NIC's IRQ CPU affinity settings.

-s, --silent Do not enter the packet dissector at all and do not print any packet information to the terminal. Just shut up and be silent. This option should be preferred in combination with pcap recording or replay, since it will not flood your terminal which causes a significant performance degradation.

-q, --less Print a less verbose one-line information for each packet to the terminal.

-X, --hex Only dump packets in hex format to the terminal.

-l, --ascii Only display ASCII printable characters.

-U, --update If geographical IP location is used, the built-in database update mechanism will be invoked to get Maxmind's latest database. To configure search locations for databases, the file /etc/netsniff-ng/geoip.conf contains possible addresses. Thus, to save bandwidth or for mirroring of Maxmind's databases (to bypass their traffic limit policy), different hosts or IP addresses can be placed into geoip.conf, separated by a newline.

-w, --cooked Replace each frame link header with Linux "cooked" header [3] which keeps info about link type and protocol. It allows to dump and dissect frames captured from different link types when -i "any" was specified, for example.

-V, --verbose Be more verbose during startup i.e. show detailed ring setup information.

-v, --version Show version information and exit.

-h, --help Show user help and exit.