mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #3469] Not all of STUN servers are compatible with FRP #2773
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#2773
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 @Bellegar on GitHub (May 31, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3469
Originally assigned to: @fatedier on GitHub.
Bug Description
This behaviour similar to using config field for frpc 'nat_hole_stun_server' or using console test
frpc nathole discover --nat_hole_stun_server ***Default server stun.easyvoip.com:3478 is working as expected, but some others do not work, with error:
discover error: wait response from stun server timeoutI test some servers from that list and that.
Some STUN servers, that correctly similarly behave on https://icetest.info/ or on https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ produces such timeout error:
stun.antisip.com:3478
stun.stochastix.de:3478
stun.beebeetle.com:3478
I host own coturn STUN server on linux with default configuration (checked enabling/disabling 'stun-only' config flag) on public IP, which is correctly work for check on sites above.
But FRP can't work with it.
I found several working servers
stun.voipstunt.com:3478
stun.cheapvoip.com:3478
stun.voipgain.com:3478
Good 'nathole discover' result prints this one:
STUN server: stun.easyvoip.com:3478
Your NAT type is: EasyNAT
Behavior is: BehaviorNoChange
External address is: [IP:port IP:port]
Local address is: 0.0.0.0:port
Public Network: false
frpc Version
0.49.0 (
cceab7e)frps Version
0.49.0 (
cceab7e)System Architecture
windows/amd64, mingw64, go 1.20
Configurations
No need config to test 'nathole discover'
Logs
No response
Steps to reproduce
Affected area
@fatedier commented on GitHub (Jun 1, 2023):
It looks like
stun.antisip.com:3478may not be fully functional because we need to use the second address provided by the stun server to access different external IPs. However, the second address forstun.antisip.com:3478isstun.antisip.com:3479and it is not available, so it will time out.@Bellegar commented on GitHub (Jun 2, 2023):
That is right, I opened 3479 port for my hosted coturn server, and 'nathole discover' became working, as also in configuration for xtcp.
But a little bit strange, that NUT hole punching realization using in FRP is hard depends on 3479 port, when STUN address points directly to 3478, and there is no mention anywhere, that 3479 must be opened for servers, used for 'nat_hole_stun_server '. Also other STUN test services do not need 3479 port for checking correct STUN server's status.
Just interested: Does 3479 port really necessary for frp, isn't it redundant?
@fatedier commented on GitHub (Jun 2, 2023):
If you are interested, you can refer to the relevant RFC documents for further information: RFC 5780.
The response code 3479 is not explicitly defined by any specific source, but it is returned by the STUN server itself. This code indicates the address of the second request that the client needs to try after the first request. Typically, the IP address of this second address needs to be different from the first attempt to yield meaningful results, while changing the port number usually has minimal impact.
STUN servers that support this feature can assist in detecting NAT behavior, thereby significantly enhancing the success rate of penetration.
Even if this feature is not supported, it might still be possible to achieve success, but certain specific NAT environments may experience adverse effects. Therefore, utilizing a STUN server that supports this capability (which is the case with most STUN servers adhering to standard specifications) can provide a better experience.
@hayden-pan commented on GitHub (Oct 11, 2024):
As mentioned by @fatedier, after search about the widely used STUN server coturn's configuration.
I found the vital configuration items to make coturn satisfy with FRP.
no-rfc5780: This item is enabled by default, because it increase the possibility of an amplification attack. But it should be disabled for compatible with FRPexternal-ip: If your server is behind NAT like me, you should set this item to<public-ip>/<private-ip>After setting up as above and restart coturn service, you will find coturn listening on both UDP and TCP ports on 3478 and 3479. So maybe the answer is also for #4321 , the STUN server is need to implement and enabled RFC5780 to work with FRP
@TwoBirdsOnTheTree commented on GitHub (Mar 11, 2025):
反复尝试在阿里云里搭建,失败已放弃
turnserver.conf配置如下:
尝试过程中发现:
error resolving ';; communications error to 208.67.222.222#53: timed out xxxxxxxxx' hostname: Name or service not known, 则3479端口监听成功:INFO: IPv4. UDP listener opened on: 10.0.0.169:3479WARNING: STUN CHANGE_REQUEST not supported: only one IP address is provided,此时不会监听3479@xsjmonk commented on GitHub (Dec 20, 2025):
Finally, a usable frp-compatible stun server can be done in this way:
coturnas stun serverturnserver.conf. There are many pitfalls such as explicitlistening-ip, etc. Make sure it fits your need and you know what you are doingTwo public ips are the key, which enables the RFC5780 probe to succeed.
@hayden-pan commented on GitHub (Dec 25, 2025):
Preparing two public IP addresses is too costly. Although I'm not an expert, I don't think such a protocol requirement should exist. I am using coturn with only one public IP address now
@bluedreamteng commented on GitHub (Feb 10, 2026):
I found a method for single public IP setup that's compatible with frp.
With a single network interface, you need to create a virtual IP, for example:
sudo ip addr add 172.26.208.185/24 dev eth0Then the complete configuration is as follows:
@Brown000 commented on GitHub (Apr 24, 2026):
This is a correct solution. When searching 'RFC 5780' in turnserver.conf, There are some comments like:
That means we need to listen on at least 2 IPs to support NAT behavior discovery which is required by frp.
So we can add another virtual private ip and listen on it, or just comment listening-ip config which make coturn listening on all system IPs from interfaces like lo/eth0/docker0.
This is remarked at turnserver.conf too: