M. A. Imam wrote:
Hi,
How can i count the number of packets on an interface evry 2 or 5 seconds. and
i want to count only specific packets like only arriving packets from port
5001
Any ideas...
Muhammad
iptables -L -v will show packet counts and byte counts on rules so,
using your specific example and assuming you meant tcp port 5001
First create a matching rule that has no target
# iptables -I INPUT 1 -p tcp --dport 5001
Then, every x seconds run
iptables -L -v -n
and parse out the counter of interest.
Hope that helps,
SCampbell