[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
7318 Model S20 Guide and Reference

Using Dial-Out Modems and Reverse Telnet

You can dial out on a modem attached to the 7318, using the telnet command from hosts on the network. To use a dial-out modem on the 7318:

  1. Attach the modem to a 7318 port.
  2. Configure the reverse telnet service, or telnetd daemon, to control the port.
  3. Use the telnet command on the host or the cnsconnect command to access the 7318.

The telnet command provides a direct attachment to the modem.

Configuring Reverse Telnet Service for Modems

The reverse telnet service is known as the telnetd daemon. To configure this service, you must add entries to the configuration file that bind the service to TCP ports and inform the 7318 what physical ports to use for the reverse telnet service.

Note: The word port is used in two ways in the following sections. A TCP port is the number assigned to a particular TCP service. A 7318 port is an electrical interface and its associated driver software that you can use to connect a device to the 7318.

[Telnetd] Section

The [Telnetd] section lists the number of [TelnetdNN] sections in the configuration file. Set the NN parameter to the number of instances of the reverse telnet service that you plan to run, as follows:

ntelnetds=NN Specifies number of [TelnetdNN] sections.

[TelnetdNN] Section

The [TelnetdNN] section lists associations between the telnetd daemon (reverse telnet service) and logical devices. Such associations are made only after a connection has been made to a particular TCP port. Based on the ntelnetds entry in the [Telnetd] section, the configuration expects sections [Telnetd00] through [Telnetd(NN-1)]. The following entries fall under the [TelnetdNN] section:

device=String Defines a 7318 logical device to which the telnetd daemon attaches when a connection is made. Acceptable values for the String parameter are:
COM Specified for applications that have their own line protocols.
LPT Specified for printer applications that have their own line protocols.
TPRINT Specified for a transparent terminal printer.
LDTCOM Specified for a terminal.
LDTLPT Specified for a printer.

Refer to the Legal Device Types table for more information on devices and sessions.

port=Integer Defines the number of 7318 serial or parallel ports to which the telnetd daemon attaches when a connection is made.
tcpPort=N Defines the TCP port, where the N parameter is a decimal number.

The following example configures a single modem device on serial port 9 of a 7318:

[Telnetd]
ntelnetds=1
[Telnetd00]
device=com
port=9
tcpPort=5109

Choosing TCP Port Numbers for Reverse Telnet Service

TCP port numbers, used by this service, are represented by 16-bit integers. TCP reserves port numbers in the lower range for both well-known service ports as well as ports reserved for restricted system access. These reserved and restricted port numbers lie in the range of 1 through 1023. Port numbers in this range should not be used on the 7318 to avoid conflict with other services.

Any number in the range 1024 through 65535 is a valid TCP port number to use for a specific telnetd port. However, no two telnetNN instances on the 7318 should use the same TCP port number, because it causes errors during the system configuration phase. See "Configuring Modem Pools" for information and an example of how to configure multiple devices on a single telnetd port.

One possible configuration assigns TCP ports in the range 5001 through 5016 for shared modems on communication ports 0 through 15. These numbers are arbitrary and suggested for mnemonic convenience.

If you have a single instance of the reverse telnet service defined on your 7318, you may want to use TCP port 23, which is the Internet assigned number for the telnet service. Using TCP port 23 permits users on other systems to run the telnet command using the name or IP address of the 7318 without specifying a TCP port. Also, some implementations of the telnet command do not support a TCP port number other than 23.

Configuring Modem Pools

Modem pools permit reverse telnet users to share a group of modems so that the telnet connection succeeds if any modems are free. To define a modem pool, use a comma-separated list of port numbers in a [TelnetdNN] section. For example:

[Telnetd02]
device=ldtcom
port=11,12,13
session=6
tcpPort=5300
inout=0

When you attempt to connect to the specified TCP port, the telnetd daemon will cycle through the list of ports looking for a port that is not in use. It will complete its connection using the first available port. If all ports in the list are in use, the telnet connection will fail.

Establishing a Telnet Connection from a Host

To use the telnet command from a host to access a modem:

  1. Attach the modem to a 7318 port.

  2. Create a [Telnetd] and [TelnetdNN] section for the port in the configuration file. The [TelnetdNN] section contains both the physical name of the 7318 port as well as the TCP port number on which the telnetd daemon listens while waiting for connections.

  3. Use the reboot command from the command shell or power-cycle the 7318 to load the modified configuration file.

To connect to a modem on the 7318, use a command similar to:

telnet 7318Addr [TCPPort]

Here, the 7318Addr parameter is the Internet domain name of the 7318 or its Internet address, and the TCPPort parameter is the TCP port number you have configured to listen for telnet command connections. If you assign a reverse telnet service to the standard telnet service port number, 23, then you do not have to specify a TCP port on the telnet command line.

The previous command connects your telnet session directly to the telnetd daemon on the 7318 at the TCP port, TCPPort. The telnetd daemon is preconfigured to access a specific 7318 serial port defined by the configuration file. You now have a virtual connection to the device. If the device is a modem, you can enter modem commands as if you were directly connected to the modem with a terminal program.

If the telnet connection fails, check the following:

cnsconnect for Modems

Syntax

cnsconnect [ -c ConfigurationFile ] [ -l LogFile ]

Description

The cnsconnect program is shipped with the 7318 Model S20 software. This program uses pseudo-tty devices on the host computer to make 7318 ports addressable like devices that are directly attached to the host. This means that you can use host-based communications programs such as cu and the associated UUCP function on your host rather than telnet.

The cnsconnect command spawns a daemon process for each record in the cnsconnect configuration file. That process maintains a TCP/IP connection between a pseudo-tty represented by a user-defined device name. If the 7318 is unreachable, cnsconnect retries until it makes a connection.

Flags

-c ConfigurationFile The cnsconnect command creates the devices it monitors and performs address binding using a configuration file called /usr/lib/cnsconnect.cnf. Before running the program, you should edit this file to match your configuration.
-l LogFile Any errors detected by this command are reported in the user-specified LogFile. If no LogFile is specified, /tmp/cnsconn is used. The pid of the cnsconnect process is appended to the end of the LogFile. Errors detected by the cnsconnect command are reported with syslog, using LOG_ERR.

The cnsconnect command uses pseudo TTYs and reverse telnet to connect a user-specified device name to a physical device on a 7318 port.

The configuration file consists of multiple records, defining one device per line. Each line has the following format:

DeviceName      TargetHost     TcpPort     Flags

DeviceName is the name of a special file that the user application uses to access the specified device. Typically, this should be a name in the /dev directory, for example, /dev/modem1 or /dev/printer3. This device is created by the cnsconnect command.

TargetHost Specifies the address or name of the 7318 unit to which the user wants to connect.
TargetPort Specifies the number of the TCP port on the 7318 unit that is bound to the desired port. This must match the TcpPort parameter in the [TelnetdNN] section for the port.
Flags The valid flags are:
bin Specifies 8-bit binary transmission instead of 7-bit ASCII characters. This may be required for some printers.
hupc1 Specifies that the 7318 should drop the connection when the device is closed. This should be used for modem devices.
keepalive=N Specifies that the ping interval for this connection should be N seconds. A value of 0 disables the keepalive feature. The default is 30 seconds. This may be needed for remote 7318 devices for better performance.

You do not execute the cnsconnect command directly. It executes as a background daemon that is started when the system is booted. Once executing, the devices monitored by cnsconnect will be available for accessing 7318 ports. The program is normally started by a shell script in the /etc/inittab file following the TCP initialization entry. The /etc/inittab file entry should look like the following:

cnsconnect:2:wait:/usr/lib/cns/bin/cnsconnect >/dev/console 2>&1 # Start cnsconnect daemon

Instructions for Setting the cnsconnect ping/keepalive Interval

The cnsconnect command periodically sends out a ping message to determine if the remote host or 7318 is alive. The interval between pings can be changed using a keepalive option in the cnsconnect's configuration file. The default configuration file is /usr/lib/cns/cnsconnect.cnf.

The option is:

keepalive=NNNN

Where NNNN is the number of seconds between pings. If NNNN is set to 0, the ping/keepalive mechanism is disabled and no pings are transmitted. If the keepalive option is not specified, the default interval is 30 seconds.

The following is a sample cnsconnect configuration file to demonstrate how to configure the option:

# Sample cnsconnect configuration file
# disable keepalive on port2
/dev/port2         204.30.137.120   5202   bin   keepalive=0
# Set keepalive interval for 20 seconds on port4
/dev/port4         204.30.137.120   3333   bin   keepalive=20

When this option is tuned for a configuration, the keepalive option in the [TCP] section of the 7318 Model S20 configuration file should also be tuned.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]