Previous Topic: Manage Your Telnet Connection

Next Topic: Send Control Codes or Special Characters to the Remote Host


Use Line Commands to Connect to a Remote Host

A benefit of using the TELNET command to establish a connection from an OCS window or from the Command Entry panel is that you can issue both Telnet and product commands from the same command entry point at the same time.

The TELNET command can be used in the following ways:

Regardless of the way in which you use the TELNET command to establish a connection, you may need to occasionally send special characters to the remote host.

TELNET Command: Start a Telnet Connection

Use the TELNET command to start a Telnet connection.

This command has the following format:

TELNET ip_address|host_name
ip_address

Specifies the IP address of the host to which you want to connect.

host_name

Specifies the name of the host to which you want to connect.

To start a connection with a configuration other than the default (for example, to connect to the remote host mercury on a port other than the default port 23), you should enter the command as follows:

TELNET mercury PORT=1976
PORT

Specifies the port number on the remote host.


Use Telnet in OCS Takeover Mode

You can turn your OCS window into a virtual terminal for a nominated remote host by using the OCS takeover mode. In takeover mode, you retain the ability to issue product commands and receive unsolicited notifications, but you can also issue commands directly to the remote host by typing the command and pressing Enter.

To start a Telnet connection to the remote host, mercury, in takeover mode, use the TELNET command in the following form:

TELNET mercury MODE=OCS

Note:  MODE=OCS is the default when you are in OCS.

When you establish a connection in OCS takeover mode, the name of the remote host to which you are connected appears to the right on the line immediately above the command entry line.

When you press the Enter key in takeover mode, the data you have entered at the command line is passed to the remote host.

When you start a Telnet connection in takeover mode it overrides the following function key assignments in your OCS window:

F3

Becomes Disconnect—this is used to end your current Telnet connection and reinstate normal function key assignments.

F12

Becomes the OCS Enter key—this is used to issue Management Services commands in the OCS environment.

Enter

Becomes the Telnet Enter key—this is used to issue commands to the remote host.

Use Telnet in Line Mode

In line mode, you retain normal OCS operation and must issue a new command each time you want to communicate with the host.

For example, to start a Telnet connection to the host, mercury, in line mode, use the following command form:

TELNET mercury MODE=LINE

To send data to the remote host use the TNSEND command and the identifier of the connection (usually the host name). For example if the host, mercury, prompts you for your login ID on starting a connection, you would enter:

TNSEND mercury user01

To reduce the amount of typing required, you can set up your own equate. For example, you might want to assign the period (.) as an equate to send data to the host, mercury. To do this, enter the following OCS command:

EQ . -START $TNCALL COMMAND=TNSEND ID=mercury DATA=

The above equate means that to send data (for example, the login ID requested in the earlier example), you need only enter:

.user01

Note:  The TNSEND command is itself an equate which is set up as follows:

EQUATE TNSEND+ -START $TNCALL COMMAND=TNSEND ID=

Automate Commands Issued to Remote Hosts

You can use an NCL procedure to automate the starting of a connection and the issuing of commands to the remote host to which the connection was made.

Example

You may want to create a procedure that logs on to Router1 and checks its interfaces. The following example shows how you can do this.

. . . -* Start the connection -* &INTCMD TELNET Router1 MODE=LINE . . . -* -* Receive messages from the router -* &INTREAD SET . . . -* -* Send the SHOW INTERFACES command to the router -* &INTCMD TNSEND Router1 SHOW INTERFACES

You could then process the results of the SHOW INTERFACES command and reformat the display for an operator or you could send a monitor message if an error situation is detected.

Note:  Issuing &INTCLEAR TYPE=ALL causes the connection to be terminated. Use &INTCLEAR TYPE=ANY to clear any queued messages and continue processing.

For information about using NCL procedures and product commands, see the Network Control Language Programming Guide and the online help.

End a Telnet Connection in Line Mode or OCS Take-over Mode

Depending on the type of host to which you are connected, it is likely that you will be disconnected when you issue the logoff command appropriate to that host. If this is not the case, use the TNDISC command (or, in OCS takeover mode, the F3 (Disconnect)) to end the connection.