[GH-ISSUE #1883] 无法正常转发UDP端口 #1489

Closed
opened 2026-05-05 12:56:30 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @qcmiao1998 on GitHub (Jun 28, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1883

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.

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)?
0.33.0

What operating system and processor architecture are you using (go env)?
Server: centos(amd64), Client: win10(amd64)

Configures you used:
Server:
[common]
bind_port = 7050
authentication_method = token
token = ***

Client:
[common]
server_addr = aaa.com
server_port = 7050
token = ***

[proxy]
type = tcp
local_ip = 127.0.0.1
local_port = 2081
remote_port = 2090

[dns]
type = udp
local_ip = 8.8.8.8
local_port = 53
remote_port = 6000

Steps to reproduce the issue:

  1. 分别使用 frps -c frps.ini 和 frpc -c frpc.ini 启动服务

Describe the results you received:
TCP的端口转发可以正常使用, UDP的转发连接不上

在服务器端使用 dig @127.0.0.1 -p 6000 www.google.com 测试显示 connection timed out; no servers could be reached

netstat 显示端口已被监听 (但显示udp6)

Describe the results you expected:
希望可以成功实现udp端口的转发

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)

Originally created by @qcmiao1998 on GitHub (Jun 28, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/1883 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. 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)?** 0.33.0 **What operating system and processor architecture are you using (`go env`)?** Server: centos(amd64), Client: win10(amd64) **Configures you used:** Server: [common] bind_port = 7050 authentication_method = token token = *** Client: [common] server_addr = aaa.com server_port = 7050 token = *** [proxy] type = tcp local_ip = 127.0.0.1 local_port = 2081 remote_port = 2090 [dns] type = udp local_ip = 8.8.8.8 local_port = 53 remote_port = 6000 **Steps to reproduce the issue:** 1. 分别使用 frps -c frps.ini 和 frpc -c frpc.ini 启动服务 **Describe the results you received:** TCP的端口转发可以正常使用, UDP的转发连接不上 在服务器端使用 `dig @127.0.0.1 -p 6000 www.google.com` 测试显示 `connection timed out; no servers could be reached` `netstat` 显示端口已被监听 (但显示udp6) **Describe the results you expected:** 希望可以成功实现udp端口的转发 **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)**
gitea-mirror 2026-05-05 12:56:30 -06:00
Author
Owner

@fatedier commented on GitHub (Jun 29, 2020):

使用可正常访问的 UDP 端口测试。

<!-- gh-comment-id:650875972 --> @fatedier commented on GitHub (Jun 29, 2020): 使用可正常访问的 UDP 端口测试。
Author
Owner

@qcmiao1998 commented on GitHub (Jun 29, 2020):

我在 Client 上直接测试被转发的服务是可以连上的, 但在 Server 上测自己的端口是连不上的, 我也换过几个其他的 UDP 服务测试, 都是一样的状况. 所有的 TCP 转发都是正常工作的.

netstat -atunlp | grep 6000
udp6       0      0 :::6000                :::*                                872/frps  
<!-- gh-comment-id:650905197 --> @qcmiao1998 commented on GitHub (Jun 29, 2020): 我在 Client 上直接测试被转发的服务是可以连上的, 但在 Server 上测自己的端口是连不上的, 我也换过几个其他的 UDP 服务测试, 都是一样的状况. 所有的 TCP 转发都是正常工作的. ``` netstat -atunlp | grep 6000 udp6 0 0 :::6000 :::* 872/frps ```
Author
Owner

@qcmiao1998 commented on GitHub (Jun 29, 2020):

我拿 ncat 进行了交叉测试, 结果如下:

  1. Client 上使用 ncat -uvlp port 监听 UDP 端口, Client 上使用 ncat -u 127.0.0.1 port 连接, 可以联通
  2. Server 上使用 ncat -uvlp port 监听 UDP 端口, Server 上使用 ncat -u 127.0.0.1 port 连接, 可以联通
  3. Server 上使用 ncat -uvlp port 监听 UDP 端口, Client 上使用 ncat -u server-ip port 连接, 可以联通
  4. Client 上使用 ncat -uvlp port 监听 UDP 端口, 打开 frp, Server 上使用 ncat -u 127.0.0.1 port 连接, 不能联通
  5. Client 上使用 ncat -uvlp port 监听 UDP 端口, 打开 frp, Client 上使用 ncat -u server-ip port 连接, 不能联通

使用 ncat 进行 TCP 的转发测试, 均成功.

<!-- gh-comment-id:650974977 --> @qcmiao1998 commented on GitHub (Jun 29, 2020): 我拿 ncat 进行了交叉测试, 结果如下: 1. Client 上使用 `ncat -uvlp port` 监听 UDP 端口, Client 上使用 `ncat -u 127.0.0.1 port` 连接, 可以联通 2. Server 上使用 `ncat -uvlp port` 监听 UDP 端口, Server 上使用 `ncat -u 127.0.0.1 port` 连接, 可以联通 3. Server 上使用 `ncat -uvlp port` 监听 UDP 端口, Client 上使用 `ncat -u server-ip port` 连接, 可以联通 4. Client 上使用 `ncat -uvlp port` 监听 UDP 端口, 打开 frp, Server 上使用 `ncat -u 127.0.0.1 port` 连接, 不能联通 5. Client 上使用 `ncat -uvlp port` 监听 UDP 端口, 打开 frp, Client 上使用 `ncat -u server-ip port` 连接, 不能联通 使用 ncat 进行 TCP 的转发测试, 均成功.
Author
Owner

@qcmiao1998 commented on GitHub (Jun 30, 2020):

故障自行消失, 原因不明.

<!-- gh-comment-id:651508343 --> @qcmiao1998 commented on GitHub (Jun 30, 2020): 故障自行消失, 原因不明.
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#1489
No description provided.