mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #838] frps不设置bind_addr时默认绑定到IPv6 #658
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#658
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 @qakcn on GitHub (Jun 22, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/838
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)?
0.20.0
What operating system and processor architecture are you using (
go env)?Configures you used:
frps.iniSteps to reproduce the issue:
bind_addr = 0.0.0.0结果一样frps -c frps.iniDescribe the results you received:
netstat -nl46检查只有IPv6地址被监听:Describe the results you expected:
希望监听IPv4地址。
Additional information you deem important (e.g. issue happens only occasionally):
这可能是Go语言通病,之前使用ngrok和kcptun时也有不配置绑定IPv4地址
0.0.0.0时默认只监听IPv6地址。我希望能同时监听所有地址。
Can you point out what caused this issue (optional)
Sorry。
@fatedier commented on GitHub (Jun 22, 2018):
所以你的问题是什么?服务不可用?我没看出来问题。
@qakcn commented on GitHub (Jun 22, 2018):
只绑定到了:::7000,看前面的协议,是
tcp6和udp6,没有绑定到0.0.0.0:7000。也就是说设置
bind_addr = 0.0.0.0没有生效@fatedier commented on GitHub (Jun 22, 2018):
所以问题是什么?
@qakcn commented on GitHub (Jun 22, 2018):
我要绑定到
0.0.0.0,也就是所有IPv4地址上@fatedier commented on GitHub (Jun 22, 2018):
ok,那就说明服务没问题,其他需求请自行通过 google 解决。
@qakcn commented on GitHub (Jun 22, 2018):
有问题啊,你的设置项没有生效啊,没有按照预期的方式运作
@fatedier commented on GitHub (Jun 22, 2018):
目前看符合预期,如果你的服务不能通过 ipv4 地址访问,再提 issue。
@qakcn commented on GitHub (Jun 22, 2018):
没有监听当然是不能访问了……
@fatedier commented on GitHub (Jun 22, 2018):
目前从你的描述来看完全符合预期,请提供更详细的信息,或者自行搜索相关的技术知识。
@qakcn commented on GitHub (Jun 22, 2018):
我要绑定到3个IP地址,要运行3个服务?
其他服务比如nginx里0.0.0.0就是绑定到所有IPv4地址,这可以说是约定俗成的了,还有我上面的netstat结果里那个
0.0.0.0:23333端口是ssh服务的,也没有问题@fatedier commented on GitHub (Jun 22, 2018):
google
@qakcn commented on GitHub (Jun 22, 2018):
要么就不要把
0.0.0.0作为一个有效值,既然要作为有效值,就要按照预期的方式(绑定到IPv4地址)来运作@qakcn commented on GitHub (Jun 22, 2018):
https://en.wikipedia.org/wiki/0.0.0.0
As a host address
......
In the context of servers, 0.0.0.0 can mean "all IPv4 addresses on the local machine". If a host has two IP addresses, 192.168.1.1 and 10.1.2.1, and a server running on the host is configured to listen on 0.0.0.0, it will be reachable at both of those IP addresses.
@fatedier commented on GitHub (Jun 22, 2018):
所以你遇到的问题是服务不能访问,而不是绑定了 ipv6 地址,绑定 ipv6 地址导致服务不能访问只是你的猜测,这不是一个问题。
我一直问你问题是什么,我们应该去解决问题,而不是去解决一个猜测的问题,从而忽略其他因素,你的猜测是因素之一,所以需要验证,提供测试依据。
你可以做的事情很多,通过搜索引擎搜集相关技术资料,自行在不同的环境下做测试,充分理解这个问题。不要只止步于表面的现象就不去深究原因。
@qakcn commented on GitHub (Jun 22, 2018):
Go语言的
net.Listen在地址缺省的情况下(比如net.Listen("tcp",":7000"))会不监听IPv4端口而只监听IPv6地址,只有指定了tcp4的协议(如net.Listen("tcp4",":7000"))或者IPv4地址(net.Listen("tcp","1.2.3.4:7000"))才会监听。(目前看来0.0.0.0也会不监听IPv4)这个实际上是Go语言的一个bug吧,去google上也能搜到很多同样的问题。在Go语言解决之前,难道不是只能靠开发者来解决吗。
@fatedier commented on GitHub (Jun 22, 2018):
请贴出你搜索到的原文或代码注释或相关资料?
@qakcn commented on GitHub (Jun 22, 2018):
对不起,我的错,
0.0.0.0和[::]在net.Listen里是一样的,虽然netstat里没有0.0.0.0,但是::是通过IPv4-mapped IPv6 addresses同时监听了0.0.0.0的。抱歉耽误了你的时间。
@fatedier commented on GitHub (Jun 22, 2018):
ok,所以你自己是可以解决这个问题的。然后回到最初的问题,为什么你的服务不能访问,相信你也能定位到原因的,如果确实是一个 bug,再提交新的 issue。
@hyyz17200 commented on GitHub (Oct 10, 2020):
所以我想知道到底怎么监听v4地址,难道我必须填服务器ip吗
@BisonLeo commented on GitHub (Nov 22, 2021):
https://www.cnblogs.com/kaishirenshi/p/13496475.html
/* If we have the unspecified IPv4 address (0.0.0.0) and
*/
tcp6 的端口能否通过 ipv4 访问还是要看 AP_ENABLE_V4_MAPPED 程序编译的时候是否开启了
而frp 默认肯定是开启的, 所以不是这个问题导致的.
@hzdavid commented on GitHub (Apr 9, 2024):
最终的解决方案是什么呢?
@shuguang101 commented on GitHub (May 7, 2024):
@4d4d4d4 commented on GitHub (Jun 11, 2024):
目前我也遇到了这个问题,我的frpc无法连接frps,查看只开放了tcp6由此无法通过telnet命令确认(telnet其他开放tcp端口是正常的)。再次怀疑是只开放tcp6导致的连接超时问题(版本号0.58.1) # @fatedier