rtn Utility

Host System Utilities - rtn Utility

The rtn (rtelnet) utility is a modified version of the Berkeley telnetd program and allows UNIX software to access serial devices attached to port server ports. It creates a pseudo-tty (pty) device on the host that is connected via TELNET or raw TCP to an port server serial or parallel port. This allows UNIX programs such as tip(1C) and uucp(1C) to access serial devices attached to port server ports. Rtn works like a telnet daemon program (telnetd) except in a reverse fashion; instead of accepting connections from other network machines, rtn makes connections to the port server. Rtn creates a new file-like device (usually in /dev) that programs can open and use like a normal /dev/tty terminal.

Syntax

  • rtn.{osname} {-h ip_address} {-d device_name} {-p tcp_port_number} [-v] [-o [-s]] [-u uid] [-F] [-D level {-f filename}]
    where osname is the extension given the rtn file for your operating system, e.g., rtn.aix or rtn.sco (see table of
    operation system file names below).

Flags

-d Specifies the device name to use for the pty. Can be any valid path and filename, such as /dev/port1.
-h Specifies the host name or the IP address of the port server to which the rtn connects.
-p Specifies the tcp port on the port server to which the rtn connects.

-o

Causes rtn to open the master pty, slave pty (unless -s is used) and the network connection as soon as rtn is started. Useful if detection of opens and closes is not necessary. If the slave pty is closed and then immediately reopened, the second open will fail. In that case, use both the -o option and the -s option
-s Prevents the rtn from opening the slave side of the pty. Useful if detection of opens and closes is necessary. Must be used in conjunction with the -o option.
-u Specifies the UID. Useful if ptys are used with tip or cu.
-F Causes rtn to stay in the foreground. Use to override the default of rtn in the background.
-v Displays version information.
-D Turns on debugging. Use this option in combination with the -f option. Specify level of debugging to be recorded as follows:
  1. Fatal errors
  2. Recoverable errors
  3. Warning messages
  4. General informational and status messages
  5. Initialization data
-f Specifies the filename to which debugging information is recorded.

 

rtn default behavior

If you use only the required rtn options (-d, -h and -p), rtn operates as follows:

  • The master pty opens immediately.
  • The slave side of the pty does not open.
  • The network connection is made only after the slave pty is opened by a process.
  • When the slave side of the pty is closed, the network connection is lost. It
  • is reestablished when the slave side of the pty is reopened.

Installing rtn

The rtn utility is provided in tar format on the CD which accompanied the port server. Extract the particular rtn executable for your system onto your system disk. For example, for a Solaris Intel system, extract rtn.soli onto your disk.

The port server supports at least the following operating systems:

Operating System

Utility Name

AIX 4.1

rtn.aix

Digital UNIX 4.0

rtn.osf

DGUX 3.10/3.11/4.11

rtn.dgux

HP UNIX

rtn.hpux

Motorola R40V4.4

rtn.mot

Motorola R32V3

rtn.r32

NCR MP-RAS 3.01.00

rtn.ncr

SCO OpenServer Release 5

rtn.sco

Solaris Intel 2.1/2.3/2.4/2.5

rtn.soli

Solaris Sparc 2.3 (SunOS 5.3)

rtn.sols

SunOS 4.1.3

rtn.sun

UnixWare 2.0

rtn.uw


If you are installing rtn to work with the AIX System Management Interface Tool (SMIT), use the AIX4 SMIT Interface on disk in SMIT installp format.

Before Setting up a Device on a Serial Port

When setting up a terminal or a printer on a serial port, the configuration for the port should be set to rtelnet. To determine if there is a default configuration, use the port server admin command:

show port portnumber
where portnumber is the number of the serial port on which the device is being set up. In this example, the device is being set up on port 0. The show command is:
show port 0
The current settings will be displayed as follows:
Port : port0
Baud Rate : 9600
Inactivity Timeout : 6000
Character Size : 8
Stopbits : 1
Parity : none
Switch character : <undef>
Ignore dcd : no
Input Processing : xoff
Output Processing : xon
Modem Name : generic
Configuration(s) : rtelnet
If the setting for configuration does not show rtelnet, use the arrow keys to move to the entry field for configuration and change the entry to rtelnet.

 

Sample configuration with dial-out modem

In this example, a dial-out modem is attached to port 3 of an port server with an IP address of 123.56.78.90:

  • Using the port server's admin command set, configure port 3 as an rtn-accessible port using the set rtelnet command.
  • Start up the rtn program to create the pseudo-device:
rtn -h 123.56.78.90 -d /dev/port3 -p 9003
  • To enable use of the modem via tip on a BSD host, create a new system definition in /etc/remote, specifying /dev/port3 as the tip (dv) device. For example:
port3:\
:dv=/dev/port3:br#9600:pa=none\
:el=^C^S^Q^D:ie=%$:oe=^D
  • To enable the modem for cu connections, create an entry for the new pseudo device in the /usr/lib/uucp/Devices file. For example:
Direct port3 - 9600 direct
 
 
Sample configuration with printer port

In this example, a parallel printer is attached to printer port (port 32) of an port server with an IP address of 123.56.78.90:
  • Using the port server's admin command set, configure port 32 as an rtn-accessible port using the set rtelnet command.
  • Start up the rtn program to create the pseudo-device:
rtn -h 123.56.78.90 -d /dev/port32 -p 9032 -o
  • To send a file directly to the printer:
cat my_file > /dev/port32

 

For an RCS/5000 or RCS/6000 port server, the printer port is port 17.

For more information on setting up the port server side of the connection, see the RTELNET command.

For more information on using rtn for various applications, see the README file on the distribution media.

Raw reverse telnet

The raw reverse telnet feature allows programs to send and receive data through port server ports without using special reverse telnet programs, psuedo-ttys, or port re-director programs. A program need only open a TCP session to a specified protocol port number on the port server. Bytes written into the TCP endpoint will be transmitted, unchanged, on the corresponding port server serial port. Data received on the port server serial port will appear on the TCP endpoint unchanged. There is no intervening protocol nor processing. Raw reverse telnet is automatically enabled when you setup the rtelnet processing on a serial port or modem/printer pool.

Some sample programs are available through anonymous ftp at our WWW or FTP site or by calling customer support. The programs may be used to demonstrate and exercise the raw reverse telnet feature with a loopback cable connected to two port server serial ports. They also serve as examples implementing other programs to use raw reverse telnet. See the README file included with the sample programs for further details.
 
 

AIX

The following sections provide instructions and examples for setting up a terminal or a printer for AIX.

Setting up a Terminal 

To setup a tty device (terminal) for login on AIX, you can use the smit program or you can enter a mkdev command on the command line
 

smit

  • Type: smit tty
  •  Select Add a TTY
  • Select: tty rs232 Asynchronous Terminal
  • Select: rcs0 Available rcs0 RCS/4000 Terminal Server (16-Port)  
  • The following display will show the current settings. To change any settings, use the arrow keys to move to the desired field and type or select the appropriate value. Press <ENTER> after making all changes.

 [Entry Fields]
TTY type tty
TTY interface rs232
Description Asynchronous Terminal
Parent adapter rcs0
* PORT number [9000] +
Enable LOGIN enable +
Keep network connection open yes +
Keep pty slave side open no +
Pty owner (UID) []
Debug level 0 +
Debug log file [/var/adm/ras/rtnlog]
Drain timeout [sec]
Click '?' for TCP Port info (or press F1)
Click '?' for Device Characteristics (or press F1)

 For example, in the above screen, you may need to type 9000 in the entry field for port number.    

mkdev

Enter the following command:

mkdev -c tty -t 'tty' -s 'rs232' -p 'rcs0' -w '9000' -a login='enable'

The command will create a device /dev/tty0 and run rtn.aix from /usr/sbin on port server port 9000. The login prompt will appear on the terminal that is plugged into port server port 0.

Setting up a local serial printer

To set up a local serial printer (in this example, an HP Laserjet), you can use the smit program or you can type a command at the command line.

 smit

  • Type: smit printer
  • Select: Print Spooling
  • Select: Add a Print Queue
  • Select: local
  • Select: Hewlett-Packard
  • Select: hplj-4 Hewlett-Packard LaserJet 4.4M
  • Select: Add New PrinterSelect: rs232
  • Select: rcs0 Available rcs0 RCS Terminal Server (16 Port)
  • Select: Add a Print QueueThe following display will show the current settings. To change any settings, use the arrow keys to move to the desired field and type or select the appropriate value. Press <ENTER> after making all changes.
[TOP] [Entry Fields]
Description Hewlett-Packard LaserJ>
 
Names of NEW print queues to add
PCL []
PostScript [HP1]
HP-GL/2 []   
 
Printer connection characteristics
* PORT number [9001] +
BAUD rate [9600] +  
PARITY [none] +
BITS per character [8] +  
Number of STOP BITS [1] +  
FLOW CONTROL to be used [xon] +  
Printer TIME OUT period (seconds) [600] +  
STATE to be configured at boot time available +
[BOTTOM]
 
 
 
command line

Enter the following command:

/usr/lib/lpd/pio/etc/piomkpq -A 'local' -p 'hplj-4' -v 'hplj-4' -s 'rs232' \
-r 'rcs0' -D ps -q 'hp13' -w '9001'

The command will start rtn.aix on port 9001.
 
 
 
To setup a parallel printer 
 
 
Setting up a parallel printer is a two-step process: 1) set up a port server parallel port device; and 2) set up an AIX print queue for the port server parallel port device. In this example, the port server is an RCS/4000 and the parallel port device is an HP Laserjet.

Step 1: Set Up Device

  • Type: smit printer
  • Select: Printer/Plotter Devices
  • Select: Add a Printer/Plotter
  • Select: rtn RCS Parallel Port
  • Select: parallel.rtn
  • Choose the appropriate port server parent adapter from the list provided.
  • The following display will show the current settings. To change any settings, use the arrow keys to move to the desired field and type or select the appropriate value. Press <ENTER> after making all changes.

[Entry Fields]
Printer/Plotter type rtn
Printer/Plotter interface parallel.rtn
Description RCS Parallel Port
Parent adapter rcs0
* PORT number [9032] +
Keep network connection open yes +
Keep pty slave side open no +
Pty owner (UID) []
Debug level 0 +
Debug log file [/var/adm/ras/rtnlog]
Click '?' for TCP Port info (or press F1)
Click '?' for Device Characteristics (or press F1)

  • The command run by smit will create a device /dev/lp0 and run rtn.aix from /usr/sbin on port server port 9000.
  Step 2: Set Up Print Queue
  • Type: smit printer
  • Select: Print Spooling
  • Select: Add a Print Queue
  • Select: rcs4000 Printer Attached to RCS Parallel Port
  • Select: Hewlett-Packard
  • Select: hplj-4 Hewlett-Packard LaserJet 4.4M
  • The following screen will show the current settings. To change any settings, use the arrow keys to move to the desired field and type or select the appropriate value. Press <ENTER> after making all changes.

Name of RCS Parallel Port device [lp0]

For example, you may need to enter: lp0

  • The next screen to be displayed will allow you to add a print queue for the selected device. To change any settings, use the arrow keys to move to the desired field and type or select the appropriate value. Press <ENTER> after making all changes.

[Entry Fields]
Description Hewlett-Packard LaserJ>
Printer name lp0
Names of NEW print queues to add
PCL []
PostScript [hp32]
HP-GL/2 []

  • You should now be able to send output to the printer using the command:

lpr -Php32 <filename>