Cable from console port to terminal (or another PC)

Remote Serial Console HOWTO
Prev | Chapter 11. Serial cabling | Next

# 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.

Figure 11-1. Null modem cable with full status and handshaking

          Signal ground ---------------------- Signal ground

           Receive data ---------------------- Transmit data

          Transmit data ---------------------- Receive data

          Ready to send ---------------------- Clear to send

          Clear to send ---------------------- Ready to send

    Data terminal ready -----------------+---- Data carrier detect
                                         |
                                         +---- Data set ready

    Data carrier detect ----+----------------- Data terminal ready
                            |
         Data set ready ----+

        Ring indication -- not connected

                              not connected -- Ring indication

Figure 11-2. Variation on null modem cable with full status and handshaking

          Signal ground ---------------------- Signal ground

           Receive data ---------------------- Transmit data

          Transmit data ---------------------- Receive data

          Ready to send ---------------------- Clear to send

          Clear to send ---------------------- Ready to send

    Data terminal ready ----+----------------- Data carrier detect
                            |
         Data set ready ----+

                                         +---- Data set ready
                                         |
    Data carrier detect ----+------------+---- Data terminal ready

        Ring indication -- not connected

                              not connected -- Ring indication

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.

Figure 11-3. Null modem cable with falsified status and handshaking

          Signal ground ---------------------- Signal ground

           Receive data ---------------------- Transmit data

          Transmit data ---------------------- Receive data

    Data terminal ready ---+              +--- Data terminal ready
                           |              |
          Clear to send ---+              +--- Clear to send
                           |              |
    Data carrier detect ---+              +--- Data terminal ready
                           |              |
         Data set ready ---+              +--- Data set ready

          Ready to send -- not connected

                              not connected -- Ready to send

        Ring indication -- not connected

                              not connected -- Ring indication

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.

Figure 11-4. Null modem cable with no status or handshaking

    Signal ground ---------------------- Signal ground

     Receive data ---------------------- Transmit data

    Transmit data ---------------------- Receive data

Figure 11-5. One-way null modem cable with no status or handshaking

    Signal ground ---------------------- Signal ground

    Transmit data ---------------------- Receive data

Don't use these cables in a production environment.

Prev | Home | Next
Cable from console port to modem | Up | Lengths of serial cables