Answer the question
In order to leave comments, you need to log in
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
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 }'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question