| 1 |
IPacc v0.1 |
| 2 |
Using IP accounting kernel rules to feed mrtg. |
| 3 |
|
| 4 |
1. Abstract |
| 5 |
I am using the old ipfwadm style for doing this for backwards compatibility, |
| 6 |
and because it's enough for my purpose. |
| 7 |
For those who have kernels higher than 2.0 (using IPchains), like 2.1 or 2.2. |
| 8 |
I have included the ipfwadm-wrapper by Paul Russel. |
| 9 |
So if you if you are running on 2.2 (like me), you should copy this to |
| 10 |
/sbin/ipfwadm. |
| 11 |
It's a little slow, but it's done with sh. |
| 12 |
|
| 13 |
With this script you may generate trafic grahs for any IP, any networks or subnetworks. |
| 14 |
I haven't done support for icmp prot. |
| 15 |
|
| 16 |
2. Syntax |
| 17 |
|
| 18 |
You use the exact sintax as with ipfwadm |
| 19 |
ipacc [mode] [-S source_ip/net_bits [port1 port2 ...]] [-D dest_ip/net_bits [port1 port 2 ...]] |
| 20 |
|
| 21 |
where: |
| 22 |
mode - is either "in" or "out", if you don't specify any there will be |
| 23 |
included 2 rules in this fashion: |
| 24 |
in -S source_ip/net_bits sport1 sport2 -D dest_ip/net_bits port1 port2 |
| 25 |
out -S dest_ip/net_bits dport1 dport2 -D source_ip/net_bits sport1 sprot2 |
| 26 |
|
| 27 |
source_ip & dest_ip - are the dotted ip address of the source and the |
| 28 |
destination (IP address not hosts) |
| 29 |
net_bits - are number of bits used by the network+subnetwork if any |
| 30 |
(that is 24 for a whole class C or 25 for half a C class ...) |
| 31 |
you don't have to specify any if you are doing it for a host |
| 32 |
portN - the ports where the packet it comming from and is going to |
| 33 |
|
| 34 |
|
| 35 |
3. The printings |
| 36 |
|
| 37 |
If you are using one way |
| 38 |
ipacc will print |
| 39 |
inbytes, 0, uptime, server_name for an "in" mode rule |
| 40 |
or |
| 41 |
0, outbytes, uptime, server_name for an "out" mode rule |
| 42 |
for both ways (in - out) |
| 43 |
it will print |
| 44 |
inbytes, outbytes, uptime, server_name |
| 45 |
|
| 46 |
inbytes, outbytes - the numbers read from the ipfwadm command |
| 47 |
uptime - is what the uptime command will print |
| 48 |
server_name - is what you'll write at the server name in the script |
| 49 |
|
| 50 |
So you will add something like |
| 51 |
|
| 52 |
Target[ipaddr]: `ipacc arguments` |
| 53 |
|
| 54 |
|
| 55 |
Cristian Caramida <[email protected]> |
| 56 |
and soon <[email protected]> |
| 57 |
|
| 58 |
4. End |