Testing connection speed between two computers

I’ve expanded my home network with new switch and I wanted to test the connection speed between different computers. At first, I ran rsync, but I’ve quickly realised it’s limited by source/destination read/write speeds.
I found better way of measuring connection speed using netcat:

# start listening on one computer ie
nc -vvlnp 12345 < /dev/null

# start broadcasting ~100MB from another computer
dd if=/dev/zero bs=1M count=100 | nc -vvn 12345
## 104857600 bytes (105 MB) copied, 8.89602 s, 11.8 MB/s

You can use more sophisticated tools for the same purpose ie. iperf:

# install on both boxes
sudo apt-get install iperf

# start server in one computer
iperf -s

# measure connection speed from client(s)
iperf -c server_IP
##[  5]  0.0-10.0 sec   112 MBytes  94.1 Mbits/sec

Inspired by AskUbuntu.

Sending emails from command-line using Gmail & SSMTP

I wanted to send email reports from my computers. For that, the easiest is to create additional Gmail account (so your private email is safe) and set-up SSMTP:

sudo apt-get install ssmtp mailutils mpack

Configure SSMTP: comment all lines in /etc/ssmtp/ssmtp.conf and add at the end (replacing HOSTNAME/USER/PASSWORD with your info):


Then, allow access from less secure apps to created Gmail account. It’s strongly recommended not to use your private account for that purpose!

And send emails:

echo "email body" | mail -s "Test email from "`hostname` SOMEUSER@gmail.com

VoilĂ !

Note, this works perfectly fine in Ubuntu, as well as in Raspberry Pi.

NX server on Raspberry Pi

Finally I had some time to get my hand on new Raspberry Pi 2.
I think it’s useful to access the RPi2 by ssh (work out of the box) and NX. Installation of NX server is quite time-consuming, but I think it’s worth to give it a try! Here is what I did:

# install dependencies
sudo apt-get install xutils-dev expect xorg-dev libjpeg8-dev libpng12-dev cups xfonts-base x11-xserver-utils autoconf

sudo mkdir -p /usr/NX/{bin,etc}

# install freenx
wget http://pkgs.fedoraproject.org/repo/pkgs/freenx-server/freenx-server-0.7.3.tar.gz/856f597e139018f7ed62713c9d6c9ed5/freenx-server-0.7.3.tar.gz
tar xpfvz freenx-server-0.7.3.tar.gz
cd freenx-server-0.7.3
patch < gentoo-nomachine.diff
sudo make install

# copy node.conf
# and replace #COMMAND_MD5SUM="openssl md5" with COMMAND_MD5SUM="md5sum"
# and #COMMAND_START_GNOME=gnome-session with COMMAND_START_GNOME="/usr/bin/startlxde"
sudo cp node.conf.sample /usr/NX/etc/node.conf

# get nx source
wget http://code.x2go.org/releases/source/nx-libs/nx-libs_3.5.0.13-full.tar.gz
tar xpfvz nx-libs_3.5.0.13-full.tar.gz
cd nx-libs_3.5.0.13

# compile & relax for ~1 hour...
make build-full
sudo make install

# copy libs and binaries
sudo ln -s /usr/lib/NX3/lib/nx /usr/NX/lib
sudo cp -a nx-X11/lib/X11/libNX_X11.so* nx-X11/lib/Xext/libNX_Xext.so* nx-X11/lib/Xrender/libNX_Xrender.so* nxcomp/libXcomp.so* nxcompext/libXcompext.so* nxcompshad/libXcompshad.so* /usr/NX/lib
sudo cp -a nx-X11/programs/nxauth/nxauth nx-X11/programs/Xserver/nxagent nxproxy/nxproxy /usr/NX/bin

# link binaries & install
for f in /usr/bin/nx*; do echo $f; sudo ln -s $f /usr/NX/bin; done
sudo nxsetup --install

After these steps, you should be able to connect with NX client using fake GNOME session.
Raspberry Pi 2 over NX

Post is based on TiaoWiki with some updates/improvements.