wiki'd

by JoKeru

IP Accounting with pmacct

[cc lang='bash']
\$ apt-get install pmacct
\$ vi /etc/pmacct/pmacctd.conf
\$ vi /etc/pmacct/hosts
\$ /etc/init.d/pmacct restart

\$ pmacct -s
SRC_IP DST_IP PACKETS BYTES
0.0.0.0 5.4.3.2 1681 808962
0.0.0.0 1.2.3.4 25 2168
1.2.3.4 0.0.0.0 38 2644
5.4.3.2 0.0.0.0 1412 113360
0.0.0.0 0.0.0.0 251663 144353074
For a total of: 5 entries

\$ pmacct -c src_host -N 5.4.3.2
1397843
\$ pmacct -c dst_host -N 5.4.3.2
9464605
[/cc]

/etc/pmacct/pmacctd.conf
[cc lang='bash']
daemonize: true
pidfile: /var/run/pmacctd.pid
syslog: daemon

interface: eth0
aggregate: src_host,dst_host
networks_file: /etc/pmacct/hosts
plugins: memory
[/cc]

/etc/pmacct/hosts
[cc lang='bash']
5.4.3.2/32
1.2.3.4/32
[/cc]

Comments