freetserv User Guide

Finding the serial ports you have access to

Each freetserv port is available in /dev/freetserv, e.g. the first port is /dev/freetserv/port1.

If you are not sure which ports you have access to, you can use find(1) to figure it out:

fts $ find -L /dev/freetserv -user $LOGNAME

It might be useful to create symbolic links with names that mean something to you, e.g.:

fts $ ln -s /dev/freetserv/port1 $HOME/hp-rack-switch

Using a serial port

Nowadays, devices with a serial port typically are configured as 8-N-1 (8 data bits, no parity bit, one stop bit), which is also the default setting in all modern programs.

What varies from device to device is the baudrate. If you’re not sure which baudrate your device uses, chances are it’s using 9600 baud or 115200 baud, the most common baudrates encountered nowadays.

By default, freetserv comes with a number of programs that can all be used to connect to the device that is connected to your serial port:

screen(1) can configure a serial port, and you might already be familiar with it. Especially when dealing with multiple serial ports, switching between multiple screen windows can be handy. This is how you would invoke it:

fts $ screen /dev/freetserv/port3 9600

minicom(1) describes itself as a friendly serial communication program, and offers a menu-driven configuration in case you need to make adjustments to your serial port’s configuration:

fts $ minicom -D /dev/freetserv/port3 -b 9600

cu(1) might suit you more than minicom if you prefer text commands over text menus:

fts $ cu -l /dev/freetserv/port3 -s 9600

Restricting who can log in to your account

You can configure OpenSSH to only accept logins from certain IP address ranges via the “from” keyword in your ~/.ssh/authorized_keys, see the section “AUTHORIZED_KEYS FILE FORMAT” in the sshd(8) manpage

As an example:

fts $ cat ~/.ssh/authorized_keys
from=", 2001:db8::/64" ssh-rsa AA…

Enabling the serial port on a Linux computer

As soon as you add console=ttyS0 to your kernel boot parameters, the Linux kernel will log its boot messages and systemd will start a serial getty on ttyS0. To retain boot messages on the regular text console as well, specify both console=tty0 and console=ttyS0. The last mentioned device is the device that will control stdin/stdout/stderr, so set it to your serial port.

Further, you should enable the serial port in the grub bootloader. Enabling both could look like this:

myserver # cat >>/etc/default/grub <<'EOT'
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0 panic=10"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
myserver # update-grub