gpt4 book ai didi

通过堡垒机的 SSH 隧道和端口转发会导致连接被拒绝错误

转载 作者:行者123 更新时间:2023-12-05 03:49:52 24 4
gpt4 key购买 nike

我在服务器机器上运行了 jupyter notebook,我可以通过 bastion 机器 ssh 进入。我想访问本地计算机上的笔记本。

enter image description here

这是我在服务器机器上运行 jupyter 后的尝试:

ssh -f -N -L local_machine_port:server_machine_IP:server_machine_port_hosting_jupyter username@bastion_machine_ip

每当我尝试访问 http://localhost:local_machine_porthttp://127.0.0.1:local_machine_port我得到

debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Connection to port 7001 forwarding to <server ip> port <server port> requested.
debug1: channel 2: new [direct-tcpip]
debug1: Connection to port 7001 forwarding to <server ip> port <server port> requested.
debug1: channel 3: new [direct-tcpip]
channel 2: open failed: connect failed: Connection refused
debug1: channel 2: free: direct-tcpip: listening port 7001 for <server ip> port <server port>, connect from 127.0.0.1 port 43276 to 127.0.0.1 port 7001, nchannels 4
channel 3: open failed: connect failed: Connection refused
debug1: channel 3: free: direct-tcpip: listening port 7001 for <server ip> port <server port>, connect from 127.0.0.1 port 43278 to 127.0.0.1 port 7001, nchannels 3
debug1: Connection to port 7001 forwarding to 192.168.2.38 port 6006 requested.
debug1: channel 2: new [direct-tcpip]
channel 2: open failed: connect failed: Connection refused
debug1: channel 2: free: direct-tcpip: listening port 7001 for <server ip> port <server port>, connect from 127.0.0.1 port 43280 to 127.0.0.1 port 7001, nchannels 3

我该怎么办?

最佳答案

尝试在 jupyter notebook 命令中添加 --ip 0.0.0.0 选项

您可以按照下面列出的步骤操作:

 1. Run ssh on local machine:
ssh -L local_machine_port:server_machine_IP:server_machine_port_hosting_jupyter username@bastion_machine_ip
2. Run jupyter notebook on remote server:
jupyter notebook --ip 0.0.0.0 --port server_machine_port_hosting_jupyter
3. Open browser on localmachine:
http://localhost:local_machine_port

关于通过堡垒机的 SSH 隧道和端口转发会导致连接被拒绝错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63717748/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com