首页 文章

通过VNC的笔记本电脑从防火墙后面隧道到远程服务器? [关闭]

提问于
浏览
-2

我在linux上有一个命令行应用程序,它使用特定的端口与远程服务器通信 . 不幸的是,在工作中,该端口被阻止 .

我可以通过VNC将我的笔记本电脑连接到网络,笔记本电脑在wifi连接上,可以通过端口访问远程服务器 . 连接时,我可以从安全网络ssh到我的笔记本电脑 .

有没有办法使用ssh端口隧道来解决这个问题?我可以将隧道移植到我的笔记本电脑上,让我的笔记本电脑充当防火墙网络和远程服务器之间的中间人吗?

非常感谢 .

1 回答

  • 0

    如果我理解你是正确的,你可以从你到达笔记本电脑的地方打电话给ssh . 然后你应该能够做这样的事情:

    ssh -f -N -L <local port>:<remote server ip or hostname>:<remote server port> <laptop ip or hostname>
    

    这将创建在主机上启动tcp侦听端口,其中ssh始发,通过您运行的计算机转发到远程主机和端口 .

    节选自https://man.openbsd.org/ssh

    -L [bind_address:]port:host:hostport
    -L [bind_address:]port:remote_socket
    -L local_socket:host:hostport
    -L local_socket:remote_socket
    Specifies that connections to the given TCP port or Unix socket on the local
    (client) host are to be forwarded to the given host and port, or Unix
    socket, on the remote side. This works by allocating a socket to listen to
    either a TCP port on the local side, optionally bound to the specified
    bind_address, or to a Unix socket. Whenever a connection is made to the
    local port or socket, the connection is forwarded over the secure channel,
    and a connection is made to either host port hostport, or the Unix socket
    remote_socket, from the remote machine.
    Port forwardings can also be specified in the configuration file. Only the
    superuser can forward privileged ports. IPv6 addresses can be specified by
    enclosing the address in square brackets.
    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.
    
    -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 forwards to be
    successfully established before placing itself in the background.
    
    -N
    Do not execute a remote command. This is useful for just forwarding ports.
    

相关问题