Bug 1016151 - Provide example command to forward to specific ports in section 8.3.1
Provide example command to forward to specific ports in section 8.3.1
Product: OpenShift Container Platform
Classification: Red Hat
Component: Documentation (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: brice
Depends On:
  Show dependency treegraph
Reported: 2013-10-07 11:35 EDT by dchia
Modified: 2017-03-08 12 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-02-21 00:46:49 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description dchia 2013-10-07 11:35:06 EDT
Description of problem: In the user guide in section 8.3.1 [1] customer would appreciate seeing a technical elaboration on the following statement:

"If you need to forward only specific ports, you need to use the ssh command with the -L option. Refer to the ssh manual page for details."

An example command would be nice.

[1] https://access.redhat.com/site/documentation/en-US/OpenShift_Enterprise/1/html-single/User_Guide/index.html#sect-OpenShift-User_Guide-Port_Forwarding
Comment 4 brice 2014-02-04 19:01:50 EST
Received confirmation via email that the right information has been added from Phil Festoso:

"Hi Brice,

The added example for ssh -L reads clearly and provides the requested information."

Although, information has changed since last updated:

"Specific ports are forwarded with the following command, where the local port and the remote port must be specified, respectively:

$ ssh -L local_port:host:remote_port

Example 9.14. Forwarding Specific Ports

$ ssh -L 8080:localhost:8080

This example allocates a socket to listen to the local port host 8080. When a connection to this port is made, a secure channel forwards the connection to the remote host port 8080."
Comment 6 Miciah Dashiel Butler Masters 2014-02-04 19:44:59 EST
The phrase "remote host" is unclear in the description, and that command will not work without specifying the host to which the ssh connection will be established (it fails immediately as given).  For example, you can use the following:

    $ ssh -L 8080:localhost:8080 70277280b8534c8a9fc76d2734393dfa@app01-namespace.example.com

You're missing what I call the "via_host" argument in the following general form:

    $ ssh -L local_port:dest_host:dest_port via_host

The above command creates a new SSH session, with an SSH process on the local system and another SSH process on the remote system "via_host," which will do the following:

• The local SSH process will open local_port on the local host and listen for connections to that port.

• At the same time, the local SSH process will open an SSH connection to via_host (which is what causes the remote system "via_host" to start the remote SSH process).

• Whenever the local SSH process receives a connection to local_port, it will forward the connection to the remote SSH process running on "via_host."

• When the remote SSH process on via_host receives one of these connections from the local SSH process, the remote SSH process on via_host will open a connection to dest_port on dest_host and forward packets to and from dest_port.

So packets go localhost:local_port <-> via_host <-> dest_host:dest_port.

Note that in the general form, there are three hosts involved: The local host, the destination host, and the intermediate host ("via_host") through which connections will be routed.  For our purposes, dest_host and via_host are the same physical host (because we specify localhost for the dest_host, so via_host is connecting to itself; the point of reference for "dest_host" is "via_host").  However, SSH requires that it be specified.

Does that make sense?
Comment 7 brice 2014-02-04 20:49:03 EST
Added Miciah's information from above. Section now reads:

"Specific ports are forwarded with the following command. Specify the local port and remote port as required, as well as the gear ID, and application and domain name of the remote port:

$ ssh -L local_port:host:remote_port gear_ID@app-domain.example.com

Example 9.14. Forwarding Specific Ports

$ ssh -L 8080:localhost:8080 70277280b8534c8a9fc76d2734393dfa@racer-automobiles.example.com"

Should work now!

Note You need to log in before you can comment on or make changes to this bug.