目 录CONTENT

文章目录
frp

frp配置与使用——tcpmux模式端口复用

过客
2025-10-02 / 0 评论 / 0 点赞 / 3 阅读 / 0 字

frp 支持将单个端口收到的连接路由到不同的代理,类似 vhostHTTPPortvhostHTTPSPort。目前支持的复用器只有 httpconnect。当在 frps.toml 中设置 tcpmuxHTTPConnectPort,frps 将会监听在这个端口,接收 HTTP CONNECT 请求。frps 会根据 HTTP CONNECT 请求中的 host 路由到不同的后端代理。

一、服务端配置

frps.toml 中需要添加tcpmuxHTTPConnectPort配置。假设公网服务器域名为1.2.3.4

# 服务器端口
bindPort = 7000

# tcp复用器端口
tcpmuxHTTPConnectPort = 5022

# http端口
vhostHTTPPort = 80
vhostHTTPSPort = 445

# 权限认证
auth.method = "token"
auth.token = "123456"

# 其他配置

二、SSH客户端实现多端口复用

1. 在内网机器A上配置

a.zengwu.com.cn解析到IP1.2.3.4

# 服务器域名端口
serverAddr = "1.2.3.4"
serverPort = 7000

# A内网服务器SSH配置
[[proxies]]
name = "ssha"
type = "tcpmux"
multiplexer = "httpconnect"
customDomains = ["a.zengwu.com.cn"]
localIP = "127.0.0.1"
localPort = 22

2. 在内网机器B上配置

b.zengwu.com.cn解析到IP1.2.3.4

# 服务器域名端口
serverAddr = "1.2.3.4"
serverPort = 7000

# A内网服务器SSH配置
[[proxies]]
name = "ssha"
type = "tcpmux"
multiplexer = "httpconnect"
customDomains = ["b.zengwu.com.cn"]
localIP = "127.0.0.1"
localPort = 22

3、在需要连接的客户端机上配置

3.1. 在命令行中使用ssh客户端连接

在要连接的客户端机器上,需要使用HTTP Connect 代理连接,这里可以使用socat来实现。

  • Linux
# Ubuntu/Debian
apt-get install socat

# CentOS/RHEL
yum install socat
  • macOS
brew install socat
  • Windows

可以通过Cygwin来安装.

  • 使用ssh客户端连接
# 连接A机器
ssh -o "proxycommand=socat - PROXY:1.2.3.4:%h:%p,proxyport=5022" root@a.zengwu.com.cn

# 连接B机器
ssh -o "proxycommand=socat - PROXY:1.2.3.4:%h:%p,proxyport=5022" root@b.zengwu.com.cn

3.2. 使用XShell客户端中连接

  • 设置链接信息

主机设置为a.zengwu.com.cn,端口为22

  • 添加代理

代理设置为HTTP,主机填写公网服务器的IP1.2.3.4,端口为7001,用户密码为空

三、RDP远程桌面实现多端口复用

1. 在内网机器win11上配置

win11.zengwu.com.cn解析到IP1.2.3.4

# 服务器域名端口
serverAddr = "1.2.3.4"
serverPort = 7000

# win11远程连接
[[proxies]]
name = "win11"
type = "tcpmux"
multiplexer = "httpconnect"
customDomains = ["win11.zengwu.com.cn"]
localIP = "127.0.0.1"
localPort = 3389

2. 在需要连接的客户端机上配置

2.1. 在windown系统中

windowns自带的mstsc远程连接软件是不支持代理的,不过我们可以用 SocksCap,虽然官方已经停止维护更新了,但可以从第三方下载,如: https://cikeblog.com/e/SocksCap64-Portable-4.7.7z。下载后解压到目录,然后直接双击SocksCap64_RunAsAdmin.exe运行.

  • 添加HTTP代理 CONNECT 方法

  • 添加mstsc程序

  • 在SocksCap64中启动mstsc使用远程连接。
    地址使用win11.zengwu.com.cn端口使用默认的3389就可以了。
    如果第一次连接不上,多点几次练级就好了

2.2. 在mac系统中

在mac中,也有类似于SocksCap的应用Proxifier(试过parallels client的http代理,结果连接不上,最后还是用了Proxifier),可以去Proxifier官网去下载mac版本,可以免费试用一个月,其他的可以自己琢磨。

  • 添加HTTP代理 CONNECT 方法

  • 添加Microsoft Remote Desktop

  • 直接启动Microsoft Remote Desktop
    地址使用win11.zengwu.com.cn端口使用默认的3389就可以了。

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区