I have a network with several Hosts N1, N2, N3, ... and they all communicate with each other. I'm in the N2 host CLI with linux. Can you know how much traffic was in bytes between a N2 Host and N3 in a period of time? In this case, total traffic and not speed of communication.

  • You could possibly look into adding a custom IPTables rule that logs traffic from your host to a specific ip address. But I am not sure you would get aggregate traffic (packets I believe) in the logs, you might see that in the iptables -vnL output for the custom rule though. – datUser Apr 11 at 14:28

I use:

    iptables -N INET_IN  
    iptables -A INPUT -j INET_IN  
    iptables -A INET_IN -s  

I send a file with NetCat of the Host 1.

    #100MB File
    dd if=/dev/urandom of=ffile.txt bs=1048576 count=100  
    cat ffile.txt |  nc 1001  

In Host 2.

     nc -l -p 1001 > /tmp/x.x 

View the result:

    Chain INET_IN (1 references)  
    pkts bytes target     prot opt in     out     source               destination      
    2575  105M            all  --  *      *  

And can use this command to flush results

    iptables -Z INET_IN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.