nfcapd

Langue: en

Version: 257797 (debian - 07/07/09)

Section: 1 (Commandes utilisateur)

NAME

nfcapd - netflow capture daemon

SYNOPSIS

nfcapd [options]

DESCRIPTION

nfcapd
is the netflow capture daemon of the nfdump tools. It reads netflow data from the network and stores it into files. The output file is automatically rotated and renamed every n minutes - typically 5 min - according the timestamp YYYYMMddhhmm of the interval e.g. nfcapd.200407110845 contains the data from July 11th 2004 08:45 onward.

Netflow version v5, v7 and v9 are transparently supported.

OPTIONS

-p portnum
Specifies the port number to listen. Default port is 9995
-b bindhost
Specifies the hostname/IPv4/IPv6 address to bind for listening. Can be an IP address or a hostname, resolving to an IP address attached to an interface. Defaults to any available IPv4 interface, if not specified.
-4
Forces nfcapd to listen on IPv4 addresses only. Can be used together with -b if a hostname has an IPv4 and IPv6 address record.
-6
Forces nfcapd to listen on IPv6 addresses only. Can be used together with -b if a hostname has an IPv4 and IPv6 address record.
-j MulticastGroup
Join the specified IPv4 or IPv6 multicast group for listening.
-R host[/port}
Enable packet repeater. Send all incoming packets to another host and port. host is either a valid IPv4/IPv6 address, or a valid symbolic hostname, which resolves to a IPv6 or IPv4 address. port may be ommited and defaults to port 9995. Note: Due to IPv4/IPv6 accepted addresses the port separator is '/'.
-I IdentString ( capital letter i )
Specifies an ident string, which describes the source e.g. the name of the router. This string is put into the stat record to identify the source. Default is 'none'. This is for compatibility with nfdump 1.5.x and used to specify a single netflow source. See -n
-l base_directory ( letter ell )
Specifies the base directory to store the output files. Default is /var/tmp If a sub hierarchy is specified with -S the final directory is concatenated to base_directory/sub_hierarchy. This is for compatibility with nfdump 1.5.x and used to specify a single netflow source. See -n
-n <Ident,IP,base_directory>
Configures a netflow source named Ident and identified by source IP address IP. The base directory for the flow files is Ident. If a sub hierarchy is specified with -S the final directory is concatenated to base_directory/sub_hierarchy. Multiple netflow sources can be specified. All data is sent to the same port specified by -p You must not mix -n option with -I and -l. Use either syntax.
-S <num>
Allows to specify an additional directory sub hierarchy to store the data files. The default is 0, no sub hierarchy, which means the files go directly in the base directory (-l). The base directory (-l) is concatenated with the specified sub hierarchy format to form the final data directory. The following hierarchies are defined:

 0 default     no hierachy levels

 1 %Y/%m/%d    year/month/day

 2 %Y/%m/%d/%H year/month/day/hour

 3 %Y/%W/%u    year/week_of_year/day_of_week

 4 %Y/%W/%u/%H year/week_of_year/day_of_week/hour

 5 %Y/%j       year/day-of-year

 6 %Y/%j/%H    year/day-of-year/hour

 7 %Y-%m-%d    year-month-day

 8 %Y-%m-%d/%H year-month-day/hour
-T <extension list>
Specifies the list of extensions, which are stored in the netflow file. Regardless of the extension list, the following netflow data is stored per record: first, last, fwd status, tcp flags, proto, (src)tos, src port, dst port, src ipaddr, dst ipaddr, in(packets), in(bytes). In addition nfdump recognises extensions as described below. Some are valid for v5/v7/v9, some only for v9. The protocol is transparent to the user. Any specified extension which does not exist in the input netflow records is ignored.

   Extensions:

 1 input/output interface SNMP numbers.

 2 src/dst AS numbers.

 3 src/dst mask, (dst)TOS, direction, 

 4 Next hop IP addr

 5 BGP next hop IP addr

 6 src/dst vlan id labels

 7 counter output packets

 8 counter output bytes

 9 counter aggregated flows
10 in_src/out_dst MAC address
11 in_dst/out_src MAC address
By default extension 1 and 2 are selected, which provides compatibility with earlier nfdump version. Extensions can be modified by specifying a ',' separated list of extension ids. Each id may be prepended by an optional sign +/- to add or remove a given id from the extension list. A single '*' means all extensions.


Examples:
-T +3,+4 Adds extensions 3 and 4 to the defaults 1 and 2.
-T *,-8,-9 Set all extensions but 8 and 9
-T -1,4 Removes default extension 1 and adds extension 4
-t interval
Specifies the time interval in seconds to rotate files. The default value is 300s ( 5min ).
-w
Align file rotation with next n minute ( specified by -t ) interval. Example: If interval is 5 min, sync at 0,5,10... wall clock minutes Default: no alignment.
-x cmd
Run command cmd at the end of every interval, when a new file becomes available. The following command expansion is available:
%f     Replaced by the file name e.g nfcapd.200407110845 inluding any


     sub hierachy. ( 2004/07/11/nfcapd.200407110845 )
%d     Replaced by the directory where the file is located.

%t     Replaced by the time ISO format e.g. 200407110845.

%u     Replaced by the UNIX time format.

%i     Replaced ident string given by -I
-e
Auto expire files at every cycle. max lifetime and max filesize are defined using nfexpire(1)
-P pidfile
Specify name of pidfile. Default is no pidfile.
-D
Daemon mode: fork to background and detach from terminal. Nfcapd terminates on signal TERM, INT and HUP.
-u userid
Change to the user userid as soon as possible. Only root is allowed to use this option.
-g groupid
Change to the group groupid as soon as possible. Only root is allowed use this option.
-B bufflen
Specifies the socket input buffer length in bytes. For high volume traffic ( near GB traffic ) it is recommended to set this value as high as possible ( typically > 100k ), otherwise you risk to lose packets. The default is OS ( and kernel ) dependent.
-E
Print netflow records in nfdump raw format to stdout. This option is for debugging purpose only, to see how incoming netflow data is processed and stored.
-z
Compress flows. Use fast LZO1X-1 compression in output file.
-V
Print nfcapd version and exit.
-h
Print help text to stdout with all options and exit.

RETURN VALUE

Returns 0 on success, or 255 if initialization failed.

LOGGING

nfcapd logs to syslog with SYSLOG_FACILITY LOG_DAEMON For normal operation level 'warning' should be fine. More information is reported at level 'info' and 'debug'.

A small statistic about the collected flows, as well as errors are reported at the end of every interval to syslog with level 'info'.

EXAMPLES

nfcapd -z -w -D -l /netflow/spool/router1 -S "%Y/%m/%d/%H"

nfcapd -w -D -l /netflow/spool/router1 -p 23456 -B 128000 -I router1 -x '/path/nfprofile -p /to/profile/dir -s router1 -r %d/%f' -P /var/run/nfcapd/nfcapd.router1

NOTES

The current v9 implementation of nfdump supports the following v9 elements: fields:

v9 element v9 ID Extension
NF9_LAST_SWITCHED 21 default
NF9_FIRST_SWITCHED 22 default
NF9_IN_BYTES 1 default
NF9_IN_PACKETS 2 default
NF9_IN_PROTOCOL 4 default
NF9_SRC_TOS 5 default
NF9_TCP_FLAGS 6 default
NF9_FORWARDING_STATUS 89 default
NF9_IPV4_SRC_ADDR 8 default
NF9_IPV4_DST_ADDR 12 default
NF9_IPV6_SRC_ADDR 27 default
NF9_IPV6_DST_ADDR 28 default
NF9_L4_SRC_PORT 7 default
NF9_L4_DST_PORT 11 default
NF9_ICMP_TYPE 32 default
NF9_INPUT_SNMP 10 1
NF9_OUTPUT_SNMP 14 1
NF9_SRC_AS 16 2
NF9_DST_AS 17 2
NF9_DST_TOS 55 3
NF9_DIRECTION 61 3
NF9_SRC_MASK 9 3
NF9_DST_MASK 13 3
NF9_IPV6_SRC_MASK 29 3
NF9_IPV6_DST_MASK 30 3
NF9_V4_NEXT_HOP 15 4
NF9_V6_NEXT_HOP 62 4
NF9_BGP_V4_NEXT_HOP 18 5
NF9_BPG_V6_NEXT_HOP 63 5
NF9_SRC_VLAN 58 6
NF9_DST_VLAN 59 6
NF9_OUT_PKTS 24 7
NF9_OUT_BYTES 23 8
NF9_FLOWS_AGGR 3 9
NF9_IN_SRC_MAC 56 10
NF9_OUT_DST_MAC 57 10
NF9_IN_DST_MAC 80 11
NF9_OUT_SRC_MAC 81 11
32 and 64 bit are supported for all counters.

The format of the data files is netflow version independant.

Socket buffer: Setting the socket buffer size is system dependent. When starting up, nfcapd returns the number of bytes the buffer was actually set. This is done by reading back the buffer size and may differ from what you requested.

SEE ALSO

nfdump(1), nfprofile(1), nfreplay(1)

BUGS

No software without bugs! Please report any bugs back to me.