[GH-ISSUE #536] 请问frp能否转发smb协议,实现内网文件共享。 #415

Closed
opened 2026-05-05 12:14:12 -06:00 by gitea-mirror · 19 comments
Owner

Originally created by @beijiaoff on GitHub (Nov 26, 2017).
Original GitHub issue: https://github.com/fatedier/frp/issues/536

RT,尝试了修改frpc.ini添加下面的内容。没有生效。是我搞错了还是暂时不具备这个功能?
[smb-udp137]
type = udp
local_ip = 127.0.0.1
local_port = 137
remote_port = 137

[smb-tcp139]
type = udp
local_ip = 127.0.0.1
local_port = 139
remote_port = 139

[smb-tcp445]
type = udp
local_ip = 127.0.0.1
local_port = 445
remote_port = 445

[smb-udp138]
type = udp
local_ip = 127.0.0.1
local_port = 138
remote_port = 138

Originally created by @beijiaoff on GitHub (Nov 26, 2017). Original GitHub issue: https://github.com/fatedier/frp/issues/536 RT,尝试了修改frpc.ini添加下面的内容。没有生效。是我搞错了还是暂时不具备这个功能? [smb-udp137] type = udp local_ip = 127.0.0.1 local_port = 137 remote_port = 137 [smb-tcp139] type = udp local_ip = 127.0.0.1 local_port = 139 remote_port = 139 [smb-tcp445] type = udp local_ip = 127.0.0.1 local_port = 445 remote_port = 445 [smb-udp138] type = udp local_ip = 127.0.0.1 local_port = 138 remote_port = 138
Author
Owner

@lihuimail commented on GitHub (Dec 2, 2017):

type写错了

<!-- gh-comment-id:348706838 --> @lihuimail commented on GitHub (Dec 2, 2017): type写错了
Author
Owner

@beijiaoff commented on GitHub (Dec 5, 2017):

type那里是笔误,实际改了也无效的。

<!-- gh-comment-id:349178423 --> @beijiaoff commented on GitHub (Dec 5, 2017): type那里是笔误,实际改了也无效的。
Author
Owner

@openmynet commented on GitHub (Dec 6, 2017):

这个工具可能是你需要的udp2raw-tunnel ,不过我没测试。我目前使用的方案是 homeNas[SoftEtherServer] -> SoftEtherClient -> frpc ->frps ->frpc ->SoftEtherClient-> workspace pc

<!-- gh-comment-id:349664927 --> @openmynet commented on GitHub (Dec 6, 2017): 这个工具可能是你需要的[udp2raw-tunnel](https://github.com/wangyu-/udp2raw-tunnel/blob/master/doc/README.zh-cn.md) ,不过我没测试。我目前使用的方案是 homeNas[SoftEtherServer] -> SoftEtherClient -> frpc ->frps ->frpc ->SoftEtherClient-> workspace pc
Author
Owner

@genkagen commented on GitHub (Dec 6, 2017):

我的方案是client -> frps -> frpc -> sftp -> HomeNas

<!-- gh-comment-id:349674710 --> @genkagen commented on GitHub (Dec 6, 2017): 我的方案是client -> frps -> frpc -> sftp -> HomeNas
Author
Owner

@beijiaoff commented on GitHub (Dec 7, 2017):

谢谢各位回复。我再尝试一下

<!-- gh-comment-id:349845189 --> @beijiaoff commented on GitHub (Dec 7, 2017): 谢谢各位回复。我再尝试一下
Author
Owner

@cercky commented on GitHub (Dec 8, 2017):

我的方案更加暴力,openvpn client

<!-- gh-comment-id:350151392 --> @cercky commented on GitHub (Dec 8, 2017): 我的方案更加暴力,openvpn client
Author
Owner

@fcying commented on GitHub (Dec 16, 2017):

sftp win下用起来不方便. 还是能转发samba比较好

<!-- gh-comment-id:352164752 --> @fcying commented on GitHub (Dec 16, 2017): sftp win下用起来不方便. 还是能转发samba比较好
Author
Owner

@whitegerry commented on GitHub (Dec 23, 2017):

用下来win和debian都没问题, 不过是type是tcp

[smb-win]
type = tcp
local_ip = 192.168.1.100
local_port = 445
remote_port = 44501

[smb-debian]
type = tcp
local_ip = 192.168.1.200
local_port = 445
remote_port = 44502

<!-- gh-comment-id:353711379 --> @whitegerry commented on GitHub (Dec 23, 2017): 用下来win和debian都没问题, 不过是type是tcp [smb-win] type = tcp local_ip = 192.168.1.100 local_port = 445 remote_port = 44501 [smb-debian] type = tcp local_ip = 192.168.1.200 local_port = 445 remote_port = 44502
Author
Owner

@chuxubank commented on GitHub (Sep 11, 2018):

遇到了同样的问题 @whitegerry 的方法配置无法连接。

<!-- gh-comment-id:420257455 --> @chuxubank commented on GitHub (Sep 11, 2018): 遇到了同样的问题 @whitegerry 的方法配置无法连接。
Author
Owner

@whitegerry commented on GitHub (Sep 12, 2018):

遇到了同样的问题 @whitegerry 的方法配置无法连接。

我刚又测试了一遍,没问题的

[smb-debian]
type = tcp
local_ip = 192.168.100.200
local_port = 445
remote_port = 44502

frps.log:
2018/09/12 11:14:55 [I] [smb-debian] tcp proxy listen port [44502]
2018/09/12 11:16:07 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]
2018/09/12 11:18:10 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]

<!-- gh-comment-id:420499979 --> @whitegerry commented on GitHub (Sep 12, 2018): > 遇到了同样的问题 @whitegerry 的方法配置无法连接。 我刚又测试了一遍,没问题的 [smb-debian] type = tcp local_ip = 192.168.100.200 local_port = 445 remote_port = 44502 frps.log: `2018/09/12 11:14:55 [I] [smb-debian] tcp proxy listen port [44502]` `2018/09/12 11:16:07 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]` `2018/09/12 11:18:10 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]`
Author
Owner

@chuxubank commented on GitHub (Sep 12, 2018):

遇到了同样的问题 @whitegerry 的方法配置无法连接。

我刚又测试了一遍,没问题的

https://i.imgur.com/EoLRagn.jpg

[smb-debian]
type = tcp
local_ip = 192.168.100.200
local_port = 445
remote_port = 44502

frps.log:
2018/09/12 11:14:55 [I] [smb-debian] tcp proxy listen port [44502]
2018/09/12 11:16:07 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]
2018/09/12 11:18:10 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]

谢谢,应该是我路由器smb协议或者防火墙的问题,我在Windows上部署的frpc 445端口就可以直接穿透了。

<!-- gh-comment-id:420501320 --> @chuxubank commented on GitHub (Sep 12, 2018): > > 遇到了同样的问题 @whitegerry 的方法配置无法连接。 > > 我刚又测试了一遍,没问题的 > > ![https://i.imgur.com/EoLRagn.jpg](https://camo.githubusercontent.com/57f111dfb79067332a71b3903095d58f26a933c1/68747470733a2f2f692e696d6775722e636f6d2f456f4c5261676e2e6a7067) > > [smb-debian] > type = tcp > local_ip = 192.168.100.200 > local_port = 445 > remote_port = 44502 > > frps.log: > `2018/09/12 11:14:55 [I] [smb-debian] tcp proxy listen port [44502]` > `2018/09/12 11:16:07 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]` > `2018/09/12 11:18:10 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]` 谢谢,应该是我路由器smb协议或者防火墙的问题,我在Windows上部署的frpc 445端口就可以直接穿透了。
Author
Owner

@15klli commented on GitHub (Mar 25, 2019):

@chuxubank 请问能否提供一下您的frpc.ini 呢?方便说一下您的windows系统吗?

<!-- gh-comment-id:476043874 --> @15klli commented on GitHub (Mar 25, 2019): @chuxubank 请问能否提供一下您的frpc.ini 呢?方便说一下您的windows系统吗?
Author
Owner

@chuxubank commented on GitHub (Mar 25, 2019):

@chuxubank 请问能否提供一下您的frpc.ini 呢?方便说一下您的windows系统吗?

已经很久没有使用了... 配置文件找不到了... 但是高赞回复应该差不多。 系统是Win10

<!-- gh-comment-id:476413954 --> @chuxubank commented on GitHub (Mar 25, 2019): > @chuxubank 请问能否提供一下您的frpc.ini 呢?方便说一下您的windows系统吗? 已经很久没有使用了... 配置文件找不到了... 但是高赞回复应该差不多。 系统是Win10
Author
Owner

@hxxful commented on GitHub (May 18, 2019):

frpc配置tcp 445转445不行,配置成445转44501倒是可以,但win下访问samba又不能指定端口,我卡在这儿了

<!-- gh-comment-id:493709858 --> @hxxful commented on GitHub (May 18, 2019): frpc配置tcp 445转445不行,配置成445转44501倒是可以,但win下访问samba又不能指定端口,我卡在这儿了
Author
Owner

@SCGabriel commented on GitHub (Jun 29, 2019):

RT,尝试了修改frpc.ini添加下面的内容。没有生效。是我搞错了还是暂时不具备这个功能?
[smb-udp137]
type = udp
local_ip = 127.0.0.1
local_port = 137
remote_port = 137

[smb-tcp139]
type = udp
local_ip = 127.0.0.1
local_port = 139
remote_port = 139

[smb-tcp445]
type = udp
local_ip = 127.0.0.1
local_port = 445
remote_port = 445

[smb-udp138]
type = udp
local_ip = 127.0.0.1
local_port = 138
remote_port = 138

linux上绑定低于1024的端口需要特权,因为如果你要把445端口的samba印射到另一台机器的445端口,frps需要以root账户运行
或者执行以下命令
sudo setcap cap_net_bind_service=ep /usr/local/frp/frps
(/usr/local/frp/frps 替换成你的frps二进制文件所在位置)
给frps二进制加特权,使得可以绑定低于1024端口

by 某个遇到同样问题,被大佬点通的人喵

<!-- gh-comment-id:506939820 --> @SCGabriel commented on GitHub (Jun 29, 2019): > RT,尝试了修改frpc.ini添加下面的内容。没有生效。是我搞错了还是暂时不具备这个功能? > [smb-udp137] > type = udp > local_ip = 127.0.0.1 > local_port = 137 > remote_port = 137 > > [smb-tcp139] > type = udp > local_ip = 127.0.0.1 > local_port = 139 > remote_port = 139 > > [smb-tcp445] > type = udp > local_ip = 127.0.0.1 > local_port = 445 > remote_port = 445 > > [smb-udp138] > type = udp > local_ip = 127.0.0.1 > local_port = 138 > remote_port = 138 linux上绑定低于1024的端口需要特权,因为如果你要把445端口的samba印射到另一台机器的445端口,frps需要以root账户运行 或者执行以下命令 sudo setcap cap_net_bind_service=ep /usr/local/frp/frps (/usr/local/frp/frps 替换成你的frps二进制文件所在位置) 给frps二进制加特权,使得可以绑定低于1024端口 by 某个遇到同样问题,被大佬点通的人喵
Author
Owner

@nie11kun commented on GitHub (Mar 13, 2022):

遇到了同样的问题 @whitegerry 的方法配置无法连接。

我刚又测试了一遍,没问题的
https://i.imgur.com/EoLRagn.jpg
[smb-debian]
type = tcp
local_ip = 192.168.100.200
local_port = 445
remote_port = 44502
frps.log:
2018/09/12 11:14:55 [I] [smb-debian] tcp proxy listen port [44502]
2018/09/12 11:16:07 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]
2018/09/12 11:18:10 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]

谢谢,应该是我路由器smb协议或者防火墙的问题,我在Windows上部署的frpc 445端口就可以直接穿透了。

请问下如何配置域名方式访问 smb 呢,我用的 cf 和 nginx

<!-- gh-comment-id:1066019336 --> @nie11kun commented on GitHub (Mar 13, 2022): > > > 遇到了同样的问题 @whitegerry 的方法配置无法连接。 > > > > > > 我刚又测试了一遍,没问题的 > > ![https://i.imgur.com/EoLRagn.jpg](https://camo.githubusercontent.com/57f111dfb79067332a71b3903095d58f26a933c1/68747470733a2f2f692e696d6775722e636f6d2f456f4c5261676e2e6a7067) > > [smb-debian] > > type = tcp > > local_ip = 192.168.100.200 > > local_port = 445 > > remote_port = 44502 > > frps.log: > > `2018/09/12 11:14:55 [I] [smb-debian] tcp proxy listen port [44502]` > > `2018/09/12 11:16:07 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]` > > `2018/09/12 11:18:10 [I] [smb-debian] get a new work connection: [125.125.125.125:8847]` > > 谢谢,应该是我路由器smb协议或者防火墙的问题,我在Windows上部署的frpc 445端口就可以直接穿透了。 请问下如何配置域名方式访问 smb 呢,我用的 cf 和 nginx
Author
Owner

@yjd commented on GitHub (Jul 13, 2022):

frpc配置tcp 445转445不行,配置成445转44501倒是可以,但win下访问samba又不能指定端口,我卡在这儿了

可以在本地电脑再转发一下,不过有点小瑕疵,本地共享服务要先停掉,不然445端口已经被占用。

cmd执行:
netsh interface portproxy add v4tov4 listenaddress=本地ip listenport=445 connectaddress=服务器ip connectport=44501

win访问smb:
\\本地ip

<!-- gh-comment-id:1183013919 --> @yjd commented on GitHub (Jul 13, 2022): > frpc配置tcp 445转445不行,配置成445转44501倒是可以,但win下访问samba又不能指定端口,我卡在这儿了 可以在本地电脑再转发一下,不过有点小瑕疵,本地共享服务要先停掉,不然445端口已经被占用。 cmd执行: netsh interface portproxy add v4tov4 listenaddress=本地ip listenport=445 connectaddress=服务器ip connectport=44501 win访问smb: \\\本地ip
Author
Owner

@1500256797 commented on GitHub (Mar 13, 2023):

telnet 101.43.118.68 44502 也没问题
我按照映射,445--》44502,然后在公网上也开通了端口。

我在我的另一台windows11上进行访问,提示无法连接。
image

报错
image

<!-- gh-comment-id:1465589470 --> @1500256797 commented on GitHub (Mar 13, 2023): telnet 101.43.118.68 44502 也没问题 我按照映射,445--》44502,然后在公网上也开通了端口。 我在我的另一台windows11上进行访问,提示无法连接。 ![image](https://user-images.githubusercontent.com/15167050/224625451-1d4a389b-8d8d-47f5-b948-371a4532a511.png) 报错 ![image](https://user-images.githubusercontent.com/15167050/224625582-2e2e2181-0ac7-49ea-8324-0f59f9e44844.png)
Author
Owner

@lhuanyun commented on GitHub (May 25, 2025):

telnet 101.43.118.68 44502 也没问题

我按照映射,445--》44502,然后在公网上也开通了端口。

我在我的另一台windows11上进行访问,提示无法连接。

image

报错

image

印象中,win里面samba加端口也不生效。

<!-- gh-comment-id:2907970596 --> @lhuanyun commented on GitHub (May 25, 2025): > telnet 101.43.118.68 44502 也没问题 > > 我按照映射,445--》44502,然后在公网上也开通了端口。 > > > > 我在我的另一台windows11上进行访问,提示无法连接。 > > ![image](https://user-images.githubusercontent.com/15167050/224625451-1d4a389b-8d8d-47f5-b948-371a4532a511.png) > > > > 报错 > > ![image](https://user-images.githubusercontent.com/15167050/224625582-2e2e2181-0ac7-49ea-8324-0f59f9e44844.png) > > > > 印象中,win里面samba加端口也不生效。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#415
No description provided.