📄 softflowd.8
字号:
.\" $Id: softflowd.8,v 1.17 2006/02/11 11:27:38 djm Exp $.\".\" Copyright (c) 2002 Damien Miller. All rights reserved..\" Portions Copyright (c) 2001 Kevin Steves. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\".\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED..\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..\".Dd October 14, 2002.Dt SOFTFLOWD 8.Os.Sh NAME.Nm softflowd.Nd Traffic flow monitoring.Sh SYNOPSIS.Nm softflowd.Op Fl 6dDh.Op Fl i Ar interface.Op Fl r Ar pcap_file.Op Fl t Ar timeout_name=seconds.Op Fl m Ar max_flows.Op Fl n Ar host:port.Op Fl p Ar pidfile.Op Fl c Ar ctl_sock.Op Fl L Ar hoplimit.Op Fl T Ar track_level.Op bpf_program.Sh DESCRIPTION.Nmis a software implementation of a flow-based network traffic monitor. .Nmreads network traffic and gathers information about active traffic flows. A "traffic flow" is communication between two IP addresses or (if the overlying protocol is TCP or UDP) address/port tuples. .PpThe intended use of.Nm is as a software implementation of Cisco's NetFlow(tm) traffic accountsystem..Nm supports data export using versions 1, 5 or 9 of the NetFlow protocol. .Nm can also run in statistics-only mode, where it just collects summary information.However, too few statistics are collected to make thismode really useful for anything other than debugging..PpNetwork traffic may be obtained by listening on a promiscuous networkinterface or by reading stored.Xr pcap 3files, such as those written by .Xr tcpdump 8 .Traffic may be filtered with an optional.Xr bpf 4program, specified on the command-line as.Ar bpf_prog ..Nmis IPv6 capable and will track IPv6 flows if the NetFlow export protocol supports it (currently only NetFlow v.9 possesses an IPv6 export capability). .Pp.Nmtries to track only active traffic flows.When theflow has been quiescent for a period of time it is expired automatically. Flows may also be expired early if they approach their traffic counts exceed 2Gb or if the number of flows being tracked exceeds .Ar max_flows(default: 8192).In this last case, flows are expired oldest-first. .PpUpon expiry, the flow information is accumulated into statistics which maybe viewed using .Xr softflowctl 8 .If the .Fl noption has been specified the flow informaion is formatted in a UDP datagram which is compatible with versions 1, 5 or 9 of Cisco's NetFlow(tm) accounting export format.These records are sent to the specified.Ar hostand.Ar port .The host may represent a unicast host or a multicast group..PpThe command-line options are as follows:.Bl -tag -width Ds.It Fl n Ar host:portSpecify the .Ar hostand .Ar portthat the accounting datagrams are to be sent to.The host may be specified using a hostname or using a numeric IPv4 or IPv6 address.Numeric IPv6 addresses should be encosed in square brackets to avoid ambiguitybetween the address and the port.The destination port may be a portname listed in .Xr services 5or a numeric port..It Fl i Ar interfaceSpecify a network interface on which to listen for traffic.Either the .Fl ior the.Fl r options must be specified..It Fl r Ar pcap_fileSpecify that.Nmshould read from a .Xr pcap 3packet capture (such as one created with the .Fl woption of .Xr tcpdump 8 )file rather than a network interface. .Nmprocesses the whole capture file and only expires flows when .Ar max_flowsis exceeded. In this mode, .Nmwill not fork and will automatically print summary statistics before exiting..It Fl p Ar pidfileSpecify an alternate location to store the process-id when in daemon mode.Default is .Pa /var/run/softflowd.pid.It Fl c Ar ctlsockSpecify an alternate location for the remote control socket in daemon mode.Default is .Pa /var/run/softflowd.pid.It Fl m Ar max_flowsSpecifies the maximum number of flow to concurrently track.If this limit is exceeded, the flows which have least recently seen trafficare forcibly expired.In practice, the actual maximum may briefly exceed this limit by asmall amount as expiry processing happens less frequently than trafficcollection.The default is 8192 flows, which corresponds to slightly lessthan 800k of working data..It Fl t Ar timeout_name=timeSet the timeout names.Ar timeout_nameto .Ar time Refer to the .Sx Timeoutssection for the valid timeout names and their meanings.The .Ar timeparameter may be specified using one of the formats explained in the .Sx Time Formatssection below..It Fl dSpecify that .Nmshould not fork and daemonise itself..It Fl 6Forces.NmTo track IPv6 flows even if the NetFlow export protocol does not supportreporting them.This is useful for debugging and statistics gathering only..It Fl DPlaces.Nmin a debugging mode.This implies the .Fl dand.Fl 6flags and turns on additional debugging output..It Fl hDisplays commandline usage information..It Fl L Ar hoplimitSets the IPv4 TTL or the IPv6 hop limit to.Ar hoplimit ..Nmwill use the default system TTL when exporting flows to a unicast host.When exporting to a multicast group, the default TTL will be 1(i.e. link-local)..It Fl T Ar track_levelSpecifies what flow elements.Nmshould be used to define a flow..Ar track_levelmay be one of:.Dq full(track everything in the flow, the default),.Dq proto(track source and destination addresses and protocol), or.Dq ip(only track source and destination addresses).Selecting either of the latter options will produce flows with less informationin them (e.g. TCP/UDP ports will not be recorded).This will cause flows to be consolidated, reducing the quantity of output and CPU load that.Nmwill place on the system at the cost of some detail..El.PpAny further commandline arguments will be concatenated together and applied as a .Xr bpf 4packet filter.This filter will cause .Nmto ignore the specified traffic..Ss Timeouts.Pp.Nmwill expire quiescent flows after user-configurable periods.The exact timeout used depends on the nature of the flow.The various timeouts that may be set from the command-line (using the .Fl t option) and their meanings are:.Bl -tag -width Ds.It Ar generalThis is the general timeout applied to all traffic unless overridden by one of the other timeouts..It Ar tcpThis is the general TCP timeout, applied to open TCP connections..It Ar tcp.rstThis timeout is applied to a TCP connection when a RST packet has been sent by one or both endpoints..It Ar tcp.finThis timeout is applied to a TCP connection when a FIN packet has beensent by both endpoints..It Ar udpThis is the general UDP timeout, applied to all UDP connections..It Ar maxlifeThis is the maximum lifetime that a flow may exist for.All flows are forcibly expired when they pass.Ar maxlifeseconds.To disable this feature, specify a .Ar maxlifeof 0..It Ar expintSpecify the interval between expiry checks.Increase this to group more flows into a NetFlow packet.To disable this feature, specify a .Ar expintof 0..El.PpFlows may also be expired if there are not enough flow entries to hold themor if their traffic exceeds 2Gb in either direction. .Xr softflowctl 8may be used to print information on the average lifetimes of flows and the reasons for their expiry..Ss Time Formats.Pp.Nmcommand-line arguments that specify timemay be expressed using a sequence of the form:.Sm off.Ar time Op Ar qualifier ,.Sm onwhere.Ar timeis a positive integer value and.Ar qualifieris one of the following:.Pp.Bl -tag -width Ds -compact -offset indent.It Cm <none>seconds.It Cm s | Cm Sseconds.It Cm m | Cm Mminutes.It Cm h | Cm Hhours.It Cm d | Cm Ddays.It Cm w | Cm Wweeks.El.PpEach member of the sequence is added together to calculatethe total time value..PpTime format examples:.Pp.Bl -tag -width Ds -compact -offset indent.It 600600 seconds (10 minutes).It 10m10 minutes.It 1h30m1 hour 30 minutes (90 minutes).El.Ss Run-time Control.PpA daemonised.Nminstance may be controlled using the .Xr softflowctl 8command.This interface allows one to shut down the daemon, force expiry ofall tracked flows and extract debugging and summary data.Also, upon receipt of a .Dv SIGTERMor .DV SIGINT.Nmwill cause .Nmto exit, after expiring all flows (and thus sending flow export packets if .Fl -n was specified on the commandline).If you do not want to export flows upon shutdown, clear them first with.Xr softflowctl 8 ..Sh EXAMPLES.Bl -tag -width Ds.It softflowd -i fxp0This commandlie will cause .Nmto listen on interface \fBfxp0\fP andto run in statistics gathering mode only (i.e no NetFlow data export)..It softflowd -i fxp0 -n10.1.0.2:4432This commandlie will cause.Nmto listen on interface \fBfxp0\fP andto export NetFlow v.5 datagrams on flow expiry to a flow collector runningon \fB10.1.0.2\fP port \fB4432\fP..It softflowd -v 5 -i fxp0 -n10.1.0.2:4432 -m 65536 -t udp=1m30sThis commandline increases the number of concurrent flows that .Nmwill track to \fB65536\fP and increases the timeout for UDP flows to 90 seconds..It softflowd -v 9 -i fxp0 -n224.0.1.20:4432 -L 64This commandline will export NetFlow v.9 flows to the multicast group 224.0.1.20.The export datagrams will have their TTL set to 64, so multicast receiverscan be many hops away..It softflowd -i fxp0 -p /var/run/sfd.pid.fxp0 -c /var/run/sfd.ctl.fxp0This commandline specifies alternate locations for the control socketand pid file.Similar commandlines are useful when running multiple instances of .Nmon a single machine..El.Sh FILES.Bl -tag -width Ds.It Pa /var/run/softflowd.pidThis file stores the process-id when.Nmis in daemon mode.This location may be overridden using the .Fl pcommand-line option..It Pa /var/run/softflowd.ctlThis is the remote control socket. .Nm listens on this socket for commands from .Xr softflowctl 8 . This location may be overridden using the .Fl ccommand-line option..El.Sh BUGSCurrently.Nmdoes not handle maliciously fragmented packets properly, i.e. packets fragemented such that the UDP or TCP header does not fit into the firstfragment.It will product correct traffic counts when presented with maliciously fragmented packets, but will not record TCP or UDP port information..Sh AUTHORSDamien Miller <djm@mindrot.org>.Sh SEE ALSO.Xr softflowctl 8 ,.Xr tcpdump 8 ,.Xr pcap 3 ,.Xr bpf 4.Bd -literalhttp://www.cisco.com/univercd/cc/td/doc/product/rtrmgmt/nfc/nfc_3_0/nfc_ug/nfcform.htm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -