If I'm using SSH to remote into a machine and I'm running a command like: sudo iptables -L -v -n how do I get a packet hit count that excludes the packet traffic I'm creating by using SSH?

I mean I could just avoid that by logging in to the machine directly, but I doubt that is always the case...or do I just have to add a rule to catch the specific type of traffic I want to monitor?


Your best bet is to add a separate rule for your SSH connections, so that they do not mix with the other flows. Something like this:

-A INPUT -s <your client IP address> -p tcp --dport 22 -j ACCEPT

You can also remove the IP address match if you want to separate all SSH traffic, add a match for a particular interface, etc.

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.