emqx / emqx-coap

EMQX CoAP Gateway
https://www.emqx.com
Apache License 2.0
61 stars 34 forks source link

Coap-client Request timeout problem #166

Closed JoshRong closed 4 years ago

JoshRong commented 4 years ago

EMQ version:v4.1.0-alpha.1 openssl:1.1.1d libcoap:v4.3.0-alpha

When I run coap-client -m put -e 1234 "coap://127.0.0.1/mqtt/topic1?c=client1&u=tom&p=secret" command,The coap Messages can be published。 But when I replace 127.0.0.1 with my public address。The request will be unresponsive。I think it should be overtime。 I have two machines, one with EMQ and the other with libcoap and EMQ。But It still doesn't work。There are no printing related errors in the log。 It doesn't seem to have happened before when using version 4.0.2。

I hope it can be solved. Thank you

HJianBo commented 4 years ago

The v4.1-alpha.1 of emqx-coap is not any different for v4.0.2.

Have you checked your network reachable and firewall rules?

JoshRong commented 4 years ago

Yes, I‘m sure。And

------------------ 原始邮件 ------------------ 发件人: "JianBo He"<notifications@github.com>; 发送时间: 2020年4月2日(星期四) 中午1:46 收件人: "emqx/emqx-coap"<emqx-coap@noreply.github.com>; 抄送: "长毛的小黄瓜"<525732224@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [emqx/emqx-coap] Coap-client Request timeout problem (#166)

的v4.1-alpha.1与v4.0.2 emqx-coap并无任何不同。

您能否确定网络可访问性和防火墙规则?

— 您收到此消息是因为您创建了线程。 直接回复此电子邮件,在GitHub上查看,或取消订阅。

qingchuwudi commented 4 years ago

Thanks for your feedback, please use version 4.1.0-alpha.2. I have test with 4.1.0-alpha.2 and everything is ok.

JoshRong commented 4 years ago

我在使用了4.1.0-alpha.2 后发现问题依然存在。

(这是B的EMQ版本)

依然是两台服务器 不同的公网。使用A对B进行coap请求时会有延迟

(这是A的libcoap工具版本)

我是用了nc工具也保证了5683端口的连通性

(A向B nc连接)

我这里还可以提供抓包的文件在附件

(这也是我抓包的命令)

望能找出问题,如果是我的问题,我会解决问题并表示感谢

------------------ 原始邮件 ------------------ 发件人: "qingchuwudi"<notifications@github.com>; 发送时间: 2020年4月15日(星期三) 晚上6:18 收件人: "emqx/emqx-coap"<emqx-coap@noreply.github.com>; 抄送: "长毛的小黄瓜"<525732224@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [emqx/emqx-coap] Coap-client Request timeout problem (#166)

Thanks for your feedback, please use version 4.1.0-alpha.2. I have test with 4.1.0-alpha.2 and everything is ok.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

qingchuwudi commented 4 years ago

我找了两台公网机器完全按照你的流程跑了一遍,都是通的,初步判断不是emqx的问题。

根据你发过来的抓包信息和现象,目前判断是机器上面的防火墙开了。

原因如下:

根据经验判断,大概率是第一种情况,所以麻烦再次检查下防火墙,确保防火墙关闭或者有相应的通行规则:

##CentOS
sudo service   iptables stop
sudo systemctl stop firewalld

##Debian/Ubuntu
sudo service ufw stop

如果是云主机,检查下云平台的安全组策略,确认UDP端口5683和5684已经开放

如果防火墙没问题,再次测试依然没有数据交互的话,麻烦再提供一下emqx的日志和tcpdump抓包信息。