
sshのマニュアルページには次のように記載されています。
-L [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.
-R [bind_address:]port:host:hostport
Specifies that the given port on the remote (server) host is to
be forwarded to the given host and port on the local side.
これら 2 つの説明は混同されていませんか?
これを使用すると、ssh -L
リモート ポートが取得され、ローカル マシンのポートに「バインド」(または転送) されるため、自分自身 (localhost:port) と通信することでリモート マシンと通信できるようになります。
これを使用すると、ssh -R
ローカル ネットワーク上のコンピューターからポートを取得し、それをリモート マシン (ssh サーバー) のポートに「バインド」(または転送) します。その後、サーバー上で、(localhost:port) を使用して接続したコンピューターと同じネットワーク上のコンピューターのポートと通信できます。
これは、ローカルの場合は L、リモートの場合は R (ポートがバインドされている場所) の使用についても説明しています。
(「bind」という言葉を正しく使っているか分かりません。引用符で示そうとしているのはそういうことです)
答え1
「転送」の定義が間違っています。転送されるのはパケットです ( の場合はローカルからリモートへ-L
、 の場合はリモートからローカルへ-R
)。