[GH-ISSUE #4103] P2P隧道无法建立 #3237

Closed
opened 2026-05-05 14:05:23 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @luuuuyh on GitHub (Mar 24, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4103

Bug Description

建立P2P时失败

frpc Version

0.51.3

frps Version

0.51.3

System Architecture

frps - linux x86,frpc1 - linux mipsle,frpc2 - linux x86 visitor

Configurations

frps - linux x86 云服务器固定IP ..4.192

[common]
bind_port = 7000


frpc1 - linux mipsle ..142.246

[common]
server_addr = *.4.192
server_port = 7000

[vusb1]
type = xtcp
sk = 123123
local_ip = 127.0.0.1
local_port = 7575


frpc2 - linux x86 visitor ..228.56

[common]
server_addr = *.4.192
server_port = 7000

[p2p_tcp_visitor]
role = visitor
type = xtcp
#server_user = user1
server_name = vusb1
sk = 123123
bind_addr = 127.0.0.1
bind_port = 7777

Logs

frps
2024/03/25 03:02:37 [I] [root.go:204] frps uses config file: frps.ini
2024/03/25 03:02:38 [I] [service.go:206] frps tcp listen on 0.0.0.0:7000
2024/03/25 03:02:38 [I] [root.go:213] frps started successfully
2024/03/25 03:02:53 [I] [service.go:539] [00d8c177a72e4835] client login info: ip [..142.246:37663] version [0.51.3] hostname [] os [linux] arch [mipsle]
2024/03/25 03:02:53 [I] [control.go:497] [00d8c177a72e4835] new proxy [vusb1] type [xtcp] success


frpc2

2024/03/25 02:46:06 [I] [root.go:220] start frpc service for config file [frpc.ini]
2024/03/25 02:46:06 [I] [service.go:301] [7a6f0cbfba2c8045] login to server success, get run id [7a6f0cbfba2c8045]
2024/03/25 02:46:06 [I] [visitor_manager.go:116] [7a6f0cbfba2c8045] start visitor success
2024/03/25 02:46:06 [I] [visitor_manager.go:156] [7a6f0cbfba2c8045] visitor added: [p2p_tcp_visitor]
2024/03/25 02:46:12 [I] [xtcp.go:283] [7a6f0cbfba2c8045] [p2p_tcp_visitor] nathole prepare success, nat type: HardNAT, behavior: BehaviorBothChanged, addresses: [113.120.5.50:19565 112.232.228.56:64488], assistedAddresses: [192.168.99.112:64488 192.168.112.1:64488 192.168.201.1:64488]
2024/03/25 02:46:13 [I] [xtcp.go:309] [7a6f0cbfba2c8045] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711305966584ced07efb97835], protocol [quic], candidate address [112.224.142.246:64784 112.224.142.246:52570], assisted address [192.168.43.100:54586 192.168.1.1:54586], detectBehavior: {Role:receiver Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0}
2024/03/25 02:46:18 [W] [xtcp.go:316] [7a6f0cbfba2c8045] [p2p_tcp_visitor] make hole error: wait detect message error: read udp4 0.0.0.0:64488: i/o timeout
2024/03/25 02:46:22 [I] [xtcp.go:283] [7a6f0cbfba2c8045] [p2p_tcp_visitor] nathole prepare success, nat type: HardNAT, behavior: BehaviorBothChanged, addresses: [113.120.5.50:19569 112.232.228.56:54776], assistedAddresses: [192.168.99.112:54776 192.168.112.1:54776 192.168.201.1:54776]
2024/03/25 02:46:24 [I] [xtcp.go:309] [7a6f0cbfba2c8045] [p2p_tcp_visitor] get natHoleRespMsg, sid [17113059769349622b5af9ea2b], protocol [quic], candidate address [112.224.142.246:28428 112.224.142.246:2297], assisted address [192.168.43.100:58671 192.168.1.1:58671], detectBehavior: {Role:sender Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0}
2024/03/25 02:46:29 [W] [xtcp.go:316] [7a6f0cbfba2c8045] [p2p_tcp_visitor] make hole error: wait detect message error: read udp4 0.0.0.0:54776: i/o timeout
2024/03/25 02:46:32 [E] [xtcp.go:179] [7a6f0cbfba2c8045] [p2p_tcp_visitor] open tunnel error: open tunnel timeout

Steps to reproduce

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 @luuuuyh on GitHub (Mar 24, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/4103 ### Bug Description 建立P2P时失败 ### frpc Version 0.51.3 ### frps Version 0.51.3 ### System Architecture frps - linux x86,frpc1 - linux mipsle,frpc2 - linux x86 visitor ### Configurations frps - linux x86 云服务器固定IP *.*.4.192 [common] bind_port = 7000 --------------------------------------------------------------- frpc1 - linux mipsle *.*.142.246 [common] server_addr = *.4.192 server_port = 7000 [vusb1] type = xtcp sk = 123123 local_ip = 127.0.0.1 local_port = 7575 --------------------------------------------------------------- frpc2 - linux x86 visitor *.*.228.56 [common] server_addr = *.4.192 server_port = 7000 [p2p_tcp_visitor] role = visitor type = xtcp #server_user = user1 server_name = vusb1 sk = 123123 bind_addr = 127.0.0.1 bind_port = 7777 ### Logs frps 2024/03/25 03:02:37 [I] [root.go:204] frps uses config file: frps.ini 2024/03/25 03:02:38 [I] [service.go:206] frps tcp listen on 0.0.0.0:7000 2024/03/25 03:02:38 [I] [root.go:213] frps started successfully 2024/03/25 03:02:53 [I] [service.go:539] [00d8c177a72e4835] client login info: ip [*.*.142.246:37663] version [0.51.3] hostname [] os [linux] arch [mipsle] 2024/03/25 03:02:53 [I] [control.go:497] [00d8c177a72e4835] new proxy [vusb1] type [xtcp] success -------------------------------------- frpc2 2024/03/25 02:46:06 [I] [root.go:220] start frpc service for config file [frpc.ini] 2024/03/25 02:46:06 [I] [service.go:301] [7a6f0cbfba2c8045] login to server success, get run id [7a6f0cbfba2c8045] 2024/03/25 02:46:06 [I] [visitor_manager.go:116] [7a6f0cbfba2c8045] start visitor success 2024/03/25 02:46:06 [I] [visitor_manager.go:156] [7a6f0cbfba2c8045] visitor added: [p2p_tcp_visitor] 2024/03/25 02:46:12 [I] [xtcp.go:283] [7a6f0cbfba2c8045] [p2p_tcp_visitor] nathole prepare success, nat type: HardNAT, behavior: BehaviorBothChanged, addresses: [113.120.5.50:19565 112.232.228.56:64488], assistedAddresses: [192.168.99.112:64488 192.168.112.1:64488 192.168.201.1:64488] 2024/03/25 02:46:13 [I] [xtcp.go:309] [7a6f0cbfba2c8045] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711305966584ced07efb97835], protocol [quic], candidate address [112.224.142.246:64784 112.224.142.246:52570], assisted address [192.168.43.100:54586 192.168.1.1:54586], detectBehavior: {Role:receiver Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0} 2024/03/25 02:46:18 [W] [xtcp.go:316] [7a6f0cbfba2c8045] [p2p_tcp_visitor] make hole error: wait detect message error: read udp4 0.0.0.0:64488: i/o timeout 2024/03/25 02:46:22 [I] [xtcp.go:283] [7a6f0cbfba2c8045] [p2p_tcp_visitor] nathole prepare success, nat type: HardNAT, behavior: BehaviorBothChanged, addresses: [113.120.5.50:19569 112.232.228.56:54776], assistedAddresses: [192.168.99.112:54776 192.168.112.1:54776 192.168.201.1:54776] 2024/03/25 02:46:24 [I] [xtcp.go:309] [7a6f0cbfba2c8045] [p2p_tcp_visitor] get natHoleRespMsg, sid [17113059769349622b5af9ea2b], protocol [quic], candidate address [112.224.142.246:28428 112.224.142.246:2297], assisted address [192.168.43.100:58671 192.168.1.1:58671], detectBehavior: {Role:sender Mode:0 TTL:0 SendDelayMs:0 ReadTimeoutMs:5000 CandidatePorts:[] SendRandomPorts:0 ListenRandomPorts:0} 2024/03/25 02:46:29 [W] [xtcp.go:316] [7a6f0cbfba2c8045] [p2p_tcp_visitor] make hole error: wait detect message error: read udp4 0.0.0.0:54776: i/o timeout 2024/03/25 02:46:32 [E] [xtcp.go:179] [7a6f0cbfba2c8045] [p2p_tcp_visitor] open tunnel error: open tunnel timeout ### Steps to reproduce _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@luuuuyh commented on GitHub (Mar 24, 2024):

frpc2这边本来有两个wan,去掉了一个重新试了一下

2024/03/25 03:36:11 [I] [root.go:220] start frpc service for config file [frpc.ini]
2024/03/25 03:36:11 [I] [service.go:301] [048c30324788800d] login to server success, get run id [048c30324788800d]
2024/03/25 03:36:11 [I] [visitor_manager.go:116] [048c30324788800d] start visitor success
2024/03/25 03:36:11 [I] [visitor_manager.go:156] [048c30324788800d] visitor added: [p2p_tcp_visitor]
2024/03/25 03:36:11 [W] [xtcp.go:273] [048c30324788800d] [p2p_tcp_visitor] nathole precheck error: xtcp server for [vusb1] doesn't exist
2024/03/25 03:36:22 [W] [xtcp.go:273] [048c30324788800d] [p2p_tcp_visitor] nathole precheck error: xtcp server for [vusb1] doesn't exist
2024/03/25 03:36:31 [E] [xtcp.go:179] [048c30324788800d] [p2p_tcp_visitor] open tunnel error: open tunnel timeout
2024/03/25 03:36:41 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:51272 112.232.228.56:51272], assistedAddresses: [192.168.99.112:51272 192.168.112.1:51272 192.168.201.1:51272]
2024/03/25 03:36:42 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711309000a3ed0b768e897697], protocol [quic], candidate address [112.224.142.246:42343 112.224.142.246:54408], assisted address [192.168.43.100:57770 192.168.1.1:57770], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0}
2024/03/25 03:36:46 [I] [xtcp.go:320] [048c30324788800d] [p2p_tcp_visitor] establishing nat hole connection successful, sid [1711309000a3ed0b768e897697], remoteAddr [112.224.142.246:35903]
2024/03/25 03:36:51 [W] [xtcp.go:324] [048c30324788800d] [p2p_tcp_visitor] init tunnel session error: dial quic error: timeout: no recent network activity
2024/03/25 03:36:52 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:53664 112.232.228.56:53664], assistedAddresses: [192.168.99.112:53664 192.168.112.1:53664 192.168.201.1:53664]
2024/03/25 03:36:53 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711309011ee5a9b8cb1e3f740], protocol [quic], candidate address [112.224.142.246:61320 112.224.142.246:21475], assisted address [192.168.43.100:43840 192.168.1.1:43840], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0}
2024/03/25 03:36:59 [I] [xtcp.go:320] [048c30324788800d] [p2p_tcp_visitor] establishing nat hole connection successful, sid [1711309011ee5a9b8cb1e3f740], remoteAddr [112.224.142.246:18580]
2024/03/25 03:37:00 [E] [xtcp.go:179] [048c30324788800d] [p2p_tcp_visitor] open tunnel error: open tunnel timeout
2024/03/25 03:37:04 [W] [xtcp.go:324] [048c30324788800d] [p2p_tcp_visitor] init tunnel session error: dial quic error: timeout: no recent network activity
2024/03/25 03:37:11 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:64087 112.232.228.56:64087], assistedAddresses: [192.168.99.112:64087 192.168.112.1:64087 192.168.201.1:64087]
2024/03/25 03:37:13 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [17113090318bd7ffd904cec36f], protocol [quic], candidate address [112.224.142.246:64785 112.224.142.246:52572], assisted address [192.168.43.100:59039 192.168.1.1:59039], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0}
2024/03/25 03:37:22 [I] [xtcp.go:320] [048c30324788800d] [p2p_tcp_visitor] establishing nat hole connection successful, sid [17113090318bd7ffd904cec36f], remoteAddr [112.224.142.246:15106]
2024/03/25 03:37:27 [W] [xtcp.go:324] [048c30324788800d] [p2p_tcp_visitor] init tunnel session error: dial quic error: timeout: no recent network activity
2024/03/25 03:37:28 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:59195 112.232.228.56:59195], assistedAddresses: [192.168.99.112:59195 192.168.112.1:59195 192.168.201.1:59195]
2024/03/25 03:37:30 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711309048e426877ebb701a1f], protocol [quic], candidate address [112.224.142.246:64786 112.224.142.246:52573], assisted address [192.168.43.100:53196 192.168.1.1:53196], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0}
2024/03/25 03:37:31 [E] [xtcp.go:179] [048c30324788800d] [p2p_tcp_visitor] open tunnel error: open tunnel timeout

<!-- gh-comment-id:2016921795 --> @luuuuyh commented on GitHub (Mar 24, 2024): frpc2这边本来有两个wan,去掉了一个重新试了一下 2024/03/25 03:36:11 [I] [root.go:220] start frpc service for config file [frpc.ini] 2024/03/25 03:36:11 [I] [service.go:301] [048c30324788800d] login to server success, get run id [048c30324788800d] 2024/03/25 03:36:11 [I] [visitor_manager.go:116] [048c30324788800d] start visitor success 2024/03/25 03:36:11 [I] [visitor_manager.go:156] [048c30324788800d] visitor added: [p2p_tcp_visitor] 2024/03/25 03:36:11 [W] [xtcp.go:273] [048c30324788800d] [p2p_tcp_visitor] nathole precheck error: xtcp server for [vusb1] doesn't exist 2024/03/25 03:36:22 [W] [xtcp.go:273] [048c30324788800d] [p2p_tcp_visitor] nathole precheck error: xtcp server for [vusb1] doesn't exist 2024/03/25 03:36:31 [E] [xtcp.go:179] [048c30324788800d] [p2p_tcp_visitor] open tunnel error: open tunnel timeout 2024/03/25 03:36:41 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:51272 112.232.228.56:51272], assistedAddresses: [192.168.99.112:51272 192.168.112.1:51272 192.168.201.1:51272] 2024/03/25 03:36:42 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711309000a3ed0b768e897697], protocol [quic], candidate address [112.224.142.246:42343 112.224.142.246:54408], assisted address [192.168.43.100:57770 192.168.1.1:57770], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0} 2024/03/25 03:36:46 [I] [xtcp.go:320] [048c30324788800d] [p2p_tcp_visitor] establishing nat hole connection successful, sid [1711309000a3ed0b768e897697], remoteAddr [112.224.142.246:35903] 2024/03/25 03:36:51 [W] [xtcp.go:324] [048c30324788800d] [p2p_tcp_visitor] init tunnel session error: dial quic error: timeout: no recent network activity 2024/03/25 03:36:52 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:53664 112.232.228.56:53664], assistedAddresses: [192.168.99.112:53664 192.168.112.1:53664 192.168.201.1:53664] 2024/03/25 03:36:53 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711309011ee5a9b8cb1e3f740], protocol [quic], candidate address [112.224.142.246:61320 112.224.142.246:21475], assisted address [192.168.43.100:43840 192.168.1.1:43840], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0} 2024/03/25 03:36:59 [I] [xtcp.go:320] [048c30324788800d] [p2p_tcp_visitor] establishing nat hole connection successful, sid [1711309011ee5a9b8cb1e3f740], remoteAddr [112.224.142.246:18580] 2024/03/25 03:37:00 [E] [xtcp.go:179] [048c30324788800d] [p2p_tcp_visitor] open tunnel error: open tunnel timeout 2024/03/25 03:37:04 [W] [xtcp.go:324] [048c30324788800d] [p2p_tcp_visitor] init tunnel session error: dial quic error: timeout: no recent network activity 2024/03/25 03:37:11 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:64087 112.232.228.56:64087], assistedAddresses: [192.168.99.112:64087 192.168.112.1:64087 192.168.201.1:64087] 2024/03/25 03:37:13 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [17113090318bd7ffd904cec36f], protocol [quic], candidate address [112.224.142.246:64785 112.224.142.246:52572], assisted address [192.168.43.100:59039 192.168.1.1:59039], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0} 2024/03/25 03:37:22 [I] [xtcp.go:320] [048c30324788800d] [p2p_tcp_visitor] establishing nat hole connection successful, sid [17113090318bd7ffd904cec36f], remoteAddr [112.224.142.246:15106] 2024/03/25 03:37:27 [W] [xtcp.go:324] [048c30324788800d] [p2p_tcp_visitor] init tunnel session error: dial quic error: timeout: no recent network activity 2024/03/25 03:37:28 [I] [xtcp.go:283] [048c30324788800d] [p2p_tcp_visitor] nathole prepare success, nat type: EasyNAT, behavior: BehaviorNoChange, addresses: [112.232.228.56:59195 112.232.228.56:59195], assistedAddresses: [192.168.99.112:59195 192.168.112.1:59195 192.168.201.1:59195] 2024/03/25 03:37:30 [I] [xtcp.go:309] [048c30324788800d] [p2p_tcp_visitor] get natHoleRespMsg, sid [1711309048e426877ebb701a1f], protocol [quic], candidate address [112.224.142.246:64786 112.224.142.246:52573], assisted address [192.168.43.100:53196 192.168.1.1:53196], detectBehavior: {Role:sender Mode:2 TTL:0 SendDelayMs:3000 ReadTimeoutMs:35000 CandidatePorts:[] SendRandomPorts:1000 ListenRandomPorts:0} 2024/03/25 03:37:31 [E] [xtcp.go:179] [048c30324788800d] [p2p_tcp_visitor] open tunnel error: open tunnel timeout
Author
Owner

@xqzr commented on GitHub (Mar 25, 2024):

xtcp 看运气

<!-- gh-comment-id:2017696483 --> @xqzr commented on GitHub (Mar 25, 2024): xtcp 看运气
Author
Owner

@fatedier commented on GitHub (Mar 28, 2024):

@luuuuyh 第二次贴的日志上看理论上应该是可以成功的,但是 p2p 的话,本身影响因素很多,有很多不确定性,有时候还取决于运营商的链路。

https://gofrp.org/zh-cn/docs/reference/visitor/#xtcpvisitorconfig:~:text=Yes-,protocol,-string
可以把这里的参数配置为 kcp 也试一下,这个尝试是看有没有可能运营商屏蔽了某些标准协议。

<!-- gh-comment-id:2024343833 --> @fatedier commented on GitHub (Mar 28, 2024): @luuuuyh 第二次贴的日志上看理论上应该是可以成功的,但是 p2p 的话,本身影响因素很多,有很多不确定性,有时候还取决于运营商的链路。 https://gofrp.org/zh-cn/docs/reference/visitor/#xtcpvisitorconfig:~:text=Yes-,protocol,-string 可以把这里的参数配置为 kcp 也试一下,这个尝试是看有没有可能运营商屏蔽了某些标准协议。
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#3237
No description provided.