User Tools

Site Tools


making_a_serial_console_server

Making a serial console server

Lets say you've got some appliances like NetApp filers that only speak RS232 serial. You want to talk to them over the network even when their native networking is down. A serial console server is the answer - it basically lets you telnet to the serial ports.

There are a lot of ways to make one, but let's go with the somewhat-wasteful-but-easy route.

Requirements

You'll need a PC with:

  • ≥ 64MB RAM
  • ≥ 500MB storage (a compact flash card with an IDE adapter work well)
  • ≥ 1 serial port
  • a CDROM drive or another installation mechanism (at least temporarily)

Installing console Ubuntu

We'll use a console install of Ubuntu as the base for maximum laziness. While it is true we could probably get by with far less, the ridiculous simplicity of apt-getting everything trumps the $5 you might save by getting a smaller storage medium.

Obtain the alternate install CD (any version should do, 7.04 has been shown to work). The alternate CD includes the ability to install a console-only machine, filling just 400MB. Boot from the CD and pick "Install a command-line system". Follow the wizard. When it comes to partitioning, if you have < 128MB of RAM, set aside some swap space. Otherwise, swap space is optional, since the system will do little more than push bytes at around 9600 bits per second all its life.

Installing ser2net

"ser2net" is a package that does all the work of making a serial server for us. Just:

$ sudo apt-get install ser2net

It is automatically added as a service and set up with a default configuration, which looks like:

BANNER:banner:\r\nser2net port \p device \d [\s]\r\n\r\n

2000:telnet:600:/dev/ttyS0:9600 8DATABITS NONE 1STOPBIT banner
2001:telnet:600:/dev/ttyS1:9600 8DATABITS NONE 1STOPBIT banner
3000:telnet:600:/dev/ttyS0:19200 8DATABITS NONE 1STOPBIT banner
3001:telnet:600:/dev/ttyS1:19200 8DATABITS NONE 1STOPBIT banner

This means "telnet to 200x to get port x at 9600 BPS, connect to 300x for 19200 BPS". It also specifies a welcome banner that tells you the port and speed. The comments explain it all. Let's settle on port 600x → 9600 BPS, drop the other speed, and tweak the banner:

BANNER:banner:\r\nBLUES serial port \p device \d [\s]\r\n\r\n

6000:telnet:600:/dev/ttyS0:9600 8DATABITS NONE 1STOPBIT banner
6001:telnet:600:/dev/ttyS1:9600 8DATABITS NONE 1STOPBIT banner

Restart ser2net:

$ sudo /etc/init.d/ser2net restart

You should now be able to do this:

$ telnet blues 6000
Trying 192.168.0.132...
Connected to blues.dsss.be.
Escape character is '^]'.

BLUES serial port 6000 device /dev/ttyS0 [9600 N81]

Other tweaks

The command-line install, by default, includes the install CD as a package source. Since we'll be removing the disc (and maybe even the drive), let's remove that source. Just edit /etc/apt/sources.list and comment out the "deb cdrom" near the top.

We want to remotely administer this box, so let's get ssh server installed:

$ sudo apt-get install openssh-server

You could also stick single document web server on there to serve up a little message saying what the server is for and who owns it.

making_a_serial_console_server.txt · Last modified: 2010/12/02 12:23 by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki