The problem that I have is trying to understand the use of port forwarding with the ssh command as shown below. The confusion is based on the use of localhost where my machine is localhost but it appears that it may be referencing the remote server. Because of this it is unclear as to what is going on and so I am looking for information and or links to documents that can clarify what is occurring within the ssh command below.
ssh -f myUserID@someip -L [bind_address:]port:host:hostport
- The details for the above taken from a manual: Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.
With regards to the ssh command, I'm told the left side is considered the local (client).
So with a syntax of the following
ssh -f myUserID@someip -L 1234:localhost:9200
where the left side does not contain an IP is localhost assumed to then be at at port 1234?
And I have no idea how to interpret the 2nd half of localhost:9200?
How should I be interpreting the above ssh command?
[ bind_address:]port:host:hostport Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and a connection is made to host port hostport from the remote machine. Port forwardings can also be specified in the configuration file. IPv6 addresses can be specified with an alternative syntax: [bind_address/]port/host/hostport or by enclosing the address in square brackets. Only the superuser can forward privileged ports. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of ''localhost'' indicates that the listening port be bound for local use only, while an empty address or '*' indicates that the port should be available from all interfaces.
I need clarity on the format I'm posting. Because the way the definition reads and the way the command is that I'm posting it sounds like I'm port forwarding a localhost 1234 to the localhost 9200, which makes zero sense as to how it is allowing me to communicate to the remote server.