I
I
Ilya Plotnikov2015-10-05 12:12:10
Debian
Ilya Plotnikov, 2015-10-05 12:12:10

How can I calculate traffic from iptables?

Good day, gentlemen.
I have an iptables gateway. I wanted to count the traffic by interfaces, and it would not hurt to see who goes where and where. Googled for an hour, of the working options, only forward http through squid. I remember this option from the early 2000s. Perhaps you have already come up with something better? Prompt, than it is better to count a traffic on the gateway?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mars natsuhiboshi, 2015-10-05
@mars_unique

Somehow it could always seem like this:

#создаем чейн
iptables -N TRAFFIC_ACCT_IN
#клеим интерфейс
iptables -I FORWARD -i eth0 -j TRAFFIC_ACCT_IN
#туда-же адрес
iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.2
#А потом занимаемся математикой и выводим результат
iptables -L TRAFFIC_ACCT_IN -n -v -x | awk '$1 ~ /^[0-9]+$/ { printf "IP: %s, %d bytes\n", $8, $2 }'

V
Vladimir, 2015-10-05
@rostel

collect and analyze Netflow logs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question