0

I'm working on IoT project and trying to use mqtt protocol. So I need a Mqtt broker as a server installed on my PC. My PC has static ip and special modem. So my local and general ip is lookin same.

I installed mosquitto firstly. Tested it with Mqttlens chrome app, it looks everything is fine when I test it on the same computer (which is the computer on which broker is installed). But when I try to publish a message from another device with different ip, I can't connect to broker.

I installed Hivemq and tried it for this broker too. And it is the same so I can connect broker when I open mqttlens in same computer, but I can't connect to my broker from other device.

And here is what I already tried and tested;

I downloaded My MQTT application to my android mobile phone. And connected to hivemq broker with broker.hivemq.com url. In the same time in different two pc's I connected to the broker with mqttlens app. I set up the tags. And everything is working, I can send messages and subscribing topics. Everything is working well. I tried it when that third device in the same lan and when using different networks. Both time, everything is fine.

But when I try the same thing by writing the my ip address to the mqtt lens and MyMQTT application. Other devices even can't connect to broker. There are no error messages or anything else. Just disconnected and can't connect.

I tried to change bind address with my ip address. But when I write 0.0.0.0 or my ip address, result is same I couldn't connect.

Any suggestions?

Natalie Hedström
  • 2,607
  • 3
  • 25
  • 36
Fym
  • 131
  • 1
  • 2
  • 5
  • Note:I checked the port of broker by command netstat -an, its looking listening. So its ok. – Fym Feb 07 '16 at 02:14
  • This is most likely a firewall or router configuration problem. You imply that you have the router in DMZ mode, does it have any firewall settings? – hardillb Feb 07 '16 at 11:59
  • Also this question would be better asked on SuperUser rather than StackOverflow as it is a configuration issue, not a programming problem. It also needs a better description of you network setup – hardillb Feb 07 '16 at 12:02
  • I am university student. And connecting universitie's network with ethernet. IT gave me a static ip after registered my pc with mac adress to the database. So now when I check the ip adress from my adapter settings and when I chack my ip from whatsmyip service. Bot are same. So I think that means I have no local ip, someway router is connecting me to internet directly without any local ip. There are no firewall or antivirus app installed on my pc. And to make some tests I downloaded connectify and connected my phone to my hotspot to make them in the same network. But result was same. – Fym Feb 07 '16 at 12:20
  • So is this problem because of router? How can I fix it? Should I buy my own modem? – Fym Feb 07 '16 at 12:22
  • Double check you really don't have a firewall running. – hardillb Feb 07 '16 at 17:22

0 Answers0