Skip to main content

Building an automated iPerf3 server with Ubuntu on Odroid C1+

The Odroid devices make great iPerf servers for portable use as they can be powered by 5V micro USB and have a Gigabit Ethernet adapter on its own bus so they don’t have the limitations the Raspberry Pi’s do. OK, let’s get started.
We are going to assume that you already have Ubuntu 16.04 up and running but if not, you can download official images here http://odroid.com/dokuwiki/doku.php?id=en:c1_release_linux_ubuntu. Extract the downloaded image and burn it to a SD Card using Win32 Disk Imager. I only used a 2GB card and it works fine. First boot might take a minute or two. After it’s booted, scan your network (Fing) to find your device IP. It should show up as a device by JF Light Industries with the MAC vendor as Wibrain.
  1. Launch a SSH session (root:odroid for the Ubuntu 16.04 minimal image) and type:sudo apt-get install iperf3 
  2. Once installed, you can run:sudo iperf3 -s (CTRL + C to exit)
The -s switch starts iperf3 in server mode. However, I was interested in automating this a bit more. I wanted to be able to have iperf3 start up when the server did, with no interaction necessary. This allows for any of our engineers to use iperf3 without worrying if it has been started up. To do this, run the following commands:
  1. sudo touch /etc/init.d/iperf3 
  2. sudo chmod +x /etc/init.d/iperf3
These two commands create a script called iperf3 and make it executable. Next, we’ll load the script in nano:
  1. sudo nano /etc/init.d/iperf3
  2. and add the following lines:
    #!/bin/bash

    /usr/bin/iperf3 -s &

then save the file. You can add any switch you would like. Run iperf3 –help to see a full list of switches. Finally, we need to tell Ubuntu when we want iperf3 to run during the boot sequence:
 

sudo update-rc.d iperf3 defaults

Ok, our server should be setup. To recap, we installed iperf3 from the default Ubuntu repos and automated its start up. The service should be running after a reboot. Type sudo reboot to reboot your Odroid and see if iPerf is running.

To test, run an instance of iPerf3 in client mode on your MAC, PC or phone with something like this:

Upload
iperf3.exe -c ip.of.your.Odroid -w 640k -P 5 -t 60

Download
iperf3.exe -c ip.of.your.Odroid -w 640k -P 5 -t 60 -R

-w, --window n[KM]     Sets the socket buffer sizes to the specified value. For TCP, this sets the TCP window size. (this gets sent to the server and used on that side too)
-P, --parallel n     The number of simultaneous connections to make to the server. Default is 1.
-t, --time n     The time in seconds to transmit for. Default is 10 seconds.
-R, --reverse     Run in reverse mode (server sends, client receives).

From my Gigabit connected Lenovo X220 I get the following under test with the Odroid C1+ also connected to Ethernet.

image 


If you want to run iPerf2 instead, simply remove all the instances of the numeral ‘3’ from the code above.


N.B To prevent crashing your SD Card, you should SSH into the box and run shutdown or shutdown now to gracefully turn the Odroid off. (I use the excellent 'SSH button' available for Android only here).

Good luck.

Comments

Popular posts from this blog

Using ESPEasy with Home Assistant via MQTT

Preface: I've just started playing around with Home Assistant on a Raspberry Pi and exploring the world of MQTT to control devices on the network. Learning curve is a bit steep but worth the effort as MQTT is very fast. The hardware and software tools I'm using are as follows: 2 x Sonoff relay units 2 x NodeMCU Boards ESPEasy firmware (must be version 121 or above as that contains the MQTT 'retain' flag option. Home Assistant software on Raspberry Pi2 MQTT Test Software: PC: MQTT.fx Android: MQTT Dashboard

My Notepad++ tricks when editing YAML files in Home Assistant

To comment out a whole section in one go: Highlight the text you want to comment out and use CTRL + Q. If you do this at the start of a line, it will only comment that line. CTRL + Q is toggle mode (comment on/off). CTRL + K will allow you to add multiple comments one after the other.

How to check what entities are filling up your Home Assistant database

If you use the Home Assistant MariaDB add-on, this tip will show you how to query the database so see what Home Assistant entity states are triggering the most, filling up your database. What were going to do: Install the phMyAdmin add-on for MariaDB. Query the MariaDB database. See what entity state changes have the most action. Paste the code below into the SQL query box:  select entity_id,count( * ) from states group by entity_id order by count ( * ) desc; And if you're using the internal home-assistant_v2.db instead, you can use the SQLite Web add-on to achieve the same thing.