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?
Related
Protocol: mqtt
Version: 3.1.1
Gateway model: CloudGate Ethernet CG0102
I'm publishing json message from my gateway which is connected to an open source Emqx broker (broker.emqx.io) port 1883 for a test. I tried to consume the messages by connecting to it with MQTTX by giving the following informations: Name, Client_ID, Host, Port, Username and Password, and then giving my topic which is my_topic.
The problem is nothing appear in my MQTTX while the given broker informations are good and similar to those in my gateway. Why ?
Also I would like in the future to use my own mqtt broker mounted on my laptop ? Any simple references where I could start to make such thing ? I already use mqtt to consume messages with python from remote broker but never try to build one to receive messages from my remote gateway.
I'm working on a ubuntu bionic VM
Client_ID needs to be unique for every client, so you can not reuse Client_ID between clients.
The MQTT spec says that the broker should kick the oldest client off when a new client connects with the same Client_ID. This normally leads to a fight between the 2 clients as they both try and reconnect kicking each other off.
I hosted Mosquitto MQTT broker on Ubuntu in Digital Ocean Cloud droplet. It's domain name is instrux.live and IP of the domain is 192.34.63.138. I publish and subscribe messages from two terminal windows and it worked fine.
When I tried to connect it with the android using Paho MQTT android client it could not connect. I also checked its connection with the MyMQTT android application and it did not connect. After making sure the android code has not any error, I again checked its connection with the Eclipse Paho Javascript client on eclipse.org website and it did not connect. Now, I have realized there might be something missing or wrong in my broker configuration which is not allowing it to get connected with other clients remotely. I have also opened firewall for ports 1883 for Android client and 8083 for the Javascript client and still it is not connecting.Here is mosquitto configuration file:
allow_anonymous true
password_file /etc/mosquitto/passwd
listener 1883
protocol mqtt
listener 8083
protocol websockets
Since the error is "Connection Refused" rather than a timeout I suspect that you have not configured the firewall to allow inbound traffic on port 8083.
You may need to do this both on the machine it's self and in Digital Ocean's console.
I currently have a Firebird 2.5 database at a client premises, installed on a Windows 7 Pro machine (32 bit), that has multiple stations in their local network that can connect to the database, along with the local machine being able to connect with our application and IBExpert.
However, for some of our software packages, a remote connection is required (outside of the local network). This previously was working but no longer works.
When I connect with FlameRobin from my office (I'm located in a different city / different network), I receive the following error message:
IBPP::SQLException
Context: Database::Connect
Message: isc_attach_database failed
SQL Message: -923
Connection not established
Engine Code : 335544421
Engine Message :
connection rejected by remote interface.
Performing this connection attempt with IBExpert, both from my office and from other external networks fail with a same message.
However, I am getting TCP/IP communication from what I can see. Here are the details of my troubleshooting steps for the last week:
Originally, I was receiving the following error when connecting from outside the network:
"Connection not established
Connection refused by remote interface"
Since that time, we have done a restart of the router and now have the current "connection rejected by remote interface." error message.
I can telnet to the public IP through port 3050 from my office and other outside networks.
I tested port 3050 on sites like YouGetSignal.com or CanYouSeeMe.org and they appear as open.
Other ports that we communicate on publicly are open and communicating.
The site has Kaspersky antivirus installed but all tests to connect via IBExpert while Kaspersky was in sleep mode behaved the same.
Installation of Firebird 2.5 to another workstation in the same local network, pointing to port 3051 (both in Firebird.conf and in the Windows Firewall and Router) show up as being open through Telnet and CanYouSeeMe.org but again, cannot be communicated on from outside via port 3051.
IBExpert works from a workstation in the network to the server
The server currently has no entry for RemoteBindAddress in the Firebird.conf
Wireshark shows that when a connecting from outside, there are packets coming through.
The TCP/IP test in IBexpert under Communication Diagnostics for the public IP as the host and the Service show the following Test Results:
Attempt connecting to XX.YY.ZZ.AAA.
Socket for connection obtained.
Found service 'GDS_DB' at port '3050'
Connection established to host 'XX.YY.ZZ.AAA',
on port 3050.
TCP/IP Communication Test Passed!
Database path, username, and password have all been checked multiple times.
locally on the server, I've changed security of the database.FDB and the security2.FDB to have Everyone, Full Control
At this point, we have a scheduled restart of the ISP's modem happening soon, although the fact that we have full TCP/IP communication over the port makes me doubtful that this is the issue.
If anyone can lead me down any recommended next steps to debug or to any tools that are available to help in this situation, that would be greatly appreciated.
This turns out to be a networking issue. We performed the following tests:
We performed a power cycle on the ISP's modem which showed no change in behavior
We connected a laptop directly to the ISP's modem but couldn't communicate to FB even with proper port forwarding rules in place on the machine and firewall.
We ran wireshark on both sides and on connection attempts, we found many attempts to connect with retransmissions that failed.
The technical team at the client side decided to install a VPN capable router and now we're good to go. From what we found there may be some kind of ISP blocking occurring as many of the tech teams remote services were failing to connect with similar behavior.
Hopefully this post helps people in the future with remote connectivity debugging, and all of the places you can look at when you're running into this problem.
I am working on an embedded linux based device that runs ubuntu. Now the device driver for the wifi is really crappy so I cannot create a hotspot so this device connects to another device which is running a hotspot. Now I am connecting to that device for some input but at the same time connecting to internet to send mqtt message using paho mqtt in python via a gsm modem. The modem connect to internet using pon command and it works nicely. But when both connections are running, paho-mqtt cannot connect to internet anymore. pinging using -I ppp0 works fine. I tried to bind ppp0 ip address to paho-mqtt client using the bind_address argument but it does not work. How to resolve this issue?
I have a Ubuntu Server 14.04 running on an Azure machine. I have installed MQTT broker on this Ubuntu Server. Moreover, I have multiple ESP8266 devices that are assumed to subscribe and publish to different MQTT topics via this broker. Now my problem is that when I connect two devices to Broker, one for receiving data and other for publishing, they work fine but as I try to connect one more device to broker all devices stop working and my ESPs just display this message "trying to connect Broker" over and over again.
(In endpoints of my machine I've added 1883 for HTTP, 443 for HTTPS and 22 for SSH)
My question is how I can allow multiple devices to communicate with MQTT broker running on Azure broker?
All client devices needs to have unique client ids. The situation you have described sounds exactly like what happens if all your esp8266 devices have the same hardcoded client id
MQTT clients get clientID as parameter before connection to provide uniqueness. ESP8266's has unique ChipID. So use it to hit the issue.
Here the example for Arduino firmware :
WiFiClient wifiClient;
PubSubClient mqttClient(wifiClient);
mqttClient.setServer(MQTT_BROKER, MQTT_BROKER_PORT);
String clientId = "IoTDevice-" + String(ESP.getChipId());
mqttClient.connect(clientId.c_str(), MQTT_USERNAME, MQTT_KEY);
Here is NodeMCU firmware example :
mqtt_cli:connect(MQTT_BROKER, MQTT_BROKER_PORT, 0, CALLBACK_FN);
mqtt_cli = mqtt.Client("IoTDevice-"..node.chipid(), 120, MQTT_USERNAME, MQTT_KEY);