ssh tunnel

1.) ssh -Nf -L 10000:target_server:80 ssh_server

 

 -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.  This
             works by allocating a socket to listen to port on the local side,
             optionally bound to the specified bind_address.  Whenever a con‐
             nection 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 spec‐
             ified 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.  How‐
             ever, 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.

登录ssh_server并由其将从客户端端口10000来的数据,转发到 target_server:80.-Nf是为了让ssh tunnel挂到后台执行.

 -N      Do not execute a remote command.  This is useful for just for‐
             warding ports (protocol version 2 only).

 

 -f      Requests ssh to go to background just before command execution.
             This is useful if ssh is going to ask for passwords or
             passphrases, but the user wants it in the background.  This
             implies -n.  The recommended way to start X11 programs at a
             remote site is with something like ssh -f host xterm.

             If the ExitOnForwardFailure configuration option is set to “yes”,
             then a client started with -f will wait for all remote port for‐
             wards to be successfully established before placing itself in the
             background.

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: SSH Tunnel 是一种网络隧道技术,可以通过安全的 SSH 连接来转发数据。它可以用来将本地网络连接到远程网络,或者将远程网络连接到本地网络。这种技术常用于远程访问内部网络中的资源,或者将本地网络中的资源暴露给远程网络。 ### 回答2: SSH隧道是一种通过SSH协议建立的加密通信隧道,用于安全地传输数据。它通过将数据包封装在SSH连接中进行传输,使得传输的数据在网络中被加密,从而保护数据的安全性。 SSH隧道的工作原理是将源主机和目标主机之间的通信数据包封装在SSH连接中,然后通过SSH连接进行传输。在建立SSH隧道时,需要指定一个本地端口和一个远程端口。源主机将本地端口的数据包封装在SSH连接中发送到目标主机的远程端口,然后目标主机将接收到的数据包解封并将其传递给目标主机上的本地端口。 通过SSH隧道,可以实现多种用途。一种常见的用途是加密和保护远程访问,例如通过SSH隧道远程登录到另一台计算机,并在加密的通道上执行命令和传输文件。另一种用途是绕过防火墙和过滤器,通过SSH隧道将数据转发到目标主机上的本地端口,可以实现对被阻止访问的网站、服务或应用程序的访问。 总而言之,SSH隧道提供了一个安全的通信通道,通过对数据进行加密,保护了数据的安全性和完整性。它可以用于实现远程访问和数据转发等功能,为网络通信提供了更高的保障。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值