Raspberry Pi3 Test Node - Low cost network testing - Howto

Recently I had a contract where I did a stint as unix admin. Now I still consider myself a broadcast engineer, but it really was useful to deep dive unix for a few months.

Skip forward to my current role where I have to troubleshoot network problems for contribution video and control. Having nearly 50 remote sites to support can prove challenging. What we really needed was some of the unix networking test tools I had built experience of.

Step forward the Raspberry Pi Version 3 Model B. Normally i'm not a fan of using these in enterprise environments, TBH most of the people I work for can afford the very best gucci tools.

On this occasion though, and with so many sites, as long as we carefully document, build and install them it would certainly provide a massive advantage for a monitoring and troubleshooting tool.

The requirements

  • Provide a low cost linux based platform for deployment on each network leg.
  • Install a number of networking troubleshooting and test tools.
  • Provide serial connections (via a USB to Serial Convertor) to provide out of band management to other ip enabled remote devices.
  • Ability to mount storage / support USB drives for the occasional remote media task.
     
    What follows is my notes for setting up an image for the Raspberry Pi 3, using https://www.raspbian.org/ as the base OS. At each stage where relevant I have credited the link I got the information from, this will also include far more detail than my notes.

We are going to use this pi headless (no Keyboard, Video or Mouse (KVM)) but we do need to briefly set it up on KVM and obtain an ip-address.
 

Initial Config

 Connect the pi to  KVM and login with the GUI. In the Raspberry Pi configuration >> Config

Set the following.

- Boot to CLI
- Enable SSH
- Auto Login OFF

Logoff

sudo ifconfig

and note down the ip-address for

eth0 

sudo reboot

Now use a client like terminal for MacOSX or putty for windows and SSH to the ip address of your pi. Follow the prompts and login with u:pi password:raspberry

Now we need to make sure we are using all the space on our SD card

(http://cagewebdev.com/index.php/raspberry-pi-expanding-the-root-partition-of-the-sd-card/)

Type

raspi-config

>> Expand FileSystem  and follow the prompts.

Update your pi

(https://www.raspberrypi.org/documentation/raspbian/updating.md)

sudo apt-get update
sudo apt-get upgrade


SET Static IP

(http://raspberrypi.stackexchange.com/questions/37916/setting-up-static-ip-address-on-raspian-jessie)

sudo nano /etc/dhcpcd.conf

as follows (extract from man dhcpcd.conf):-

Configures a static value.  If you set ip_address then dhcpcd will not attempt to obtain a lease
and just use the value for the address with an infinite lease time.

 Here is an example which configures a static address, routes and dns.
       interface eth0
       static ip_address=192.168.0.10/24
       static routers=192.168.0.1
       static domain_name_servers=192.168.0.1

SET hostname

(http://www.howtogeek.com/167195/how-to-change-your-raspberry-pi-or-other-linux-devices-hostname/)

sudo nano /etc/hosts

Edit the name after the loopback address of 127.0.0.1

Save and exit,

Then 

sudo nano /etc/hostname

Edit, Save and Exit

Commit the changes to the system and reboot the system for the changes to take effect. : 


sudo /etc/init.d/hostname.sh


Follow that command with: 


sudo reboot


SET NTP Servers

(http://raspberrypi.tomasgreno.cz/ntp-client-and-server.html)

sudo nano /etc/ntp.conf 

Find lines starting with "server". Replace that lines for lines with servers from pool.ntp.org.

Now you can restart ntp service.


/etc/init.d/ntp restart


Here is command to check if time is synchronizing properly. To list NTP servers with which RPi is synchronizing:


ntpq -pn 


Manage users

(https://www.raspberrypi.org/documentation/linux/usage/users.md)

Login as pi and the issue the

passwd

command to change password

create a new user (for example) u:noddy p:bigears

Enter

sudo adduser noddy  

and you'll be prompted for a password for the new user noddy

The default pi user on Raspbian is a sudoer. This gives the ability to run commands as root when preceded by sudo, and to switch to the root user withsudo su.
To add a new user to sudoers, type

sudo visudo

(from a sudoer user) and find the line root    ALL=(ALL:ALL) ALL, found under the commented header '# User privilege specification'. Copy this line and switch from root to the username. To allow passwordless root access, change to NOPASSWD: ALL. The example below gives the user bob passwordless sudo access:
# User privilege specification
root  ALL=(ALL:ALL) ALL
bob   ALL = NOPASSWD: ALL

Disable the wireless radios on the Pi3 (Not good to be connecting to networks)

(https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=138610)

sudo nano /etc/modprobe.d/raspi-blacklist.conf

Add the following lines 

#wifi
blacklist brcmfmac
blacklist brcmutil
#bt
blacklist btbcm
blacklist hci_uart

Then 

sudo reboot

You should now see some failures on restart, this is good and means the radios are disabled

Install some useful apps

sudo apt-get install the following

For example

sudo apt-get nmap

Nmap

https://nmap.org/

Network Scanner

MTR

http://www.tutorialspoint.com/unix_commands/mtr.htm

mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.

Iperf3

https://iperf.fr/

tool for active measurements of the maximum achievable bandwidth on IP networks.

tcpdump

http://www.tcpdump.org/tcpdump_man.html

Tcpdump prints out a description of the contents of packets on a network interface

Ser2net

http://ser2net.sourceforge.net/

ser2net provides a way for a user to connect from a network connection to a serial port.

Tightvnc

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04

VNC, or "Virtual Network Computing", is a connection system that allows you to use your keyboard and mouse to interact with a graphical desktop environment on a remote server.

SNMP

http://www.net-snmp.org/

Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg. routers), computer equipment and even devices like UPSs. Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both IPv4 and IPv6. The suite includes:

Iptraf

http://iptraf.seul.org/about.html

IPTraf is a console-based network statistics utility for Linux. It gathers a variety of figures such as TCP connection packet and byte counts, interface statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN station packet and byte counts.

Htop

http://hisham.hm/htop/

This is htop, an interactive process viewer for Unix systems.

Mediainfo

https://mediaarea.net/en/MediaInfo

MediaInfo is a convenient unified display of the most relevant technical and tag data for video and audio files.


Install ffmpeg from source

Its all in here

http://www.jeffreythompson.org/blog/2014/11/13/installing-ffmpeg-for-raspberry-pi/

Mount Network Drives

Again probably best to read this.

http://geeks.noeit.com/mount-an-smb-network-drive-on-raspberry-pi/

Useful commands

Measure temp of raspberrypi:

/opt/vc/bin/vcgencmd measure_temp

 

Whats Next?

Shortly Ill be posting the hardware setup ..

As we speak a 19" case is being printed on the Ultimaker2. While its a quick and dirty prototype it will serve to provide the basis for a better design.

Also I will demonstrate the serial terminal cabling, and how I use some of the tools I installed.