[GH-ISSUE #4503] [Feature Request] 有偿解决frp+Synology Drive 显示真实ip的问题。 #3557

Closed
opened 2026-05-05 14:17:04 -06:00 by gitea-mirror · 21 comments
Owner

Originally created by @wuai1024 on GitHub (Oct 21, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4503

Describe the feature request

我在使用frp内网穿透synology drive 后,显示的一直都是frpc的内网ip地址。
image

我希望这里能显示到正确的ip.

ps. synology drive是使用的tcp协议,不能使用http中的 X-Forwarded-For 来获取真实ip。

通过群辉自家的 QuickConnent 能显示客户端的真实ip,我不明白其中是如何实现的。

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @wuai1024 on GitHub (Oct 21, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/4503 ### Describe the feature request 我在使用frp内网穿透synology drive 后,显示的一直都是frpc的内网ip地址。 ![image](https://github.com/user-attachments/assets/61f7d474-c76f-4ae5-a254-97f8f2c8f5c6) 我希望这里能显示到正确的ip. ps. synology drive是使用的tcp协议,不能使用http中的 X-Forwarded-For 来获取真实ip。 通过群辉自家的 QuickConnent 能显示客户端的真实ip,我不明白其中是如何实现的。 ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [X] Others
gitea-mirror 2026-05-05 14:17:04 -06:00
Author
Owner

@JsonSong89 commented on GitHub (Oct 21, 2024):

群辉自己有个ddns服务吧 比如客户端访问http://ifconfig.me/
获取自己的公网ip,然后通过某个接口上报给服务端
frp想加这个功能也挺简单,就两个http请求的事情 自己改改代码都行

<!-- gh-comment-id:2425774930 --> @JsonSong89 commented on GitHub (Oct 21, 2024): 群辉自己有个ddns服务吧 比如客户端访问http://ifconfig.me/ 获取自己的公网ip,然后通过某个接口上报给服务端 frp想加这个功能也挺简单,就两个http请求的事情 自己改改代码都行
Author
Owner

@wuai1024 commented on GitHub (Oct 21, 2024):

群辉自己有个ddns服务吧 比如客户端访问http://ifconfig.me/ 获取自己的公网ip,然后通过某个接口上报给服务端 frp想加这个功能也挺简单,就两个http请求的事情 自己改改代码都行

不是一个东西,下去先沉淀沉淀吧。

<!-- gh-comment-id:2426193545 --> @wuai1024 commented on GitHub (Oct 21, 2024): > 群辉自己有个ddns服务吧 比如客户端访问http://ifconfig.me/ 获取自己的公网ip,然后通过某个接口上报给服务端 frp想加这个功能也挺简单,就两个http请求的事情 自己改改代码都行 不是一个东西,下去先沉淀沉淀吧。
Author
Owner

@huangluyu commented on GitHub (Oct 22, 2024):

这里显示正确的 ip 是为了什么?如果是为了分享文件时链接使用 frp server 的公网 IP,那么群晖的设置中可以直接设置这个 ip

<!-- gh-comment-id:2428020400 --> @huangluyu commented on GitHub (Oct 22, 2024): 这里显示正确的 ip 是为了什么?如果是为了分享文件时链接使用 frp server 的公网 IP,那么群晖的设置中可以直接设置这个 ip
Author
Owner

@wuai1024 commented on GitHub (Oct 22, 2024):

主要是为了安全和 ACL控制,这个服务和ssh是一样的,都是tcp协议的,但是没有直接支持 Proxy Protocol 协议。需要其他方式处理下。

我的ssh服务也不能开启公网访问,因为一直显示的是我 frpc 的内网ip,所以做不了安全控制。

这2个服务是一个逻辑,如果能处理好其中一个,另外一个就同理可得了。

<!-- gh-comment-id:2428040905 --> @wuai1024 commented on GitHub (Oct 22, 2024): 主要是为了安全和 ACL控制,这个服务和ssh是一样的,都是tcp协议的,但是没有直接支持 Proxy Protocol 协议。需要其他方式处理下。 我的ssh服务也不能开启公网访问,因为一直显示的是我 frpc 的内网ip,所以做不了安全控制。 这2个服务是一个逻辑,如果能处理好其中一个,另外一个就同理可得了。
Author
Owner

@wuai1024 commented on GitHub (Oct 22, 2024):

就例如这样的拓扑:
image

<!-- gh-comment-id:2428072998 --> @wuai1024 commented on GitHub (Oct 22, 2024): 就例如这样的拓扑: ![image](https://github.com/user-attachments/assets/13691f0b-168b-40ae-8d9f-5b93b61da75a)
Author
Owner

@JustinTangChina commented on GitHub (Oct 22, 2024):

就例如这样的拓扑: image

你的Synology drive这个群辉干嘛不直接连到frp服务端上面,按照你的描述你是通过192.168.1.24中转后再link到drive的,显示ip地址192.168.1.24这是很正常的,无论你外网的什么地址访问 都是通过 192.168.1.24这个frp客户端建立的中转去访问的

所以如果你想显示真实ip 应该是192.168.1.26连接到frp服务端

<!-- gh-comment-id:2428407792 --> @JustinTangChina commented on GitHub (Oct 22, 2024): > 就例如这样的拓扑: ![image](https://private-user-images.githubusercontent.com/13379708/378654916-13691f0b-168b-40ae-8d9f-5b93b61da75a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjk1Nzk4NDAsIm5iZiI6MTcyOTU3OTU0MCwicGF0aCI6Ii8xMzM3OTcwOC8zNzg2NTQ5MTYtMTM2OTFmMGItMTY4Yi00MGFlLThkOWYtNWI5M2I2MWRhNzVhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEwMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMDIyVDA2NDU0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ3MTAwYzQ1MDBlZjZmMmIzYjdkMGY4YTMyZDRjYmIxMjUxZTY5M2QxM2YyN2Q4NWZhYzE3MTg4MTZlNmI2Y2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.URk8sTsHegfJ8oCyJkMI8-Ad640t2omluZ_kuLgz3Ao) 你的Synology drive这个群辉干嘛不直接连到frp服务端上面,按照你的描述你是通过192.168.1.24中转后再link到drive的,显示ip地址192.168.1.24这是很正常的,无论你外网的什么地址访问 都是通过 192.168.1.24这个frp客户端建立的中转去访问的 所以如果你想显示真实ip 应该是192.168.1.26连接到frp服务端
Author
Owner

@wuai1024 commented on GitHub (Oct 22, 2024):

你的Synology drive这个群辉干嘛不直接连到frp服务端上面,按照你的描述你是通过192.168.1.24中转后再link到drive的,显示ip地址192.168.1.24这是很正常的,无论你外网的什么地址访问 都是通过 192.168.1.24这个frp客户端建立的中转去访问的

所以如果你想显示真实ip 应该是192.168.1.26连接到frp服务端

这样的效果是一样的,会显示 192.168.1.26 的地址。

<!-- gh-comment-id:2428418532 --> @wuai1024 commented on GitHub (Oct 22, 2024): > 你的Synology drive这个群辉干嘛不直接连到frp服务端上面,按照你的描述你是通过192.168.1.24中转后再link到drive的,显示ip地址192.168.1.24这是很正常的,无论你外网的什么地址访问 都是通过 192.168.1.24这个frp客户端建立的中转去访问的 > > 所以如果你想显示真实ip 应该是192.168.1.26连接到frp服务端 这样的效果是一样的,会显示 192.168.1.26 的地址。
Author
Owner

@wuai1024 commented on GitHub (Oct 22, 2024):

@fatedier 大佬,有什么办法没,给指导指导。

这个可能需要 linux 内核态的支持吧。

<!-- gh-comment-id:2428427214 --> @wuai1024 commented on GitHub (Oct 22, 2024): @fatedier 大佬,有什么办法没,给指导指导。 这个可能需要 linux 内核态的支持吧。
Author
Owner

@JustinTangChina commented on GitHub (Oct 22, 2024):

你的Synology drive这个群辉干嘛不直接连到frp服务端上面,按照你的描述你是通过192.168.1.24中转后再link到drive的,显示ip地址192.168.1.24这是很正常的,无论你外网的什么地址访问 都是通过 192.168.1.24这个frp客户端建立的中转去访问的
所以如果你想显示真实ip 应该是192.168.1.26连接到frp服务端

这样的效果是一样的,会显示 192.168.1.26 的地址。

那如果是Synology Drive 显示 的问题估计你找frp这边解决不了,群辉那边可以是因为走他们自家的协议,你用第三方的显示访问者的ip估计需要群辉那边支持才行,frp的log里面是能查到这些的,但是群辉app那边没有和第三方的frp合作

<!-- gh-comment-id:2428432002 --> @JustinTangChina commented on GitHub (Oct 22, 2024): > > 你的Synology drive这个群辉干嘛不直接连到frp服务端上面,按照你的描述你是通过192.168.1.24中转后再link到drive的,显示ip地址192.168.1.24这是很正常的,无论你外网的什么地址访问 都是通过 192.168.1.24这个frp客户端建立的中转去访问的 > > 所以如果你想显示真实ip 应该是192.168.1.26连接到frp服务端 > > 这样的效果是一样的,会显示 192.168.1.26 的地址。 那如果是Synology Drive 显示 的问题估计你找frp这边解决不了,群辉那边可以是因为走他们自家的协议,你用第三方的显示访问者的ip估计需要群辉那边支持才行,frp的log里面是能查到这些的,但是群辉app那边没有和第三方的frp合作
Author
Owner

@JustinTangChina commented on GitHub (Oct 22, 2024):

@fatedier 大佬,有什么办法没,给指导指导。

这个可能需要 linux 内核态的支持吧。

内核估计你有点难,除非你伪装成群辉自家的服务

<!-- gh-comment-id:2428436090 --> @JustinTangChina commented on GitHub (Oct 22, 2024): > @fatedier 大佬,有什么办法没,给指导指导。 > > 这个可能需要 linux 内核态的支持吧。 内核估计你有点难,除非你伪装成群辉自家的服务
Author
Owner

@JustinTangChina commented on GitHub (Oct 22, 2024):

@fatedier 大佬,有什么办法没,给指导指导。

这个可能需要 linux 内核态的支持吧。

群辉的QC说白了也是frp 但是那是他们家的

<!-- gh-comment-id:2428437840 --> @JustinTangChina commented on GitHub (Oct 22, 2024): > @fatedier 大佬,有什么办法没,给指导指导。 > > 这个可能需要 linux 内核态的支持吧。 群辉的QC说白了也是frp 但是那是他们家的
Author
Owner

@wuai1024 commented on GitHub (Oct 22, 2024):

我在 frp 里面能看到真实ip,在nginx的日志里面也能看到,就是因为 Synology Drive 不支持那个协议。所以才想一些其他办法。

<!-- gh-comment-id:2428439286 --> @wuai1024 commented on GitHub (Oct 22, 2024): 我在 frp 里面能看到真实ip,在nginx的日志里面也能看到,就是因为 Synology Drive 不支持那个协议。所以才想一些其他办法。
Author
Owner

@JustinTangChina commented on GitHub (Oct 22, 2024):

我在 frp 里面能看到真实ip,在nginx的日志里面也能看到,就是因为 Synology Drive 不支持那个协议。所以才想一些其他办法。

所以你想在Synology Drive上去显示估计难实现

<!-- gh-comment-id:2428443415 --> @JustinTangChina commented on GitHub (Oct 22, 2024): > 我在 frp 里面能看到真实ip,在nginx的日志里面也能看到,就是因为 Synology Drive 不支持那个协议。所以才想一些其他办法。 所以你想在Synology Drive上去显示估计难实现
Author
Owner

@cholau0 commented on GitHub (Oct 24, 2024):

这个貌似解决不了,之前我的OA也是和你一样的架构,显示的也是跳板机的IP。你这除非自己解包了,真IP应该在包里面封着

<!-- gh-comment-id:2434493811 --> @cholau0 commented on GitHub (Oct 24, 2024): 这个貌似解决不了,之前我的OA也是和你一样的架构,显示的也是跳板机的IP。你这除非自己解包了,真IP应该在包里面封着
Author
Owner

@cholau0 commented on GitHub (Oct 24, 2024):

这个设置不知道有没有用:
transport.proxyProtocolVersion = "v2"
realip

<!-- gh-comment-id:2434526100 --> @cholau0 commented on GitHub (Oct 24, 2024): 这个设置不知道有没有用: transport.proxyProtocolVersion = "v2" [realip](https://gofrp.org/zh-cn/docs/features/common/realip/)
Author
Owner

@wuai1024 commented on GitHub (Oct 25, 2024):

这个设置不知道有没有用: transport.proxyProtocolVersion = "v2" realip

这个配置了的,这样nginx日志中才能显示到真实ip。只是因为 nginx 转发的 后端服务不支持这个协议。

就想能不能通过其他方法,例如 iptables 等内核态的工具,把真实的公网ip 作为源ip给传递给 后端服务。

<!-- gh-comment-id:2437134972 --> @wuai1024 commented on GitHub (Oct 25, 2024): > 这个设置不知道有没有用: transport.proxyProtocolVersion = "v2" [realip](https://gofrp.org/zh-cn/docs/features/common/realip/) 这个配置了的,这样nginx日志中才能显示到真实ip。只是因为 nginx 转发的 后端服务不支持这个协议。 就想能不能通过其他方法,例如 iptables 等内核态的工具,把真实的公网ip 作为源ip给传递给 后端服务。
Author
Owner

@github-actions[bot] commented on GitHub (Nov 16, 2024):

Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:2480225498 --> @github-actions[bot] commented on GitHub (Nov 16, 2024): Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@ilcxyz commented on GitHub (Jan 14, 2025):

这个貌似解决不了,之前我的OA也是和你一样的架构,显示的也是跳板机的IP。你这除非自己解包了,真IP应该在包里面封着

我在尝试穿透至viger也是这个问题,看来是程序架构的问题,SSH也是正常的。

<!-- gh-comment-id:2590323344 --> @ilcxyz commented on GitHub (Jan 14, 2025): > 这个貌似解决不了,之前我的OA也是和你一样的架构,显示的也是跳板机的IP。你这除非自己解包了,真IP应该在包里面封着 我在尝试穿透至viger也是这个问题,看来是程序架构的问题,SSH也是正常的。
Author
Owner

@ilcxyz commented on GitHub (Jan 14, 2025):

这个貌似解决不了,之前我的OA也是和你一样的架构,显示的也是跳板机的IP。你这除非自己解包了,真IP应该在包里面封着

我在尝试穿透至viger也是这个问题,看来是程序架构的问题,SSH也是正常的。

<!-- gh-comment-id:2590329693 --> @ilcxyz commented on GitHub (Jan 14, 2025): > 这个貌似解决不了,之前我的OA也是和你一样的架构,显示的也是跳板机的IP。你这除非自己解包了,真IP应该在包里面封着 我在尝试穿透至viger也是这个问题,看来是程序架构的问题,SSH也是正常的。
Author
Owner

@MikoyChinese commented on GitHub (Mar 4, 2025):

Try this https://github.com/fatedier/frp/issues/4692.

<!-- gh-comment-id:2696828632 --> @MikoyChinese commented on GitHub (Mar 4, 2025): Try this https://github.com/fatedier/frp/issues/4692.
Author
Owner

@wuai1024 commented on GitHub (Mar 5, 2025):

Try this #4692.

Thank you very much.

<!-- gh-comment-id:2699690881 --> @wuai1024 commented on GitHub (Mar 5, 2025): > Try this [#4692](https://github.com/fatedier/frp/issues/4692). Thank you very much.
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#3557
No description provided.