Configuring cnsconnect for Printers and Modems


About this document
Assumptions and terms

About this document

The purpose of this document is to assist with configuring the 7318 and the cnsconnect daemon for printers and modems. This document was designed for AIX System Administrators with a knowledge of AIX administration and the 7318. Using this document, configuring the 7318 and cnsconnect takes about 20 minutes.

Using the reverse telnet function of the 7318, the cnsconnect daemon can be used to provide a connection to a specific port on the 7318 and thereby access the device (printer or modem) attached to it. This document contains modules for the 7318 reverse telnet configuration and the cnsconnect daemon configuration.

This document applies to AIX versions 3.2.5 through 4.x.

Document scope

This document is designed to configure the 7318 and cnsconnect only. This document does not cover the steps involved with adding a print queue or configuring modem applications like ate or cu. Also, this document does not contain detailed explanations of the modules or steps used in the configuration methods.

Assumptions and terms


Before using this document, it is assumed that:

Terms used in this document


To use this document effectively, it is necessary to:


  1. Editing the 7318 configuration file

    In the 7318 configuration file, there are two sections that must be configured to enable reverse telnet. For example, telnetting from the computer to a serial port on the 7318. The first is the Port stanza and its Session stanzas. The second section involves the Telnetd stanzas.

    1. Open the configuration file for the 7318 model S20 with your favorite editor. This file is typically in the /usr/lib/cns directory, and should be named after the 7318's Ethernet address.

    2. Find the [PortXX] stanza in the file for which you want to enable reverse telnet.

      Where XX refers to the port number 00 through 15.

    3. In the [PortXX] stanza, set mscreen and tprint to 0.

      A sample stanza follows:

    4. If you are configuring this port for a modem, then uncomment the stty line in the Port stanza.

      Remove the ";" (semicolon) sign on the stty line in the Port stanza and add hupcl clocal to this line.

      A sample entry follows:

          stty=9600 hupcl  clocal 
    5. In each of the Session stanzas for the port, change the application line from command or dynamic to reserved.

      A sample Session stanza [Session0] follows:


      A sample Session stanza [Session1] follows:


      A sample Session stanza [Session2] follows:


      A sample Session stanza [Session3] follows:

    6. If you are configuring this port for a printer then add an stty= line under the first session stanza for that port.

      The stty line should read stty=opost onlcr tab3.

      A sample Session stanza [Session0] follows:

          stty=opost onlcr tab3 
    7. Find the [Telnetd] stanza in the file.

    8. Uncomment the [Telnetd] stanza if necessary.

      Set the ntelnetds line to the total number of ports you are configuring for reverse telnet. Make sure that both the [Telnetd] and ntelnetds lines are uncommented.

      A sample entry follows:

    9. Below the [Telnetd] stanza, find the numbered telnetd stanza, [Telnetd00].

      For additional ports to be configured with reverse telnet, additional [TelnetdXX] stanzas should be used, one for each physical port. XX is incremented from 00 to 15 as more physical ports are configured for reverse telnet.

    10. Uncomment the [Telnetd00], device, port, and tcpPort lines in the [Telnetd00] stanza.

    11. Set the port line to the physical serial port number that was configured above, for example, 0 through 15.

    12. Set the tcpPort= line to a TCP port number that is unique across all of the TelnetXX stanzas created.

      This is the TCP port number to which this physical port will respond for telnet.

    13. Set the device= line to COM.

      A sample stanza [Telnetd00] follows:

    14. Repeat steps 2 through 14 above for each additional port to be configured for reverse telnet and cnsconnect.

    15. Save any modifications and exit the 7318 configuration file.

  2. Editing the cnsconnect configuration file

    The cnsconnect configuration file is used to specify how the cnsconnect daemon will connect with the physical port on the 7318 and whether it will be used for a printer or modem.

    1. Open the /usr/lib/cns/cnsconnect.cnf file with your favorite editor.

    2. Go to the end of the file and add a new line.

    3. In the new line, specify the name of the special device file to be associated with the printer or modem on the 7318. For example, /dev/printer1 or /dev/modem1).

    4. Add some spaces after the device filename and then specify the IP address of the 7318.

    5. Add some spaces after the IP address and type the TCP port number that was specified in step 1 in the previous section.

      This is the TCP port number that was associated with the physical port number in the 7318 configuration file.

    6. Add some spaces after the TCP port number and then type bin for a printer configuration or hupcl for a modem configuration.

      Sample entries follow:

          /dev/printer1         5101    bin      #For a printer 
          /dev/modem1         5102    hupcl    #For a modem 
  3. Reboot the 7318

    Now that the necessary configuration changes have been made, boot the 7318. The 7318 can be rebooted in two ways. Choose the most convenient method.

    1. Recycle the 7318's power by unplugging and replugging the power cord.

    2. Issue the load command from the BIOS console session on the 7318.

      After approximately 20 seconds, the light sequence on the front of the 7318 should be either 1110 or 1101. If the sequence is (1 Flash 1 0) or (1 Flash 0 1), the 7318 has not completed the boot process successfully.

  4. Testing the port with a reverse telnet

    Once the 7318 has been rebooted, it should use the updated configuration file and be ready for a reverse telnet to the configured port. To test the reverse telnet configuration follow the steps below.

    1. From the AIX shell prompt, type the command tn 7318_ip_address tcp_port.

      Sample command and output follow:

          $ tn 5101 
          Connected to 

      If the 7318 port is configured correctly, you should receive the Connected message from telnet and the connection should not drop automatically. If the connection stays established, you can drop the connection yourself by pressing Ctrl-T (control-T).

    2. Determine the next action.

      If the connection is never established, or is dropped immediately, inspect the 7318's internal log by typing show log at an s20 command prompt (from a terminal attached to one of the 7318's serial ports). If this shows nothing, then there is probably a problem with the configuration of the modem or printer itself. Ensure that the modem or printer is configured and working correctly outside of cnsconnect.

      If the connection was successful, then proceed to the next section, "Starting the cnsconnect daemon".

  5. Starting the cnsconnect daemon

    The cnsconnect daemon associates a special device file with a reverse telnet connection. Applications can then reference this device file and utilize the telnet connection to access the printer or modem on the 7318 serial port.

    1. Once reverse telnet is working successfully and the cnsconnect.cnf file is configured, start the cnsconnect daemon with the following:
          cnsconnect -c /usr/lib/cns/cnsconnect.cnf -l /tmp/cnsconn 
    2. Once cnsconnect has started, execute:
          netstat -an | grep 7318_ip_address 

      There should be a connection listed in the ESTABLISHED state. At this point, you can begin using the special device file (for example, /dev/printer1 or /dev/modem1) with your application.

    3. The following line may also be added to the /etc/inittab file so that cnsconnect is started automatically upon the computer reboot. A sample entry follows:
          cnsconnect:2:wait:/usr/lib/cns/cnsconnect -c \ 
          /usr/lib/cns/cnsconnect.cnf > /dev/console 2>&1 

[ Doc Ref: 90605199414596     Publish Date: Oct. 16, 2000     4FAX Ref: 7444 ]