Nc: mengukur bandwidth

From OnnoWiki
Revision as of 05:37, 3 June 2015 by Onnowpurbo (talk | contribs) (New page: You can do pretty much the same thing with plain old nc (netcat) if you're that way inclined. On the server machine: nc -vvlnp 12345 >/dev/null And the client can pipe a gigabyte of zero...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can do pretty much the same thing with plain old nc (netcat) if you're that way inclined. On the server machine:

nc -vvlnp 12345 >/dev/null

And the client can pipe a gigabyte of zeros through dd over the nc tunnel.

dd if=/dev/zero bs=1M count=1K | nc -vvn 10.10.0.2 12345

As demod:

$ dd if=/dev/zero bs=1M count=1K | nc -vvn 10.10.0.2 12345 Connection to 10.10.0.2 12345 port [tcp/*] succeeded! 1024+0 records in 1024+0 records out 1073741824 bytes (1.1 GB) copied, 9.11995 s, 118 MB/s

The timing there is given by dd but it should be accurate enough as it can only output as fast the pipe will take it. If you're unhappy with that you could wrap the whole thing up in a time call.

Remember that the result is in megabytes so multiply it by 8 to get a megabits-per-second speed. The demo above is running at 944mbps.


Referensi