Test Network Speed of Ethernet Ports

If you have just bought a new (to you) nic card or other networking device and want to test that all of the ports can pass traffic at the expected rate, as long as you have nc and the firewall ports open on a “server” with a known good nic and have nc installed on your “client” device that you want to test it is very easy to test.

Of course, if you are testing a switch itself, then it is just a matter of having two known good machines to act as the client and the server and to insert the switch between them.

Ensure that you have a high port that is allowed by your firewall.  On the server side run the following to set up a listening service

nc -l -k <port> > /dev/null

Then on the client run the following:

$ dd if=/dev/zero bs=1M count=1K | nc -vn <server-ip-addr> <port>
Connection to <server-ip-addr> <port> port [tcp/*] succeeded!
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 9.0998f s, 118 MB/s

Then, just remember to multiply the MB copied to the server by 8 to get the rate in megabits/s.

Mounting a Samba Share From Linux Client to Linux Samba Server

In order to be able to access a Samba share on a remote client as a mounted file system execute the following command, as root on the client:

mount -t cifs -o user=<user-on-samba-share>,uid=<uid-on-local-macheine>,gid=<gid-on-local-machine>,rw,workgroup=<your-workgroup> //ip/share /mnt/mount-point-dir

You will be prompted for the password for the user defined on the Samba server.

If you are able to authenticate, and then get the following error:

ls: reading directory .: Permission denied

Check the SELinux context type of the directory on the samba share.  It should be samba_share_t

Firewall for Ubuntu 14.04 LTS

For whatever reason, Ubuntu 14.04 does not seem to come with a firewall.

There are however two packages which provide, both a firewall and a handy GUI front-end for it.  UncomplicatedFireWall is the main package (ufw) and the GUI is gufw.

To install:

apt-get install gufw

This will install the front-end and the dependent packages

To turn it on:

ufw enable

The default is to block all incoming traffic.

To update and add your own firewall rules and allow incoming connections

gufw

The GUI is quite intuitive and allows advanced users the ability to create their own custom rules.