Monday, October 27, 2014

FreeBSD with multiple Serial Adapters acting as Access Console Server

I play a lot with network equipment like switches, routers and firewalls. It is very useful to have local serial access to consoles of such devices. When I say local, I mean remote access to local serial console. I can use some commercial Access Console Servers from companies like Avocent but these devices are usually very expensive and don't do anything else than linux box with multiple serial ports accessible remotely via ssh or telnet.

So my idea was to use my favorite unix-like system (FreeBSD) with multiple serial ports. For such appliances I usually use Soekris or Alix boards with FreeBSD on Flash. The question is how to have multiple serial (RS-232) ports. The simplest method nowadays is to use usb serial adapters. I know these usb serial converters has some issues but it is really the simplest peace of hardware to buy, plug and play.

When you use some of these USB converters you should see new devices. In my case I see in dmesg following devices:
uftdi0: on usbus1
uftdi1: on usbus1
uftdi2: on usbus1
uftdi3: on usbus1
To make serial console working you have to load uftdi module. uftdi -- USB support for serial adapters based on the FTDI family of USB serial adapter chips.

The easiest way is to load this module during boot. You just need to add to /boot/loader.conf following line
uftdi_load="yes"
After next boot you will have following new devices in your /dev/ directory
/dev/cuaU0
/dev/cuaU1
/dev/cuaU2
/dev/cuaU3
 ... and you can use program cu to connect to particular serial console. For example
cu -l /dev/cuaU0 -s 9600
to connect to console with speed 9600 bauds.

Soekris NET4801-48 with USB reduction to 4xRS232

2 comments:

Unknown said...

AFAIK, soekris/alix "appliances" have only a single usb port, so I'm just curious how did you get more devices connected.

I've tried myself to attach a pci 4-usb-port card to a soekris 5570-70 but it didn't work because of the lack of power.

And I think lack of power would be a problem if you add a usb hub to the single usb port available, wouldn't it?

David Pasek said...

I have several soekris/alix boxes at home. Right now I'm looking at Alix.2D and there are two USB slots. However I test it in Soekris net4801-48 where is just one USB slot. But I have USB -> serial reduction where are four RS232 connectors from single USB. Therefore I achieved pretty nice count of RS-232 ports. And on top of that there are two embedded RS-232 ports where one is used for console but second one can be used for other purpose as well. You just need to use regular serial cable reduction plugged into internal port. I'll make a photo and update the blog post.