Build your own Cisco Terminal Server with Raspberry Pi

I have been working in Computer networking for more than 8 years now and the biggest fear I still harbor is losing access to a router by misconfiguration. During my first stint with Service Provider networks, losing access to a router or switch would mean running to the Data Centre and taking console to a router and revert the changes and this because we didn’t have console servers in our Data Centre. Our Data centre was just across the NOC so it would take less than a minute to reach the equipments. During my second stint, the Data centre was the largest in India and going to the Data Centre would take minimum of 15 minutes from the NOC. Although we had a management network connecting all networked equipments, this did not help when a router or switch was malfunctioning and the only option left was taking console. My third stint with Service Provider network had no option of running to the router as many of the PoPs were international. Few of the larger PoPs had Terminal Servers but not all had this. A question would run through anyones mind as to why someone would not provision a console server on a remote site? The primary reason is the cost. The second reason is that it does not make business sense to have a console server for a couple of routers.

Why Raspberry Pi?

Raspberry Pi is a small computer costing just $35 and yet fully functional. Kids from 8 till adults are making good use of it as it is very versatile. We are using a Raspberry Pi for the following reasons

  • It is much cheaper as compared to a Cisco Terminal Server
  • The connectivity options are much varied with Wired, Wireless, 3G, etc
  • Expansion is easy as you can provision a USB Hub with higher number of ports
  • Cisco Mini USB Consoles can be used
  • The Raspberry Pi can be used for other services like MRTG, monitoring, etc
  • Takes very less power and space

Requirements

  • Raspberry Pi Model B
  • Powered USB Hub with as many ports as you want console cables
  • USB Mini console
  • USB to Serial Cable
  • Cisco Console Cable
Cisco Console Cable
Mini USB Cable
USB to serial cable

The Setup

I am beginning with the assumption that your Raspberry Pi is already running Debian Wheezy. We will connect the USB Hub to the USB Port with the provided USB cable. We must use a powered USB Hub because the Pi is not able to drive the USB Hub and all the connected devices. If we do not use a powered hub, the devices keep on disconnecting. In this example, I am using 3 USB Mini Cable and 2 USB to Serial Cables connected with Cisco Console cable.

The Configuration

As soon as you connect the USB Hub and all the consoles, it should be detected and you can see it via the command lsusb.

lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 008: ID 05a6:0009 Cisco Systems, Inc.
Bus 001 Device 009: ID 05a6:0009 Cisco Systems, Inc.
Bus 001 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 005: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 007: ID 05a6:0009 Cisco Systems, Inc.

Every Serial device detected will form a TTY port. You can see the Serial Port to TTY mapping by the command

dmesg |grep tty

[ 0.000000] console [tty1] enabled
[ 0.584224] dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83) is a PL011 rev3
[ 0.908060] console [ttyAMA0] enabled
[ 6.283591] usb 1-1.2.2: pl2303 converter now attached to ttyUSB0
[ 6.449796] usb 1-1.2.1.3: pl2303 converter now attached to ttyUSB1
[ 7.232831] cdc_acm 1-1.2.3:1.0: ttyACM0: USB ACM device
[ 7.338627] cdc_acm 1-1.2.1.1:1.0: ttyACM1: USB ACM device
[ 7.405930] cdc_acm 1-1.2.1.2:1.0: ttyACM2: USB ACM device

It is best to keep the cables untouched after connecting it because we will be doing manual mapping of TCP port with TTY. If you remove the console and put it back, there is a very good possibility that the TTY will be different.

In order to connect to the routers via Terminal, we will require Kermit on the Pi. You can install Kermit with the following commands

sudo apt-get install ckermit

After installation of Kermit, you can connect to individual routers via the following command

kermit -l /dev/ttyUSB0 where ttyUSB0 is obtained from the output of the dmesg |grep tty command.

Enter “connect” and you will be prompted to enter “set carrier-watch off”. Enter “set carrier-watch off” and again enter “connect” and you will be taken to the router console. You can disconnect the router by the following key combinations ctrl / u

In order to redirect TCP connections to the serial, we will require Ser2net. You can install ser2net via the following commands

wget http://downloads.sourceforge.net/project/ser2net/ser2net/ser2net-2.8.tar.gz

The version keeps on changing so you will have to go to sourceforge and check the latest version and change the name in the above command accordingly

Complete the installation with the following commands

tar xvfz ser2net-2.8.tar.gz
cd ser2net-2.8
./configure && make && sudo make install

Go to the folder where you have installed the ser2net and edit ser2net.conf

sudo nano ser2net.conf

Add the following lines to the ser2net.conf file.

9001:telnet:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner1
9002:telnet:0:/dev/ttyUSB1:9600 8DATABITS NONE 1STOPBIT banner1
9003:telnet:0:/dev/ttyACM0:9600 8DATABITS NONE 1STOPBIT banner1
9004:telnet:0:/dev/ttyACM1:9600 8DATABITS NONE 1STOPBIT banner1
9005:telnet:0:/dev/ttyACM2:9600 8DATABITS NONE 1STOPBIT banner1
9006:telnet:0:/dev/ttyACM3:9600 8DATABITS NONE 1STOPBIT banner1

Keep a set of ports for the console connections. I have taken ports 9001 onwards.

Note that my port numbers and TTYs will be different from yours as it depends upon the console cables and types you have used and what your Pi has detected.

A very good feature with this setup is that you can log every command you enter to the console. After you have added the above lines, repeat the above lines as mentioned below

TRACEFILE:tr1:/var/log/ser2net/tr-\p-\Y-\M-\D-\H:\i:\s.\U

9001:telnet:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner1 tr=tr1 timestamp
9002:telnet:0:/dev/ttyUSB1:9600 8DATABITS NONE 1STOPBIT banner1 tr=tr1 timestamp
9003:telnet:0:/dev/ttyACM0:9600 8DATABITS NONE 1STOPBIT banner1 tr=tr1 timestamp
9004:telnet:0:/dev/ttyACM1:9600 8DATABITS NONE 1STOPBIT banner1 tr=tr1 timestamp
9005:telnet:0:/dev/ttyACM2:9600 8DATABITS NONE 1STOPBIT banner1 tr=tr1 timestamp
9006:telnet:0:/dev/ttyACM3:9600 8DATABITS NONE 1STOPBIT banner1 tr=tr1 timestamp

The logs will be saved at /var/log/

In order to run the setup, enter

/usr/local/sbin/ser2net -c /home/pi/ser2net-2.9.1/ser2net.conf -n

You can now take console to your router by telnetting at ip address of Pi at the specific port number

Example telnet 1.1.1.1 9001 where 1.1.1.1 is ip address of Pi and 9001 is the port of device connected to USB0

In order to make the setup persistent, you will have to edit rc.local file.

sudo nano /etc/rc.local

Enter /usr/local/sbin/ser2net -c /home/pi/ser2net-2.9.1/ser2net.conf -n at the end before exit 0

Again the folder naming might be different in your case depending on the version of ser2net

You can try consoling all the routers at the same time to check whether everything is working as expected.

Posted in Deep Thoughts | Leave a comment

Travel and the moving office

The Travel Office Sort of

Hello again,

It’s a beautiful night in London and you have found me sitting in a Burger king across form Kings Cross trying to get a little work done.  You may be asking why I’m not in my cozy hotel room with a hot coffee and soft lighting to keep the juices flowing.  Funny story that…  The room is tiny and my family s occupying it.  the hotel WiFi is horrid and the building blocks the 4g signal to the MiFi Hot spot.  As such I found the closest and quietest location to have a coke and type for a bit.  So the subject for tonight’s rant will be the reality of the mobile office.

The equipment.

First i must admit to being a very frugal (Read Cheap) person.  If I can get something for a dollar that needs a bit of work that new is $10 I’ll jump at it.  This came into play when buying my equipment for this trip.

So here is the list:

Laptop – No name brand netbook from AlliExpress 14″ screen, 64g SSD (drive) and 4g of ram, running windows 10 and all the other programs i use for work and play.  Office, Photoshop, Camtasia, etc.

MiFi – Huawel 4g/3g mobile Hotspot with a 6g 3(UK mobile operator) sim.

Posted in Travel, Work | Tagged , , , | Leave a comment

July 1 – Scotland Here We Come

This image has an empty alt attribute; its file name is monday-1270366_640-300x234.jpgToday is the first day of the rest of my life. Sounds good, but what does it mean?

How long do we really have on this earth to enjoy the people around us, the air we breath, the smells we cherish, and the music that lifts our hearts?

     Statistics show that a human average life span is about 78 years. With the rise of processed sugar, highly processed foods, and a sedentary lifestyle I firmly believe, for a portion of the population, this has dropped dramatically. I was reading an article in a medical journal a few months ago which stated that the next generation, our kids, would be the first generation in history to lower the average age of death by at least 1 year.

So…. What to do. I’ve decided that I will take the time to enjoy the world, my family, and everything it has to offer. My son won’t understand why we are doing the things that we do now, but they are all for his benefit. It may seem selfish up front, but believing that exposure him to different cultures, people, foods, activities, and life in general, is allowing him to make the best choices for himself in the future. One of the wisest lessons I ever received was a simple story that pointed out the obvious truth. To win the game you must know the rules. If you know the rules you can see all the moves ahead of you, and know what your opponent can’t see. To win knowing all the rules is paramount for success. He needs to know the rules of the world to be a winner wherever he chooses to be.

So far we have lived in the two US extreames, California and Texas.  He has seen both socialism and capitalisms with the joys and pitfalls of both.  As well he has been acquainted with the Mexican and US southern cultures through his parents. Along with some european culture through a trip to the UK and Paris a few years ago, but I don’t think it is enough. I want him to have the chance that I didn’t. To be a part of a culture truly different from the American culture he has grown up with.

This image has an empty alt attribute; its file name is beef-192976_1280-1024x682.jpgNext stop Scotland. I think with its connection to my family roots, it’s unique culture and still being in English this will be the best jumping off point for his introduction to being a citizen of the world.

Today the countdown begins. 2 years till we leave. Lots to do, lots to learn. A business to build, a pile of stuff to clear out. but it will happen. My son will be 14, almost a man. It is time for him and his parents to see the world.

Posted in Dreams & Goals, Travel | Tagged , , | Leave a comment

Travel – Work – and the Family – How this all began

Traveling and Family with work.  Not Happening!

It’s 4 am and all’s not good

Can family, travel, and work co-exist? It’s 4 am in the morning and I’m sitting in the hotel lobby trying to get some work done.  I’ve go a document due in a couple of days that I’ve been working on for about 2 weeks wit little progress.  The family is sleeping, like I should be, and we have a full day planned ahead.  Some harry potter stuff, Viking museum, and just general flitting about the city.  reality is tat the whole time i’ll be trying to figure out how I’m going to get the document done and make my boss happy.  Why do I even try??

The real problem

3 am and the alarm went off.  Another day at work, but not really.  I laid there thinking about what i was really doing.  Working before they got up, spending my time thinking about work while trying to enjoy time with them.  It wasn’t fair to them or to me.  This was supposed to be a vacation damn it.  My time to bond with the family.  Our time to straighten out the issue that have plagued us for the last few years.  I began to realize the real problem as I laid there.  It was me, no really, my outlook on life was rubbing off on my son.  My irritability was wearing thin on my wife’s nerves.  But, what could i do.  A decision had to be made before i could go on.  So I made one.

The Decision gets Made

What did i decide?  To work it out.  To have my time with them and to get my work done.  But not to mix the two.  When I was with them I was not to worry about work.  And when i was working it was time for that only.  I would need to make them understand that the time needed to be segmented so I could fully be there for them and still make a living.

Steps to Freedom

First I had to get a schedule that would work for them and for me.  I needed 8 hours a day for work.  11 for them and 5 for sleep, whether I needed it or not.  Simple, right?  Not so much.  With Jet Lag and time differences it will be a little tough to meet that.  So here goes a tentative schedule.  Work time in the hotel lobby from 3 am to 8 am (5 hours), breakfast with the family at 8 ish and then on about the day.  Meetings if needed but rather not disturb the flow.  End day with the family at 7-8 pm then go down and work till 10.  This will be the flow for the next week.  We will see how it goes.

Tomorrow’s coming

Sunrise over LifeWith every schedule there are adjustments.  Tomorrow will be no exception.  We are leaving out on the train at 8 am for London.  I’ll need to get my work done and be packed to leave by 7 so we will see how it goes.

Cheers,

 

 

 

Posted in Travel, Work | Leave a comment