fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
85.56k stars 13.26k forks source link

客户端连接不上服务器或者连接成功后断开,一直尝试重新连接 #1926

Closed jie331094303 closed 4 years ago

jie331094303 commented 4 years ago

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)

Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)? 服务器和客户端都是 032.1

What operating system and processor architecture are you using (go env)? 服务端:Ubuntu 16.04 香港阿里云 客户端:Server2016

Configures you used:

====================== frps: ====================== [common] bind_port = 7000

kcp_bind_port = 7000

dashboard_port = 7500 token = xxx dashboard_user = xx dashboard_pwd = xx log_file = /log/frps.log log_level = trace log_max_days = 7

====================== frpc.ini ====================== [common] server_addr = xxxx server_port = 7000 token = x [service1] type = tcp local_ip = 127.0.0.1
local_port = 80 remote_port = 8080 [service2] type = tcp local_ip = 127.0.0.1
local_port = 8000 remote_port = 8000 [service3] type = tcp local_ip = 127.0.0.1
local_port = 1433 remote_port = 1433 [rdp] type = tcp local_ip = 127.0.0.1
local_port = 3389 remote_port = 3389 tls_enable = true [test_static_file] type = tcp remote_port = 7001 plugin = static_file

要对外暴露的文件目录

plugin_local_path = xx

访问 url 中会被去除的前缀,保留的内容即为要访问的文件路径

plugin_strip_prefix = static plugin_http_user = abc plugin_http_passwd = abc

=========================== 情况描述: 环境:放在虚拟机的Server2016,内网穿透的服务器是香港的阿里云 1.在重新连接的过程中,是一直可以ping通香港的Ip 2.有时候提示连接成功,但是在尝试使用地址加端口访问穿透的网站时,就会断开重新连接; 3.但是大多数情况都是登陆成功,正在连接closed before response StartWorkConn message: EOF,反反复复;

============================== 个人排除: 1.尝试使用kpc协议,一下子就连接成功,但是使用内网穿透出去的网站访问时,就会断开,并且重新连接; 2.使用相同服务器配置大陆的腾讯云服务器Ip时,只改客户端的地址,就正常了(个人认为不是配置的问题) 3.在同一个网络内将相同配置的客户端放到win10中尝试是正常的(个人觉得不是本地网络的问题,同时可以排除香港阿里云出去的流量被墙了)

==================================

frpc.log: 2020/07/31 12:18:11 [I] [control.go:179] [79766dec063b13ec] [service2] start proxy success 2020/07/31 12:18:11 [I] [control.go:179] [79766dec063b13ec] [service3] start proxy success 2020/07/31 12:18:11 [I] [control.go:179] [79766dec063b13ec] [service1] start proxy success 2020/07/31 12:18:11 [I] [control.go:179] [79766dec063b13ec] [rdp] start proxy success 2020/07/31 12:18:11 [I] [control.go:179] [79766dec063b13ec] [test_static_file] start proxy success 2020/07/31 12:18:41 [W] [control.go:205] [79766dec063b13ec] start new connection to server error: session shutdown 2020/07/31 12:18:41 [I] [control.go:267] [79766dec063b13ec] control writer is closing 2020/07/31 12:18:41 [I] [service.go:174] [79766dec063b13ec] try to reconnect to server... 2020/07/31 12:18:41 [I] [visitor_manager.go:60] [79766dec063b13ec] gracefully shutdown visitor manager 2020/07/31 12:18:41 [I] [service.go:282] [79766dec063b13ec] login to server success, get run id [79766dec063b13ec], server udp port [0] 2020/07/31 12:18:41 [I] [proxy_manager.go:144] [79766dec063b13ec] proxy added: [service1 service2 service3 rdp test_static_file] 2020/07/31 12:19:00 [E] [control.go:157] [79766dec063b13ec] work connection closed before response StartWorkConn message: EOF 2020/07/31 12:19:00 [I] [control.go:267] [79766dec063b13ec] control writer is closing 2020/07/31 12:19:00 [I] [service.go:174] [79766dec063b13ec] try to reconnect to server... 2020/07/31 12:19:00 [I] [visitor_manager.go:60] [79766dec063b13ec] gracefully shutdown visitor manager 2020/07/31 12:19:00 [I] [service.go:282] [79766dec063b13ec] login to server success, get run id [79766dec063b13ec], server udp port [0] 2020/07/31 12:19:00 [I] [proxy_manager.go:144] [79766dec063b13ec] proxy added: [service1 service2 service3 rdp test_static_file] 2020/07/31 12:19:19 [E] [control.go:157] [79766dec063b13ec] work connection closed before response StartWorkConn message: EOF 2020/07/31 12:19:19 [I] [control.go:267] [79766dec063b13ec] control writer is closing 2020/07/31 12:19:19 [I] [service.go:174] [79766dec063b13ec] try to reconnect to server... 2020/07/31 12:19:19 [I] [visitor_manager.go:60] [79766dec063b13ec] gracefully shutdown visitor manager 2020/07/31 12:19:19 [I] [service.go:282] [79766dec063b13ec] login to server success, get run id [79766dec063b13ec], server udp port [0] 2020/07/31 12:19:19 [I] [proxy_manager.go:144] [79766dec063b13ec] proxy added: [rdp test_static_file service1 service2 service3] 2020/07/31 12:19:39 [E] [control.go:157] [79766dec063b13ec] work connection closed before response StartWorkConn message: EOF 2020/07/31 12:19:39 [I] [control.go:267] [79766dec063b13ec] control writer is closing 2020/07/31 12:19:39 [I] [service.go:174] [79766dec063b13ec] try to reconnect to server... 2020/07/31 12:19:39 [I] [visitor_manager.go:60] [79766dec063b13ec] gracefully shutdown visitor manager 2020/07/31 12:19:39 [I] [service.go:282] [79766dec063b13ec] login to server success, get run id [79766dec063b13ec], server udp port [0] 2020/07/31 12:19:39 [I] [proxy_manager.go:144] [79766dec063b13ec] proxy added: [service1 service2 service3 rdp test_static_file]

frps.log 2020/07/31 18:17:31 [I] [control.go:283] [79766dec063b13ec] Replaced by client [79766dec063b13ec] 2020/07/31 18:17:31 [I] [control.go:308] [79766dec063b13ec] control writer is closing 2020/07/31 18:17:31 [D] [control.go:335] [79766dec063b13ec] control connection closed 2020/07/31 18:17:31 [I] [control.go:383] [79766dec063b13ec] client exit success 2020/07/31 18:17:42 [D] [service.go:393] Accept new mux stream error: keepalive timeout 2020/07/31 18:17:51 [T] [service.go:311] start check TLS connection... 2020/07/31 18:17:51 [T] [service.go:319] success check TLS connection 2020/07/31 18:17:51 [I] [service.go:420] [79766dec063b13ec] client login info: ip [58.250.158.172:33132] version [0.32.1] hostname [] os [windows] arch [amd64] 2020/07/31 18:17:51 [I] [control.go:283] [79766dec063b13ec] Replaced by client [79766dec063b13ec] 2020/07/31 18:17:51 [I] [control.go:308] [79766dec063b13ec] control writer is closing 2020/07/31 18:17:51 [D] [control.go:335] [79766dec063b13ec] control connection closed 2020/07/31 18:17:51 [I] [control.go:383] [79766dec063b13ec] client exit success 2020/07/31 18:18:01 [D] [service.go:393] Accept new mux stream error: keepalive timeout 2020/07/31 18:18:11 [T] [service.go:311] start check TLS connection... 2020/07/31 18:18:11 [T] [service.go:319] success check TLS connection 2020/07/31 18:18:11 [I] [service.go:420] [79766dec063b13ec] client login info: ip [58.250.158.172:60445] version [0.32.1] hostname [] os [windows] arch [amd64] 2020/07/31 18:18:11 [I] [control.go:283] [79766dec063b13ec] Replaced by client [79766dec063b13ec] 2020/07/31 18:18:11 [I] [control.go:308] [79766dec063b13ec] control writer is closing 2020/07/31 18:18:11 [D] [control.go:335] [79766dec063b13ec] control connection closed 2020/07/31 18:18:11 [I] [control.go:383] [79766dec063b13ec] client exit success 2020/07/31 18:18:11 [D] [service.go:393] Accept new mux stream error: read tcp 172.17.53.117:7000->58.250.158.172:33132: read: connection reset by peer 2020/07/31 18:18:11 [D] [control.go:219] [79766dec063b13ec] new work connection registered 2020/07/31 18:18:11 [I] [tcp.go:63] [79766dec063b13ec] [service2] tcp proxy listen port [8000] 2020/07/31 18:18:11 [I] [control.go:445] [79766dec063b13ec] new proxy [service2] success 2020/07/31 18:18:11 [I] [tcp.go:63] [79766dec063b13ec] [service3] tcp proxy listen port [1433] 2020/07/31 18:18:11 [I] [control.go:445] [79766dec063b13ec] new proxy [service3] success 2020/07/31 18:18:11 [I] [tcp.go:63] [79766dec063b13ec] [service1] tcp proxy listen port [8080] 2020/07/31 18:18:11 [I] [control.go:445] [79766dec063b13ec] new proxy [service1] success 2020/07/31 18:18:11 [I] [tcp.go:63] [79766dec063b13ec] [rdp] tcp proxy listen port [3389] 2020/07/31 18:18:11 [I] [control.go:445] [79766dec063b13ec] new proxy [rdp] success 2020/07/31 18:18:11 [I] [tcp.go:63] [79766dec063b13ec] [test_static_file] tcp proxy listen port [7001] 2020/07/31 18:18:11 [I] [control.go:445] [79766dec063b13ec] new proxy [test_static_file] success 2020/07/31 18:18:36 [D] [proxy.go:150] [79766dec063b13ec] [test_static_file] get a user connection [119.145.5.245:47540] 2020/07/31 18:18:36 [D] [control.go:248] [79766dec063b13ec] get work connection from pool 2020/07/31 18:18:36 [I] [proxy.go:91] [79766dec063b13ec] [test_static_file] get a new work connection: [58.250.158.172:60445] 2020/07/31 18:18:36 [T] [proxy.go:230] [79766dec063b13ec] [test_static_file] handler user tcp connection, use_encryption: false, use_compression: false 2020/07/31 18:18:36 [D] [proxy.go:241] [79766dec063b13ec] [test_static_file] join connections, workConn(l[172.17.53.117:7000] r[58.250.158.172:60445]) userConn(l[172.17.53.117:7001] r[119.145.5.245:47540]) 2020/07/31 18:18:41 [D] [service.go:393] Accept new mux stream error: keepalive timeout 2020/07/31 18:18:41 [D] [control.go:335] [79766dec063b13ec] control connection closed 2020/07/31 18:18:41 [I] [control.go:308] [79766dec063b13ec] control writer is closing 2020/07/31 18:18:41 [I] [proxy.go:75] [79766dec063b13ec] [service1] proxy closing 2020/07/31 18:18:41 [I] [proxy.go:147] [79766dec063b13ec] [service1] listener is closed 2020/07/31 18:18:41 [I] [proxy.go:75] [79766dec063b13ec] [rdp] proxy closing 2020/07/31 18:18:41 [I] [proxy.go:147] [79766dec063b13ec] [rdp] listener is closed 2020/07/31 18:18:41 [I] [proxy.go:75] [79766dec063b13ec] [test_static_file] proxy closing 2020/07/31 18:18:41 [I] [proxy.go:147] [79766dec063b13ec] [test_static_file] listener is closed 2020/07/31 18:18:41 [I] [proxy.go:75] [79766dec063b13ec] [service2] proxy closing 2020/07/31 18:18:41 [I] [proxy.go:147] [79766dec063b13ec] [service2] listener is closed 2020/07/31 18:18:41 [I] [proxy.go:75] [79766dec063b13ec] [service3] proxy closing 2020/07/31 18:18:41 [I] [proxy.go:147] [79766dec063b13ec] [service3] listener is closed 2020/07/31 18:18:41 [I] [control.go:383] [79766dec063b13ec] client exit success 2020/07/31 18:18:41 [D] [proxy.go:251] [79766dec063b13ec] [test_static_file] join connections closed 2020/07/31 18:18:41 [T] [service.go:311] start check TLS connection... 2020/07/31 18:18:41 [T] [service.go:319] success check TLS connection 2020/07/31 18:18:41 [I] [service.go:420] [79766dec063b13ec] client login info: ip [58.250.158.172:9619] version [0.32.1] hostname [] os [windows] arch [amd64] 2020/07/31 18:19:00 [T] [service.go:311] start check TLS connection... 2020/07/31 18:19:00 [T] [service.go:319] success check TLS connection 2020/07/31 18:19:00 [I] [service.go:420] [79766dec063b13ec] client login info: ip [58.250.158.172:55280] version [0.32.1] hostname [] os [windows] arch [amd64] 2020/07/31 18:19:00 [I] [control.go:283] [79766dec063b13ec] Replaced by client [79766dec063b13ec] 2020/07/31 18:19:00 [I] [control.go:308] [79766dec063b13ec] control writer is closing 2020/07/31 18:19:00 [D] [control.go:335] [79766dec063b13ec] control connection closed 2020/07/31 18:19:00 [I] [control.go:383] [79766dec063b13ec] client exit success

Becods commented 4 years ago

个人意见: 也许是被 GFW 间接性阻断 可采取同配置不同地域服务器进行尝试

fatedier commented 4 years ago

2020/07/31 18:17:42 [D] [service.go:393] Accept new mux stream error: keepalive timeout

猜测更多的是网络问题,可以结合其他的工具加密使用。

liulangwa commented 4 years ago

也可能是被公司的防火墙给断开了,不合规