Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
JiangkaaiShenng
V2EX  ›  Linux

如何在 22 端口同时实现 SSH 和 Socks 功能

  •  1
     
  •   JiangkaaiShenng · Sep 1, 2023 · 3297 views
    This topic created in 1160 days ago, the information mentioned may be changed or developed.

    目前买了个境内 NAT 主机玩玩,优势是出口动态家宽,但只有一个端口对外开放(SSH),想在 22 端口上在加一个 socks5 服务,只做完全合法合规用途(挂机),有无简单易用的方案(CentOS7); 目前已知 sslh 好像可以实现,但实验了好几次都不能成功; 备选方案:端口转发;GPT 的方案:sslh /etc/sslh/sslh.cfg;

    RUN=yes
    LISTEN=0.0.0.0:22
    SSH_HOST=localhost
    SSH_PORT=22
    SOCKS_HOST=localhost
    SOCKS_PORT=1080
    
    10 replies  •  2023-09-01 23:18:15 +08:00
    proxytoworld
    proxytoworld
    Sep 1, 2023
    1
    ssh -CfNg -R localip:port:remoteip:port user@ip
    dode
    dode
    Sep 1, 2023
    2
    你用 xshell ,连接上服务器后,
    设置-隧道,添加添加传入或者传出端口,或者添加 Socks 代理端口,供本地局域网使用
    yaott2020
    yaott2020
    Sep 1, 2023 via Android
    3
    自己写一个,先判别协议类型然后决定该怎么转发
    herowu
    herowu
    Sep 1, 2023
    4
    可以用 Xshell 添加 ssh 隧道 SOCKS 代理的方式实现,详细步骤参看老耿博客 https://www.cnblogs.com/lgeng/p/10979587.html
    githmb
    githmb
    Sep 1, 2023
    5
    通过探测请求数据实现端口复用:

    https://github.com/rust-net/remote-bind/tree/tokio/oneport
    wonderblank
    wonderblank
    Sep 1, 2023
    6
    haproxy
    yazinnnn
    yazinnnn
    Sep 1, 2023
    7
    你本地挂机的话直接 ssh -fND 把 socks 服务建立在你电脑上不好吗
    JiangkaaiShenng
    JiangkaaiShenng
    OP
    Sep 1, 2023
    8
    @proxytoworld 非常感谢您,但是我不确定 ssh 隧道客户端作为前置代理的长时间稳定性,总觉得会掉线
    zbinlin
    zbinlin
    Sep 1, 2023
    9
    @JiangkaaiShenng 可以使用 systemd 来保障断了重新启动。
    NewYear
    NewYear
    Sep 1, 2023
    10
    好奇,哪里买的 NAT ,能推荐一下吗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2921 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 11:32 · PVG 19:32 · LAX 03:32 · JFK 06:32
    ♥ Do have faith in what you're doing.