Intro: Network Lab
This instructable is kind of long and involved. There are several projects rolled into one to give me a portable network testing lab, allowing me to diagnose network problems, shark packets from wired and wireless networks, test patch cables and help to map wall ports to patch panels.
The project uses a combination of Raspberry Pi and Arduino. It is likely that it all could have been done with the Pi but I am fairly new to it and each of the additions I made was a struggle to get working so the thought making a complete annex of another 2 projects was too much to bear.
I hope that you find all (or sections) of this instructable useful as I believe it will make the network portion of my job easier.
Step 1: You Will Need
- Raspberry Pi 2 (this is important as the OS will not run on Pi 3) Radionics
- A screen, I opted for a 5" touchscreen Amazon
- A keyboard and mouse, again I opted for the Rii mini X1Amazon
- An Arduino Uno Amazon
- A small network switch, I had this one on my desk Amazon
- 4 RJ45 Keystones Radionics
- USB power banks (optional if you want to be portable)
- Some CAT5 cable
- Network Patch Lead
- MicroSD card (at least 4GB)
- Mounting box (I used this one)
- RJ45 Crimp tool
- Soldering Iron
- Cutting tool (such as Dremel)
- Punch down tool
- Basic Hand tools
- Hot Melt Glue Gun (optional)
Step 2: Raspberry Pi Network Analyser
I can't take credit for this OS, I stumbled across a project Here when looking for a way to carry out some network analysis with a handheld device. I had researched commercially available devices and even the cheap ones were over 1000 euro.
The webpage was written in as far as I can make out in 2015. There were 2 versions of the OS, one fo Pi B and the other for Pi 2. I chose Pi 2 as firstly they are easier to get and second, they are a slightly higher spec. There is a note that using the OS breaks the touch functionality of the screen but I will address that later.
As I said I am new to Raspberry Pi so some of this may be intuitive to some of you but I will guide you through what I did to get things running.
The main part is to follow the build guide on the page, download the image and the mounting software. Mount the image on the SD card using your PC. Follow the installation instructions for your screen fully or it either will not run and/or will not have the correct resolution. Assemble the parts and power up.
The first error I was presented with was that on boot the system halted due to an issue with no LEDpin set for the backlight.
This was a recurring error and after some digging I found a forum that gave me the information that the fbtft library has a no backlight function
This is accessed by going to the command line (CLI) do this by pressing ctrl+alt+F2
The default username is: pi
Enter the command sudo nano /etc/modules
and navigate to the line that reads:
flexfb width=320 height=480 regwidth=16
after regwidth=16 insert the word nobacklight
then type: sudo reboot
this will restart the Pi and you can boot to the OS.
The screen will launch on an external monitor but I could not get it run the OS on the LCD
I had to change the HDMI settings to do this go back to the CLI and enter:
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
and change the option /dev/fb1 to /dev/fb0
press enter and reboot
You should now be into OS.
The warning on the development page said that the touchscreen would not work but after installing wiringpi and the correct BCM libraries (see the documentation with your screen) all worked fine. The resolution was a little off though as there were large black margins on either side.
After some digging I found a line using
sudo nano /boot/config.txt
comment out the framebuffer sections by adding a # at the beginning of each line.
Now save and reboot and we are good to go.
But no, I realised that if you boot and you are not connected to a network with DHCP, the Pi will sit on the boot screen forever.
Easy fix, type
sudo nano /etc/dhcp/dhclient.conf
Uncomment the DHCP timeout, save and reboot.
After the timeout has expired with no DHCP response (I shortened mine to 30 seconds), the Pi will boot to the OS.
Now we can do all the lovely network analysis such as wireshark, lldp, network scans for open ports etc. If you added the Wifi dongle you can also do this on your wireless network.
Step 3: Mount NetPi
As the NetPi is now touchscreen enabled, I wanted to mount it in the lid of the box, keeping the screen available.
I didn't want my fancy touchscreen anywhere close to the cutting tool so I stuck it in the photocopier and made a 100% copy.
I played around with the placement of the screen and when settled, I stuck it to the inside of the lid with some tape.
I then followed the edges with the cutting disc on my Dremel and drilled the mounting holes in the correct locations.
I knocked out the cut away section and inserted the screen. The edge was a little uneven so I made a little bezzle with some black tape. I powered up to ensure all was okay.
Step 4: Make Some Connections
As I stated in the intro, I wanted this to be a multifunction network tool, therefore I was going to need some connection points.
I decided that wall port (keystone) connectors would be best.
I marked out the outline of 4 of them
- Connection for the NetPi
- Master side of the patch cable tester
- Slave side of the patch cable tester
- Patch panel mapping tool
I stuck down some masking tape to make it easy to mark and then cut out with the Dremel, there was some dressing required but the edges of the ports overhang so it's covered up.
The wall of the box was a little thinner than the wall plate so the fit was a little sloppy, I will address this in a later step.
I started by making a mini patch from the 1st port to the Pi, this followed the pin colour codes on both ends of:
With this I got the connectivity of the now interior network connection on the NetPi to the outside of the box.
Step 5: Cable Tester
For the cable tester, I could have written something for the Pi but I am not overly comfortable with the programming.
This is really easy to do with Arduino and I had a spare one on the desk.
I set up a loop coming out of each one of 8 digital pins designated outputs.
This goes to a pin on the socket, this then passes through the cable to be tested, into the other socket and thought an LED connected to each pin. I know there should be a resistor with each LED but it works and I'm lazy.
I used some simple code to create an array, a loop indexes through the array and turns on the pins in sequence. If the LED's light up in order you have a straight cable, if one misses you have an open, if more than one turns on at once you have a short and if you get the order 3, 6, 1, 7, 8, 2, 4, 5 then you have a crossover.
I also added a continuously pulsing pin to pin 13, this is for the portmapper.
The code is attached.
I forgot to take a photo of mounting the LED panel but I basically drilled holes at regular intervals and inserted the LED's. I held it all in place with hot glue.
Step 6: Port Mapper
The portmapper is quite simple, it's based on a product I saw in a youtube video a long time back and for some reason can't find again.
Anyway, the principle is simple. You have a series of wall ports connected back to a patch panel but they are not marked so you don't have a map or wall ports to patch ports. There are lots of tedious ways to do work this out.
You can tone follow, attach devices or cable testers but this is all trial and error.
With this method, a pair of cores in the cable is energized with 5V via the Arduino, this was the flashing pin13 from the last step.
The cable carries the power back to the patch panel, you then need an RJ45 connector with an LED attached across the energized pins to flash when ordered. I used pins 4 & 5 and this MUST NEVER be used in a live network as you could damage networking equipment if you patch to the wrong port.
Anyway see the video for the local port test.
I made a small number of the signal plugs but make a heap as you will loose and break them as you go.
Step 7: Glue It All Up and Add the Power
I glued the Arduino down with hot glue, this will be his home forever now!
I used a cheap USB hub as a power rail, the USB power brick is connected to one of the ports and from there is distributed to all of the outgoing ports, much like a mains power gang socket.
All tested good on the power up.
I also added some hot glue around those loose RJ45 keystones.
Step 8: Add Even More Connecttivity
What network lab would be complete without lots of network ports?
This is an old 8 port unmanaged switch I had on the bench, it's handy for hookups and testing so I thought I'd take it with me.
What was really handy was that it runs on 5V @ 1A, exactly what I have spare from my USB power bricks!
I cut the end off a USB power cable and added the connector you see (it came from a colleague who bought a heap on AliExpress).
It powered up a charm.
Then I noticed it fits right into the handle of the box! Bonus.
I removed the casing and the lid was well clear of the internals so I ran 2 self tapping screws into the handle and reconnected the base, this will always be powered with a power brick externally.
Step 9: Finished and Tested
Once finished there was room to keep 2 of the storage bins. This left room for the power bricks (I have 2 but may get more), some spare RJ45 connectors, the test plugs, the remote keyboard and a spare patch cable.
As it happens the day I finished we were converting a storeroom to an office at work and wanted to confirm the network connection points before we went on, see the video for the result.
All-in this is a really handy little piece of test equipment to have in my van. I have a huge series of networks I look after and this means I can carry out many of my tests with a very small piece of kit that all in, cost less than E200!