About 6 months ago, I have found a Raspberry Pi model B sitting on the corner of my desk, gathering dust and waiting for an application. I have skipped XBMC box because i have one of those that's more powerful and also tiny enough, already with a Lenovo Q180 and the actual I/O stuff looks mostly harder than it would be with an Arduino.
One of my customers who had installed a network device in their DC Racks, talking with me yesterday that wasn't talking to the outside world anymore. Its management is either by SSH or serial port. It was the problem and needed to be a solution.
This is a job for RPi to install a box to allow network connectivity to a serial port, then I grabbed a latest Debian Wheezy SD image from the RPi website and USB serial adapter from my bag and go for work.
Booting the RPi with the serial adapter installed just work like USB stuff is supposed to, FTDI-chipset adapter and it just comes up as / dev / ttyUSB0 in Linux.
I have just installed minicom on the Rpi to get access to serial port remotely, and then SSH to a shell before running it, but I was interested in how this might scale to more serial gizmos for £2 each on eBay ,and 8 ports powered hubs runs to £15 for each. It makes 16-ports for under £100. If you are building a lab environment for Cisco SWITCH or CCIE, then this is a pretty decent deal.
Cisco’s NM-16 A and NM-32 A modules are their alternatives. I have a Lantronix 8 port device but it was made before Cisco completely dominated the network world, and everyone else took up their console pinout, it means making up special cables to use in my rack. NM-16A modules go eBay for around £150-200 on modules. Plus the special cables to connect them, plus the racter to put them in, or the ancient Cisco 2509 or other random eBay scarp.
So you still need a pair of £50 cables to connect all the ports and also a router to put the module in.
RPi has the added bonus that it’s still a Linux box and NTP server or TFTP server or DNS or RADIUS, so it’s for your lab network as well.
A small application named ser2net that listen for incoming telnet connections and connect them to Serial Port. It also understands RFC2217, an extension to the telnet protocol that allows a client to control serial port settings with special like Serial Port Redirector.
First grab the Debian Wheezy SD image from Raspberry Pi foundation download page and write it to fresh 2GB SD card.
Boot the Rpi from card, while connected to a monitor and network Linux is preconfigured to use DHCP to get IP address.
Latest ser2net distribution can be downloaded using wget.
Download the latest ser2net distribution using wget.
Untar, configure and install it
tar xvfz ser2net-2.8.tar.gz
./configure && make && sudo make install
Check device name of serial adapter
dmesg | grep tty
[ 9.735015] usb 1-1.3: pl2303 converter now attached to ttyUSB0
Create a configure file in /etc/ser2net.conf
BANNER:banner1:this is ser2net TCP port \p device \d serial parms \s\r\n
# Don't do this by default
2001:raw:600:/dev/ttyUSB0:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS
3001:telnet:0:/dev/ttyUSB0:9600 remctl banner1
Test it by running the server
/usr/local/sbin/ser2net -c /etc/ser2net.conf -n
Get a welcome banner while running that, and then you will be able to open telnet to port 3001 on the RPi in new window. You will be able to talk to device connected with the serial port.
Last step is to start the ser2net service when the RPi boots. Simply add the following line to the bottom of /etc/rc.local, just before the ‘exit 0’ line:
/usr/local/sbin/ser2net -c, then it will be automatically started on boot.
For multiple serial devices add additional lines to /etc/ser2net.conf.
From the serial devices, you can log all output for an added bonus in a shared environment. File per session can get with a timestamp for the start and finish, and also the source IP. This is another couple of config lines in ser2net.conf
3001:telnet:0:/dev/ttyUSB0:9600 remctl banner1 tr=tr1 timestamp
Add tr=tr1 and timestamp to the end of each telnet line.
Then create the /var/log/ser2net directory and you are off and running.
It can be packed with less mess by a 1U box with 16 serial ports in Cisco pinout and a simple IEC power connector It would cost about £200.