11.3. Cable from console port to terminal (or another PC)
The RS-232 standard allows for, but does
not specify, the interconnection of two computers without
intervening modems. A special cable is required, called a
"null modem" cable.
The wiring within the null modem cable depends upon the
handshaking and control signals that are needed. Differing
manufacturers have differing views on this topic, so don't buy a
null modem cable that does not come with a wiring diagram.
Linux needs all of the flow control and modem control signals
to be correctly wired. The correct wiring of a null modem cable is
shown in Figure 11-1 with an
alternative shown in Figure 11-2.
Linux uses CTS and RTS to
do handshaking, preventing the computer from overrunning the
terminal and preventing the terminal from overrunning the computer.
If you are connecting two computers together, then you will not get
reliable file transfers without
CTS/RTS handshaking.
Linux uses DSR and DCD to
sense that a terminal is connected. It will then request a login.
If a session is established and DCD falls then
Linux will log out the user.
Linux uses DTR to force the link to be
cleared. It does this after a user logs off to free up the
communications channel.
Either of the null modem designs in Figure 11-1 or Figure 11-2 meets the requirements of
the Linux kernel. Figure 11-2
may be marginally better when both computers are remotely located,
as the differing states of DSR and
DCD can be used to determine which end of the
null modem cable has become faulty.
All null modem designs have a common flaw. Computers
interconnected with real modems modem will drop Data Set Ready for
some time after the local modem is reset by the local computer
dropping Data Terminal Ready. Most software is designed to
accomodate this slight difference between modem links and null
modem links.
Major security exposures and significant loss of reliability
can occur with incorrectly wired null modem cables, including the
cables in Figure 11-3, Figure 11-4 and Figure 11-5.
Unfortunately not all Linux boot loaders support the control
signals required by the Linux operating system. This odd state
of affairs may force you to do away with control signals and
handshaking if you need to issue commands to the boot
loader.
There are two ways of defeating the RS-232
handshaking: software and hardware.
If you have a modem then by far the best technique is to
disable the control signals and handshaking by using
AT commands to configure the modem's software.
This allows the handshaking to be restored when the boot loader
authors correct their support for serial connections.
For a null modem cable the best approach is to disable
handshaking in your terminal emulation software.
In the worst case for a null modem you will need a cable that
falsifies the handshaking and control signals. Try not to use
these cables in a production environment.
If you are happy with a quick hack, perhaps just to use a
serial console to grab a kernel oops message, then you can
configure some getty programs to ignore
the RS-232 status signals. For example,
mgetty has the direct
option in mgetty.conf. In this case only a
three-wire or two-wire RS-232 null modem cable
is needed.
Don't use these cables in a production environment.