If you need to connect your linux server to a cisco device through the serial port this is the best way to do it. This guide is for Debian/Ubuntu but will work with any linux distribution.
First you need to install minicom this is easy using apt-get or yum, just do the following command.
M ost embedded Linux / BSD systems such as routers, servers and nas devices comes with console interface (serial port with RS-232). BIOS can uses this, and after boot BIOS screen I/O is redirected so that you can use the device.
- AccessPort - RS232 Monitor / RS232 Terminal AccessPort is an advanced serial monitor, simulation and RS232 data analysis tool. Use to log, view, analyse or automate RS232 communication or simply use as an ASCII Terminal for basic serial port communication and RS232 device configuration.
- The serial port communication programs moserialor gtktermprovide an easy way to check connectivity and modify /dev/ttyUSB0(or /dev/ttyUSB1!) settings. Even though there maybe only a single USB to RS232 adapter, the ndesignation /dev/ttyUSBncan and does change periodically!
> apt-get install minicom
Once installed you need to find out what your serial port connection is.
> dmesg | grep tty
Output:
[ 15.453264] console [tty0] enabled
[ 17.339818] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 17.340257] 00:0c: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 17.339818] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 17.340257] 00:0c: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
The seial port in this example is at /dev/tty0
Next configure minicom to use that serial port and connect to the cisco device.
> minicom -s
Ubuntu Serial Port Monitor Cable Adapter
Choose serial port setup, change the serial device to /dev/tty0, change the Bps/Par/Bits to 9600 8N1. Now choose save setup as… and change the name to whatever you like, for example cisco, now save and exit from minicom.
To use this configuration use the following command.
> minicom cisco
Now the serial connection should open up and it will be connected with the cisco device.
Related posts:
This tutorial will go over the steps to go through in order to set up a serial console on Ubuntu Linux.
Unlike most other distros, Ubuntu uses upstart instead of sysvinit and as such, there is a few differences between most of the tutorial that you might find on the internet regarding how to set up a serial console.
A Serial Console becomes handy when running a headless server (i.e no keyboard and screen) or if you cannot connect a a server because of a network issue.
In this tutorial, we will set up a serial console on the server, the machine we want an access to. Setting up a serial console client will be covered in another article.
1. Checking the serial devices
In order to find which devices are available on a box, you can run:
From this output, we can guess that there is 1 serial interface (/dev/ttyS0). You might possibly have more than one interface on your machine, this tutorial considers that you are using device 1 (ttyS0), if you use the second device, you will need to change ttyS0 by ttyS1.
Ubuntu Serial Port Monitor Windows 10
2. Setting up the serial console on the server
On the server, we are going to set up:
- A serial console on ttyS0
- Have kernel booting messages output to the serial console
- Make Grub outputs to the serial console
2.1. The serial console
To set up a serial console, We need to create a new file called /etc/event.d/ttyS0 in order to spawn a getty on the serial device. getty will take care of prompting the user for a username and password.
Go and edit /etc/event.d/ttyS0 and add:
To authorize root (if you enabled root account on your machine) to log in through the serial console, you need to edit /etc/securetty and add:
2.2. Having grub outputting to ttyS0
grub can be configured to output on the serial console.Edit grub and add:
In the section before the different kernels. This will take care of having grub being displayed one the serial console so you can actually modify grub through the serial console or boot using another kernel.
If using ttyS1, then change it to –unit=1
Also, in order to get the booting messages outputted to the serial console, you can append to your kernel line the following:
So, finally, the kernel line will look like:
That’s it, upon next reboot, you will be able to connect directly to your box using a serial console!.