Jaime Gago Condensing Information Systems From the Vapor Of Data

4Dec/091

Network Bandwidth Testing At The Command Line

Whether when I’ve been designing networks for schools or BYOC parties , I’ve played with ethernet cables long Bangkok_traffic_by_g-hatenough to allow some custom tricks when it comes to bandwidth. The point of this post is *testing* not troubleshooting laaaaaaaaaag nor monitoring.

Nothing can truly emulate a bunch of hardcore gamers, leechers, hackers pushing your network to its limits but prior to opening your RJ45 gates you can certainly do some testing with the help of some command line tools and some basic scripting.

To test Internet bandwidth I like curl because it has everything I need:

-Free as in speech

-Ships with Os X, many Linux distros and is even available for “this other OS.”

-Can output transfer rates

-Can upload & download

-Supports http and ftp amongst many other protocols

-Command Line and Non Interactive (understand can be scripted)

The next thing is to find a large file and an uploading space both in the cloud, [ I usually download a 700MB Linux distribution (e.g. Ubuntu) ] and then I upload it via ftp.

On Os X environments I use Apple Remote Desktop to “Send A Unix Command” to multiple hosts all at once. The beauty of ARD is that you get the output results in a single file but if you need to dig deeper check Automator/AppleScript .

In a Linux environment the same KISS method of “curling” large files on multiple computers should work, just open a SSH session on each host.

For the LAN bandwidth I could still use curl for instance if I needed to test the connection to the Intranet webserver. Thing is curl does not deal with protocols such as NFS or SMB which in my case are the ones responsible for most of the user generated LAN traffic, thus I need another tool.

In the past few years I’ve dealt a lot with AFP (I am currently managing 350+ Macs including some X Serves) so I use what Apple calls “sharepoints” to mount a remote volume via AFP. After that I return to ARD and “send a unix command” (i.e. the obvious cp). To find out the transfer rate with cp I use a 3 line script cheap trick: I touch 2 files, one before the cp command one after, then I use ls -lT | cut to get creation times, followed by 1st grader arithmetic and I get my bits per second. If you want to be fancy and all you can play with your ls -lT output and bc , /me don’t. When you think about it these are fairly simple and quite cheap methods to get my precious "real" numbers.

Here is the details of the bash commands I use:

Internet

#download
curl path_to_online_large_file -o path_to_local_file
#upload
curl  -u ftpusername:password ftp://_ftp_server_dir -T path_to_local_file
#remove the mess
rm path_to_local_file
your_way_to_delete_files_over_ftp

Lan

#mount the remote partition/volume

(mount_afp)

#create timestamp files and copy a 1 GB file
touch foo
cp path_to_remote_source target
touch foobar
#get the timestamps
ls -lT foo foobar | cut -d” “ -f11
#remove the mess
rm target foo foobar
Filed under: Network Leave a comment
Comments (1) Trackbacks (1)
  1. For Lan environment you can also use

    time cp file1 file2


Leave a comment