Tuesday, April 26, 2016

Netowrk : Testing network speeds in Linux

General checks and system information

Check hardware details:
[root] cat /proc/cpuinfo
Check free and used memory on the system:
[root] free -m
Check operating system release level:
[root] uname -r
Check the last users (and IP) that logged into the system:
[root] last -a

Testing the hard disk

Using hdarm to test the HDD 'physical' speed

Install hdarm and test on every drive on each computer.
For debian-based, from the terminal run:
[root] apt-get install hdparm
For Arch, from the terminal run:
[root] pacman -S hdparm
Test speeds using the following command:
[root] hdparm -tT /dev/hdDrive
Note: The command above is where /dev/hdDrive is the location of your device. Usually a drive will be listed as sdasdbhda or hdb etc. Run fdisk -l to list the drives.

Using dd to test the HDD read/write speed

First, check there is 1GB free on /tmp directory:
$ df -h /tmp
Write a file:
$ dd if=/dev/zero of=/tmp/file1gb bs=1024k count=1000000
Read a file:
$ dd if=/tmp/file1gb of=/dev/null bs=1024k count=1000000
Remove the file:
$ rm /tmp/file1gb
The examples above are where:
  • if=/dev/zero: creates a file filled with zeros
  • of=/tmp/file: writes the file here
  • bs=: bs specifies block size (1024k = 1M, can specify other sizes)
  • count=: count specifies the number of blocks (1000 will be: 1000000 x bs (1024x1000000 = 1GB)
  • of=/dev/null: a special file that discards all data written to it

Testing latency

Using ping to test the latency

Ping localhost then compare by pinging all other computers on the network from the same host:
$ ping 127.0.0.1 -c 5
$ ping <hostone> -c 5
$ ping <hosttwo> -c 5

Using traceroute to test the latency

Install traceroute on each computer.
For debian-based, from the terminal run:
[root] apt-get install traceroute
For Arch, from the terminal run:
[root] pacman -S traceroute
Test speeds using the following command:
$ traceroute 127.0.0.1
$ traceroute <hostone>
$ traceroute <hosttwo>

Testing throughput

Using iperf to test the throughput

Install iperf on each computer.
For debian-based, from the terminal run:
[root] apt-get install iperf
For Arch, from the terminal run:
[root] pacman -S iperf
From the server start iperf in server mode:
[root] iperf -s -f m -t 60
From the clients, run:
[root] iperf -c <SERVER_IP> -f m -t 60 -d

No comments:

Post a Comment