2

I have an ssh connection that I run to access a remote machine. At present I use autossh to keep the pipe open 24/7.

I am curious as to how much the pipe alone uses bandwidth wise. How can I measure something like this?

note: It is rarely used but handy so it just sits there. So I can make sure nothing is sent for a day while taking measurements if needed.

dibs
  • 123

1 Answers1

2

This could be done with iptables rules to count the packets. I'm assuming that the server is running Ubuntu, so you'd want something like this (assuming that your client's IP is 1.2.3.4):

iptables --insert INPUT 1 --protocol tcp --dport 22 --source 1.2.3.4 -j ACCEPT
iptables --insert OUTPUT 1 --protocol tcp --sport 22 --destination 1.2.3.4 -j ACCEPT

Running iptables -nvL will show the number of packets and total size of packets caught by those rules -- add them up to get the total.

mgorven
  • 31,399