GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
ipacctd(8) FreeBSD System Manager's Manual ipacctd(8)

ipacctd
IP accounting using divert socket

ipacctd [-cdhstvwV] [-b size] [-f file] [-m recs] [-r file] -p port

The ipacctd is intended for IP accounting. divert(4) and corresponding ipfw(8) rules are used for obtaining IP packets.

The following options are available:

size
Set both input and output buffer size of divert(4) socket to size. When number of packets per second is too great it is recommended to set buffer size equal to maximum value (equal to value of sysctl(8) variable kern.ipc.maxsockbuf).
cisco-like accounting output format. In this case the columns packets and bytes are swapped and space symbol are inserted before ip_src.
Do not detach from the controlling terminal (do not call daemon(3) ). Useful for debugging.
file
Dump accounting to the file. The filename string may contain any of the conversion specifications described in the strftime(3).
Display help information (list of supported options).
recs
Set maximum number of records in hash table (by default equal to 30000). The record is a unique combination of ip_src/ip_dst for standard accounting mode and ip_src/ip_dst/s_port/d_port/ip_proto for extended accounting mode. Using this option prevents DoS attacks because for each record in the hash table some amount of operating memory is required.
port
Required option. Set the port number related to correspond divert/tee rule.
file
Specify the name and path to record the ipacctd 's process ID.
Create unix(4) stream socket which can be used to fetch accounting instead of sending SIGHUP. See also IMPLEMENTATION NOTES.
Use tee ipfw(8) rule for obtaining packets ( divert is used by default).
Extended accounting mode (also output ip protocol and TCP/UDP/ICMP ports).
Output the time of writing the first packet in time_t format in the last column.
Show ipacctd version.

The SIGHUP signal causes ipacctd to dump accounting in the default file or specified in -f option. Accounting format is:

ip_from ip_to bytes packets

When -v option is used the accounting output format is:

ip_from s_port ip_to d_port proto bytes packets

If proto is ICMP then s_port is ICMP type and d_port is ICMP sub-code.

The SIGUSR2 signal causes ipacctd to dump current accounting and debugging information to file /var/tmp/ipacctd_dump.

Since 1.43 version option -s is introduced, which is used to fetch accounting via cat(1):

cat /tmp/ipacct/ipacct.<port>

Note that support of unix(4) sockets in cat(1) was introduced in FreeBSD 4.5.

/tmp/ipacct/ipacct.<port>
unix(8) socket used to obtain accounting when -s option is specified
/var/log/ipacct.<port>
default accounting file
/vsr/run/ipacctd.<port>
default process ID file
/var/tmp/ipacctd_dump
default dump file

Typical ipacctd use:
  1. Add ipfw(8) rule
    add 2000 divert 10000 ip from any to any via ppp*
  2. Run ipacctd
    ipacctd -v -p 10000 -f /var/log/ipacct.%F_%T

After these steps when the SIGHUP is sent ipacctd will dump all accounting for IP packets transmitted via ppp interfaces to the file ipacct.YYYY-MM-DD_HH:MM:SS.

All error messages are logged to syslog(3). It is important to pay attention to messages like (port %d) accounting threshold exceeded for %d packet(s) and %d byte(s). They mean that the shown number of packets was received by ipacctd but was not accounted because the number of records in the hash table had been exhausted. The possible solution is to dump accounting more often or to increase the number of records in hash table with option -m.

The ipacctd should work on all versions of FreeBSD that support divert(4) sockets.

divert(4), ipfw(8).

Roman V. Palagin ⟨romanp@unshadow.net⟩.

English version of this manual page has been written by
Sergey Skvortsov ⟨skv@FreeBSD.org⟩.

If you find one - please contact the author.
June 27, 2003 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 8 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.