skip book previous and next navigation links
go up to top of book: HP TCP/IP Services for OpenVMS Guide to SSH HP TCP/IP Services for OpenVMS Guide to SSH
go to beginning of chapter: Port Forwarding Port Forwarding
 
go to next page: SSH Command ReferenceSSH Command Reference
end of book navigation links

Port Forwarding 



This section describes how to use port forwarding with SSH for OpenVMS. Standard port forwarding is used if you do not specify FTP port forwarding or X11 port forwarding.

Standard Port Forwarding 

The following examples use TELNET (port 23) and localhost forwarding. Note that other ports in addition to off-host forwarding are also supported.

From an OpenVMS system to another OpenVMS system:

Local port forwardingOn system OpenVMSHOST1, enter the following:

$ SSH-"L"2001:localhost:23 OpenVMSHOST2       
$ TELNET localhost 2001  
Result: The login prompt is displayed for OpenVMSHOST2.Remote port forwarding

On system OpenVMSHOST1, enter the following:

$ SSH-"R"2001:localhost:23 OpenVMSHOST2
On OpenVMSHOST2, enter the following:
$ TELNET localhost 2001 
Result: The login prompt is displayed for OpenVMSHOST1.From an SSH for OpenVMS client to a non-SSH for OpenVMS server:Local port forwardingOn system OpenVMSHOST1, enter the following:
$ SSH -"L"2001:localhost:23 NONVMSHOST 
$ TELNET localhost 2001 
Result: The login prompt is displayed for NONVMSHOST.Remote port forwardingOn system OpenVMSHOST1, enter the following command:
$ SSH -"R"2001:localhost:23 NONVMSHOST

On the system NONVMSHOST, enter the following command:

# TELNET localhost 2001  
Result: The login prompt is displayed for OpenVMSHOST1.

From a non-SSH for OpenVMS client to an SSH for OpenVMS server:

Local port forwarding

On system NONOPENVMS, enter the following commands:

# SSH -L2001:localhost:23 OpenVMSHOST1
# TELNET localhost 2001 
Result: The login prompt is displayed for OpenVMSHOST1.Remote port forwardingOn system NONOPENVMS, enter the following command:
# SSH -R2001:localhost:23 OpenVMShost1
On system OpenVMSHOST1, enter the following command:
$ TELNET localhost 2001
Result: The login prompt is displayed for OpenVMSHOST1.

Port Forwarding for FTP' 

Local and remote port forwarding are specified using the -"L" and -"R" options, as shown in the examples for Standard Port Forwarding. You must also specify the FTP protocol and set the connection to passive mode, when connecting to an OpenVMS FTP server, as shown in the following examples.

From an OpenVMS system to another OpenVMS system:

Local FTP port forwardingOn system OpenVMSHOST1, enter the following commands:

$ SSH -"L" ftp/2001:localhost:23 OpenVMSHOST2       
$ FTP localhost 2001 
ftp> set mode passive
Result: A secure FTP connection is established.

Remote port forwarding

On system OpenVMSHOST1, enter the following command:

$ SSH -"R" ftp/2001:localhost:23 OpenVMSHOST2

On system OpenVMSHOST2, enter the following command:

$ FTP localhost 2001
ftp> set mode passive
Result: The connection is made to OpenVMSHOST1.

From an SSH for OpenVMS client to a non-SSH for OpenVMS server:

Local port forwarding

On system OpenVMSHOST1, enter the following command:

$ SSH -"L" ftp/2001:localhost:23 NONVMSHOST
$ FTP localhost 2001
Result: The connection is made to NONVMSHOST.Remote port forwardingOn system OpenVMSHOST1, enter the following command:

$ SSH -"R" ftp/2001:localhost:23 NONVMSHOST

On system NONVMSHOST, enter the following command:

# ftplocalhost 2001 
ftp> set mode passive
Result: The connection is made to the OPENVMSHOST system.

From a Non-SSH for OpenVMS client to an SSH for OpenVMS server:

Local port forwarding

On system NONVMSHOST, enter the following commands:

# ssh -L ftp/2001:localhost:23 OPENVMSHOST1# ftp localhost 2001
ftp> set mode passive
Result: The connection is made to the OPENVMSHOST system.
Remote port forwardingOn system NONVMSHOST, enter the following command:
# ssh -R ftp/2001:localhost:23 OpenVMShost1

On system OPENVMSHOST1, enter the following command:

$ FTP localhost 2001

Result: The connection is made to the NONVMSHOST system.

X11 Port Forwarding 

SSH for OpenVMS does not support the standard SSH mechanism for implementing X11 port forwarding (using the -x or +x SSH command-line options, or the ForwardX11 keyword in the client configuration file. This section explains how to achieve the same functionality with supported commands.

The following examples use standard SSH port forwarding and a well-known X11 port (6000). The clock program is used in these examples.

Enabling Access to the X11 Server

X11 access to an OpenVMS X11 server requires enabling access to the X11 client. On HP DECwindows Motif for OpenVMS Systems, this can be done through the Style Manager/security option.

  1. Add the appropriate values for node and user name, and the value tcpip as the transport. Details of how to enable access on other platforms may differ.
  2. To direct output to the forwarded X11 server port, enter the following command:
    $ SET DISPLAY/CREATE/NODE=localhost/SERVER=3/TRANSPORT=tcpip 
    The /SERVER qualifier allows you to specify an X11 port other than the default of 6000. The value 3, as specified in this example, maps to port number 6003. For more details about the SET DISPLAY command, see the HP OpenVMS DCL Dictionary.

    To terminate the display, exit the X11 client application, log out of the SSH session, and enter the following command:
    $ SET DISPLAY /DELETE

X11 Port Forwarding Examples 

From an OpenVMS system to an OpenVMS system:

Local port forwardingOn system OpenVMSHOST2, enable access by the X11 client.On system OpenVMSHOST1, enter the following commands:

$ SSH -"L"6003:localhost:6000 OpenVMSHOST2$ MCR DECW$CLOCK
Result: The clock is displayed for the OPENVMSHOST2 system.Remote port forwardingOn system OpenVMSHOST1, enable access by the X11 client and then enter the following command:

$ SSH -"R"6003:localhost:6000 OpenVMSHOST2
On system OpenVMSHOST2, direct output to the forwarded X11 server port and then enter the following command:

$ MCR DECW$CLOCK

Result: The clock is displayed for the OPENVMSHOST1 system.

From an SSH for OpenVMS client to a non-SSH for OpenVMS server:

Local port forwardingOn system NONVMSHOST, enable access by the X11 client.On system VMSHOST1, direct output to the forwarded X11 server port and enter the following commands:

$ SSH -"L"6003:localhost:6000 NONVMSHOST 
$ MCR DECW$CLOCK
Result: The clock is displayed for the NONVMSHOST system.Remote port forwardingOn the OpenVMSHOST1 system, enable access bythe X11 client and enter the following command:

$ SSH -"R"6003:localhost:6000 NONVMSHOST

On system NONVMSHOST, direct output to the forwarded X11 server port and enter the following command:

# xclock &
Result: The clock is displayed for the OPENVMSHOST1 system

From a non-SSH for OpenVMS client to an SSH for OpenVMS server:Local port forwardingOn system OPENVMSHOST1, enable access by the X11 client.

On system NONVMSHOST, enable access to the forwarded X11 server port and enter the following commands:

# ssh -L6003:localhost:6000 OPENVMSHOST1# xclock &
Result: The clock is displayed for the OPENVMSHOST1 system.

Remote port forwarding

On system NONVMSHOST, enable access to the X11 client and enter the following command:

# ssh -R6003:localhost:6000 OPENVMSHOST1
On system OPENVMSHOST1, enable access to the forwarded X11 server port and enter the following command:
$ MCR DECW$CLOCK
Result: The clock is displayed for the NONVMSHOST system.
 
go to next page: SSH Command ReferenceSSH Command Reference