Connecting to a specific D3 PIB

Configuring Telnet in this manner bypasses a UNIX log in, providing a direct login to a D3 PIB.

Procedure

  1. Create a permanent directory to hold both the following script and the symbolic links to that script.
    • For this example the directory name is d3net. It is placed in the /usr/bin directory. The full path is /usr/bin/d3net.

    • Set the permissions to read and execute (rx) for all users.

    This example creates the directory named d3net in the /usr/bin directory, and changes the permissions to read and execute for all users.

    mkdir /usr/bin/d3net 
    chmod a+rx /usr/bin/d3net
  2. Select a range of port numbers not currently in use on your system, and large enough for all your D3 PIBs.

    This example uses PIBs 1 through 20. The port range is 16001 to 16020.

  3. Create a script to calculate the PIB from the port number and place it in the directory created in step 1.

    The script executes d3 passing the result of the subtraction as the only argument on the command line. The following sample script does this.

    For this example, assume the script name is netcon and the directory name is /usr/bin/d3net, the full path is /usr/bin/d3net/netcon. Enter:

    #!/bin/bash 
    PIB=$(basename $0) 
    PIB=$(($PIB – 16000)) 
    exec /usr/bin/d3 $PIB 
  4. Change the permissions to read and execute for all users.
    chmod a+rx /usr/bin/d3net/netcon
  5. Create a symbolic link (ln –s) for each port in the range, using the port number as the name of the link, and the script you created as the source.

    Remember, in our example the script name is netcon, and the port range is 16001 to 16020.

    ln –s /usr/bin/d3net/netcon /usr/bin/d3net/16001
    ln –s /usr/bin/d3net/netcon /usr/bin/d3net/16002
    ln –s /usr/bin/d3net/netcon /usr/bin/d3net/16003
    ln –s /usr/bin/d3net/netcon /usr/bin/d3net/16018
    ln –s /usr/bin/d3net/netcon /usr/bin/d3net/16019
    ln –s /usr/bin/d3net/netcon /usr/bin/d3net/16020

    When all the links are created, a long listing (ls –l) of the directory looks like:

    total 50
    lrwxrwxrwx 1 rootroot 6  Jan 14 18:47 16001 -> /usr/bin/d3net/netcon
    lrwxrwxrwx 1 rootroot 6  Jan 14 18:47 16002 -> /usr/bin/d3net/netcon
    lrwxrwxrwx 1 rootroot 6  Jan 14 18:47 16003 -> /usr/bin/d3net/netcon
    lrwxrwxrwx 1 rootroot 6  Jan 14 18:47 16018 -> /usr/bin/d3net/netcon
    lrwxrwxrwx 1 rootroot 6  Jan 14 18:47 16019 -> /usr/bin/d3net/netcon
    lrwxrwxrwx 1 rootroot 6  Jan 14 18:47 16020 -> /usr/bin/d3net/netcon
    -rwxr-xr-x 1 rootroot 72Aug  7 14:03 netcon
  6. Create a file in the /etc/xinetd.d directory, like the one shown below, for each of the ports that will be used for log in.
    Note: For every file that is put into the /usr/bin/d3net directory, a corresponding file must be created in the /etc/xinetd.d directory in order to allow the proper operation of the nailed Telnet feature.

    For Example:

    service d316001
         {
         type           = UNLISTED
         socket_type    = stream
         protocol       =tcp
         wait           = yes
         server         = /usr/sbin/in.telnetd
         server_args    = -L /usr/bin/d3net/16001
         port           = 16001
         }

    In the example above, note that the:

    • Name of this file is d316001 (d3+ port number). The name of each file in your range of ports will be d3 + the next port number in the sequence of numbers chosen for your range of ports. For instance, the next file name for this example will be d316002.

    • service d316001 line of our example uses the same name as the file name.

    • server_args line must end with the same number used in the file name and the service d316001 line.

    • port line of our example must reflect the same number as the service d3 , and the server_args lines; note that in our example the port number is also 16001 .

    After all of the files in your range of ports have been created, issue this command to restart the deamon.

    /etc/rc.d/init.d/xinetd restart