frp在ubuntu下无法使用,如何排错寻找问题?

发布于 2022-09-07 21:00:08 字数 5008 浏览 16 评论 0

问题描述

尝试在ubuntu下搭建frp服务器,软件启动没有报错,连接的时候出错连不上。

环境参数

  • 系统平台:aliyun ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-117-generic x86_64)
  • frp版本:frp_0.20.0_linux_amd64
  • 安全组策略:开放所有端口
  • oneinstack部署了nginx,并利用其脚本生成了一个https协议的vhost,用于跑主web服务

相关配置

* 为占位符

frps.ini

[common]
bind_addr = 127.0.0.1
bind_port = 7000
vhost_http_port = 9000

token = frp_matrix

dashboard_port = 7500
dashboard_user = frp_admin
dashboard_pwd = frp_2018100800

frpc.ini

[common]
server_addr = 112.*.*.71
server_port = 7000
token = frp_matrix

[web]
type = http
local_port = 8500
custom_domains = frp.***.me

相关命令与信息

server

# ./frps -c frps.ini

2018/08/10 14:05:39 [I] [service.go:128] frps tcp listen on 127.0.0.1:7000
2018/08/10 14:05:39 [I] [service.go:161] http service listen on 127.0.0.1:9000
2018/08/10 14:05:39 [I] [service.go:205] Dashboard listen on 127.0.0.1:7500
2018/08/10 14:05:39 [I] [root.go:190] Start frps success
// 没有连接进来

client

$ ./frpc -c frpc.ini

2018/08/10 14:03:53 [I] [proxy_manager.go:300] proxy removed: []
2018/08/10 14:03:53 [I] [proxy_manager.go:310] proxy added: [web]
2018/08/10 14:03:53 [I] [proxy_manager.go:333] visitor removed: []
2018/08/10 14:03:53 [I] [proxy_manager.go:342] visitor added: []
2018/08/10 14:03:53 [W] [control.go:113] login to server failed: dial tcp 112.74.106.71:7000: connect: connection refused
dial tcp 112.74.106.71:7000: connect: connection refused

做过的检查

通过netstat命令查看,没有看到7000端口

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 localho:afs3-fileserver *:*                     LISTEN
tcp        0      0 *:https                 *:*                     LISTEN
tcp        0      0 localhost:8006          *:*                     LISTEN
tcp        0      0 localhost:9000          *:*                     LISTEN
tcp        0      0 *:mysql                 *:*                     LISTEN
tcp        0      0 localhost:7500          *:*                     LISTEN
tcp        0      0 *:http                  *:*                     LISTEN
tcp        0      0 *:http-alt              *:*                     LISTEN
tcp        0      0 172.18.140.9:15609      106.11.248.51:http      ESTABLISHED
tcp        0      0 172.18.140.9:ssh        220.249.22.170:60318    ESTABLISHED
udp        0      0 172.18.140.9:ntp        *:*
udp        0      0 localhost:ntp           *:*
udp        0      0 *:ntp                   *:*
udp6       0      0 [::]:ntp                [::]:*

做过的改进工作

听从群友给出换端口的建议,改为8000后,确实可以看到了端口了,但依旧连不上

server

# ./frps -c frps.ini

2018/08/10 14:29:49 [I] [service.go:128] frps tcp listen on 127.0.0.1:8000
2018/08/10 14:29:49 [I] [service.go:161] http service listen on 127.0.0.1:9000
2018/08/10 14:29:49 [I] [service.go:205] Dashboard listen on 127.0.0.1:7500
2018/08/10 14:29:49 [I] [root.go:190] Start frps success

client

$ ./frpc -c frpc.ini
2018/08/10 14:30:07 [I] [proxy_manager.go:300] proxy removed: []
2018/08/10 14:30:07 [I] [proxy_manager.go:310] proxy added: [web]
2018/08/10 14:30:07 [I] [proxy_manager.go:333] visitor removed: []
2018/08/10 14:30:07 [I] [proxy_manager.go:342] visitor added: []
2018/08/10 14:30:07 [W] [control.go:113] login to server failed: dial tcp 112.74.106.71:8000: connect: connection refused
dial tcp 112.74.106.71:8000: connect: connection refused

netstat

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:https                 *:*                     LISTEN
tcp        0      0 localhost:8000          *:*                     LISTEN
tcp        0      0 localhost:8006          *:*                     LISTEN
tcp        0      0 localhost:9000          *:*                     LISTEN
tcp        0      0 *:mysql                 *:*                     LISTEN
tcp        0      0 localhost:7500          *:*                     LISTEN
tcp        0      0 *:http                  *:*                     LISTEN
tcp        0      0 *:http-alt              *:*                     LISTEN
tcp        0      0 172.18.140.9:15609      106.11.248.51:http      ESTABLISHED
tcp        0      0 172.18.140.9:ssh        220.249.22.170:60318    ESTABLISHED
udp        0      0 172.18.140.9:ntp        *:*
udp        0      0 localhost:ntp           *:*
udp        0      0 *:ntp                   *:*
udp6       0      0 [::]:ntp                [::]:*

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顾忌 2022-09-14 21:00:08

系统原因,重装阿里云系统后重新安装就好了

桜花祭 2022-09-14 21:00:08

删除frps.ini 里的bind_addr = 127.0.0.1这个配置

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文