Calculate upload/download speed by ping

I used ping to calculate bandwidth in local network. I think it’s as accurate as other means of measuring bandwidth (e.g. downloading a big file). You can use it too for your internet connection if you have a symmetric link to the internet (i.e. not adsl).

Here’s how I do it:

I have a gigabit ethernet LAN and I want to measure speed between my computer and a host in server room. My MTU is 1500, so I use packet size 1472. Just randomly, I use 83,333 packets in this test (about 1 gigabit). Then:

sudo ping -f -c 83333 -s 1472 192.168.3.103

at the end of the result i get:

round-trip min/avg/max/stddev = 0.174/0.219/2.078/0.020 ms

so in average it takes 0.219 ms to send 1500 bytes and receive 1500 bytes, that’s 24 kb.

24 kb / 0.219 ms = 110 Mb/s

If you want to use that to a server on the internet, you need to lower the packet size to something like 1464 (for MTU 1492), drop the -f option and lower the count so it won’t take too long to finish.

p.s. I think this should go to superuser, not stackoverflow.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)