mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #4856] Connection Reset by Peer, with serverAddr being a domain name #3831
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#3831
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MetronLee on GitHub (Jun 27, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4856
Bug Description
FRP 客户端使用域名作为
serverAddr导致连接重置问题 (Connection Reset by Peer with DomainserverAddr)在使用 FRP
v0.59.0 ~ v0.63.0版本进行内网穿透时,配置客户端(frpc)的serverAddr为域名形式时,即使该域名能正确解析到服务器的公网 IP,客户端也无法成功连接,并报错login to the server failed: read tcp ...: read: connection reset by peer。然而,如果将客户端
frpc.toml中的serverAddr直接配置为服务器的公网 IP 地址,则连接正常。排查过程
frps) 与客户端 (frpc) 均为v0.63.0。dig命令确认域名解析结果正确。hosts文件中硬编码域名到公网 IP 后,问题依然存在,表明与 DNS 解析本身无关。nc -vz <domain> 7000命令显示端口可达。ss -tnlp确认frps正在监听0.0.0.0:7000。tcpdump抓包分析:tcpdump均显示 TCP 三次握手成功完成。frps配置为log.level = "debug"后,日志中没有任何关于客户端连接尝试失败的记录,表明连接拒绝发生在日志系统记录之前,或日志级别不够。v0.59.0 ~ v0.63.0均相同结论
所有证据表明,FRP
v0.59.0 ~ v0.63.0客户端在serverAddr配置为域名形式时,即使域名能正确解析到 IP,其内部处理逻辑也与直接使用 IP 地址存在差异。这种差异导致服务端在收到客户端的应用层握手数据后,立即拒绝连接(发送 RST 包),且未记录详细错误日志。这很可能是 FRP 协议在处理客户端通过域名建立连接时存在某种隐式的主机名校验或兼容性问题。建议 (Suggestion)
v0.63.0版本中,客户端使用域名作为serverAddr时,FRP 协议握手的具体行为,特别是与服务端校验相关的逻辑。(cursor gpt-4.1 未发现异常。)Issue for FRP GitHub Repository
Problem Description
When setting up an FRP system (
v0.59.0 ~ v0.63.0), the client (frpc) fails to connect with the errorlogin to the server failed: read tcp ...: read: connection reset by peerifserverAddrinfrpc.tomlis configured with a domain name.However, if
serverAddrinfrpc.tomlis changed directly to the server's public IP address, the connection establishes and works correctly.Troubleshooting Steps
frpsandfrpcarev0.63.0.dig.hostsfile did not resolve the issue, indicating it's not a direct DNS resolution problem.nc -vz <domain> 7000shows the port is reachable.frpsis confirmed listening on0.0.0.0:7000viass -tnlp.tcpdumpAnalysis:tcpdumplogs confirm successful TCP three-way handshake.log.level = "debug"enabled on thefrpsside, no detailed error logs or connection attempt failures were recorded, suggesting the connection rejection happens at a very low level before standard logging.v0.59.0 ~ v0.63.0are the same.Conclusion
All evidence points to an issue with how the FRP
v0.59.0 ~ v0.63.0client handlesserverAddrwhen it's a domain name, even if the domain resolves correctly to an IP. There appears to be a functional difference in its internal processing compared to using a direct IP. This difference causes the server to immediately reject the connection (by sending an RST packet) upon receiving the client's application layer handshake data, without logging detailed errors. This could be a version-specific bug, or related to some implicit hostname validation or compatibility issue within the FRP protocol when a domain is used for connection initiation.Suggestion
v0.63.0when the client uses a domain name forserverAddr, focusing on the FRP protocol handshake and server-side validation logic.frpc Version
0.63.0
frps Version
0.63.0
System Architecture
server: linux/amd64, client: macOS/arm64
Configurations
Logs
frpc.logNothing appeared in
frps.logat the same time.Steps to reproduce
Assign a domain name to
serverAddrinfrpc.tomlAffected area
@devin-ai-integration[bot] commented on GitHub (Jul 1, 2025):
Investigation Results
After thorough code analysis and testing, this appears to be a network/firewall issue rather than a frp code problem.
Key Findings:
Root Cause:
Network firewalls or DPI devices are likely filtering TLS traffic differently when domain names are used in SNI, causing connection resets during handshake.
Solutions:
serverAddrVerification:
This is an infrastructure issue, not a frp bug. The consistent local test results confirm the codebase handles domains correctly.
@github-actions[bot] commented on GitHub (Jul 16, 2025):
Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.
@BustedSec commented on GitHub (Jul 16, 2025):
Set to 10.10 rfc 1918 address
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: github-actions[bot] @.>
Sent: Tuesday, July 15, 2025 5:42:36 PM
To: fatedier/frp @.>
Cc: Subscribed @.***>
Subject: Re: [fatedier/frp] Connection Reset by Peer, with
serverAddrbeing a domain name (Issue #4856)[https://avatars.githubusercontent.com/in/15368?s=20&v=4]github-actions[bot] left a comment (fatedier/frp#4856)https://github.com/fatedier/frp/issues/4856#issuecomment-3076365046
Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.
—
Reply to this email directly, view it on GitHubhttps://github.com/fatedier/frp/issues/4856#issuecomment-3076365046, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABYWWB4VS3YI2SBZI4VKI5D3IWNXZAVCNFSM6AAAAACAJDOVCWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTANZWGM3DKMBUGY.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
@ly360 commented on GitHub (Jul 29, 2025):
境内服务器且域名没备案吧?
@MetronLee commented on GitHub (Jul 30, 2025):
AWS EC2 服务器,namesilo的域名,在新加坡使用
@DaPoHou commented on GitHub (Aug 5, 2025):
是的,就这两天我也突然遇到这个问题,一直运行好好的,突然出现这个问题。使用的版本是0.51.3,是通过同一城市不同运营商之间互联。通过server_addr配置域名无法连接,换成ip地址就好了。我反而怀疑是不是运营商搞得鬼。
############
经过我进一步排查,发现我使用的域名在国内部分dns上被解析到了反诈ip上,不知道是不是这个原因。
@github-actions[bot] commented on GitHub (Aug 20, 2025):
Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.
@MetronLee commented on GitHub (Aug 24, 2025):
应该不是,我在境外用的境外的dns