17

I'm setting up a console server and I need to determine the correct baud rate of my port. I'd like to do this from the command line, if possible. Does anyone know how?

4

The program you're looking for is called "setserial".

http://linux.die.net/man/8/setserial

24

setserial is Linux-specific, but you can also use the stty command (available on any Unix) to check the speed and other characteristics of any tty.

stty operates on its standard input, so stty < /dev/ttyXX will give you the information about that particular tty. Alternatively, if you're in a situation where you cannot set the standard input of stty, you can use the -F /dev/ttyXX option.

  • 5
    You may need to use stty -F /dev/ttyXX – Mark Lakata Oct 25 '12 at 21:47
2

Since you mention a console server and this question is tagged with linux I will assume you are connecting to a linux server. The server must be configured to use a serial console so there are a couple of places to check.

The kernel setup involves adding the "console" parameter to the command line of your kernel. For example adding "console=ttyS0,9600" tells the kernel to send messages to the first serial port (/dev/ttyS0, COM1 in DOS/Windows terms) at 9600 baud. You can add this to the command line through your boot loader configuration. If using grub this will usually be a file called /boot/grub/grub.conf. Note that you can have multiple console parameters for traditional keyboard/video console (tty0) as well as serial (/dev/ttyS0). For exaxmple: "console=tty0 console=ttyS0,9600"

To provide a login prompt via serial you need to edit /etc/inittab and add/edit a line like the following. s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100 This line tells the agetty program to spawn a login prompt on /dev/ttyS0 at 9600 baud.

Note you will normally want to match the serial port and baud rate between the kernel and agetty setup. By checking the configurations above you should be able to determine the server baud rate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.