IPACCT(8)

NAME
ipacct - control the per user ip accounting

SYNOPSIS
ipacct [ -aChnrvVw ] [ -c user ] [ -d user ] [ -g user ] ipacct add addr [ mask addr ] [ weight int ] ipacct add default [ weight int ] ipacct del addr [ mask addr ]

DESCRIPTION
Ipacct prints the per user ip accounting data from the kernel and can also be used to control certain features of the accounting.

    ipacct add addr [ mask addr ] [ weight int ]

In this form ipacct adds addr to the kernel weight table. Mask specifies the netmask to use for this address. The decision if an entry matches is made just like in the routing of ip packets. The third argument is the weight argument which specifies with how much bytes a byte sent or received to/from this address gets accounted in the statistics. It is possible to leave out both the mask and the weight argument. In this case a default weight of one is chosen and a reasonable default for the netmask, too: If the addresses ends in a non zero value, it is assumened to be a full host address. If not so, a default net mask is chosen which matches the class of the specified net. That is, for a class c net the mask is 255.255.255.0, for a class b net 255.255.0.0 and 255.0.0.0 of a class a net.

    ipacct add default [ weight int ]

In this form ipacct changes the default weight used for all addresses that are not found in the weight table. If you leave out the weight argument a weight of one is assumened.

    ipacct del addr [ mask addr ]

In this third and last form ipacct deletes the specified address from the weight table. If you leave out the weight argument a default is chosen for the netmask (see above).

OPTIONS
The options are as follows:

-a  Read the weight table from the file /etc/ip_acct_user

    Example:
    -------------------------------------------------
    # /etc/ip_acct_user
    #
    # format: <address> <addressmask> <weight>
    127.0.0.1       255.255.255.255         0
    192.0.2.100     255.255.255.255         0
    -------------------------------------------------

-c user
    Reset the sent/received counters for a specific user, numeric user ids and user names are allowed

-C  Reset all sent/received counters

-d user
    Disallow net access for this user (excluding access to hosts with a weight of zero)

-g user
    Allow net access for this user (reverses -d user option)

-h  Display a short usage description

-n  Don't display any headers in the statistics

-r  Display the statistics in raw format (like in /proc/net/ip_acct_user , /proc/net/ip_acct_weight respectively)

-v  Display version of ipacct

-V  Display version of the kernel driver that ipacct was compiled with

-w  Display weight table instead of accounting table

EXAMPLES
ipacct add 127.0.0.1 weight 0

    Exclude localhost (127.0.0.1) from the statistics, that is, every byte sent or received to/from localhost is accounted as zero bytes.

ipacct add 192.0.2.0 mask 255.255.255.0 weight 0

    Exclude the class c net 192.0.2.0 from the statistics.

ipacct add 192.0.2.100 weight 1024

    Every byte received or transmitted from/to host 192.0.2.100 is accounted as 1024 bytes in the statistics.

ipacct del 127.0.0.1

    Remove this entry from the weight table.

ipacct del 192.0.2.0 mask 255.255.255.0

    Remove this class c net from the table.

FILES
/proc/net/ip_acct_user /proc/net/ip_acct_weight /etc/ip_acct_user

BUGS
This is more a caveat than a bug: Some of ipacct's options (especially -d, -g, -c and -C ) might interact with the ipquota(8) and ipacctd(8) programs, because ipquota changes the values which are also altered by the above mentioned options.

SEE ALSO
ipacctd(8) ipquota(8)

AUTHOR
Lars Fenneberg (lf@gimli.comlink.de)