You want to dial in from home or from other offsite locations, and perform remote administration on a server from your remote serial console. So, you need to set up your server for dial-in administration. You have a proper hardware-controller modem, either internal or external, installed and ready to go. You have enabled your server for serial administration. Now, all you need to know is how to configure the server's modem to answer the phone.
Use Minicom to set your modem to answer when you dial in. Your modem must be connected when you type in the commands.
This recipe uses the Hayes AT command set, which most modems use. Check your modem documentation to make sure. First, configure the basic modem settings, then enter the modem commands:
# minicom -s
--------[configuration]-----
| Filenames and paths |
| File transfer protocols |
| Serial port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
| Exit from Minicom
Select Serial port setup
, and
enter everything as it's shown here (except the serial device, which
must be the correct one for your system):
| A - Serial Device : /dev/ttyS0 | B - Lockfile Location : /var/lock | C - Callin Program : | D - Callout Program : | E - Bps/Par/Bits :115200 8N1 | F - Hardware Flow Control : Yes | G - Software Flow Control : No | | Change which setting?
When you're finished, return to the main menu, and select
Save setup as dfl
, then Exit
. You'll see this:
Welcome to minicom 2.1 OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n Compiled on Jan 1 2005, 19:46:57. Press CTRL-A Z for help on special keys
Next, enter the following commands:
AT &F
OK
AT Z
OK
AT &C1 &D2 &K3 S0=2 M0
OK
AT E0 Q1 S2=255 &W
Then, hit Ctrl-A, Q for the final prompt:
------------------------ | Leave without reset| | | Yes No | ------------------------
Now, you can dial directly in to your server, and it will answer on the second ring. You'll get the same login as when you connect directly with a null modem cable.
You can get away with cheap modems on whatever box you're dialing in from, but it pays to spend the money for a better one on the server.
Don't worry too much about Bps settings because modern modems auto-negotiate line speeds by themselves. You might try lower speeds if you have problems establishing a reliable connection.
How do you know what your serial port number is? The following command shows that the system has a single serial port, /dev/ttyS0. You can tell which one it is because it's the one with a 16550A UART:
$ setserial -g /dev/ttyS[0123]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1: No such device
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
The modem commands are copied from Chapter 13 of the Remote Serial How-to. The complete set of Hayes AT commands is available from many Internet sources. It's a good idea to keep a hardcopy on hand, or to make sure your modem documentation is handy:
minicom-o-s
Start Minicom without sending an initialization string to the modem, and open Minicom's setup menu.
AT
Attention, modem! I have new commands for you.
&F
Restore factory configuration.
Z
Reset to profile 1.
&C1
Data Carrier Detect (DCD) is on; be ready for data from the calling modem.
&D2
Data Terminal Ready (DTR); hang up when the calling modem has finished.
&K3
CTS/RTS handshaking, to prevent lost login characters.
S0=2
Answer incoming calls after two rings.
M0
Turn modem speaker off.
E0
Do not echo modem commands to the screen to prevent confusing the console.
Q1
Do not display modem responses to the screen.
S2=255
Disable modem command mode.
&W
Write changes to nonvolatile memory (NVRAM).
You should have a complete command listing with your modem documentation. Most modems use the Hayes AT command set, which you can easily find on the Internet.
If you want to hear your modem noises, change M0
to M1
,
which turns the speaker on during the handshaking only, then use
L1, L2
, or L3
to set the volume. L1
is the quietest, L3
the loudest.
man 8 setserial
man 1 minicom
Remote Serial Console HOWTO: http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/
The Serial HOWTO goes extremely in-depth into how serial ports work: