MQTT Out still connecting to Thingsboard

My goal is to send data to Thingsboard with the device name “A.” However, when I deploy the Node Mqtt Out status, it always says connecting. I have confirmed that the device token is correct, the server is the IP of the MQTT Broker, and I am using port 1883. The problem is that it always says connecting, but when I send it to Thingsboard Cloud, the status is connected. How can I fix this?

Welcome to the forum @adysaputra.

Doesn't MQTT use port 1883?

Oh yes, Sorry I mean port 1883

So if you open the MQTT OUT node what do you see?

(Screen shot)

From where Node-RED is running (not the browser, but where Node-RED is installed), can you ping the on-prem server? Can you use something like MQTT Explorer or Moquitto command-line tools mosquitto_pub/mosquitto_sub to check connectivity?

Does a simple 'back-to-back' test using your local broker work?

[{"id":"4558364fe9cbbfe7","type":"tab","label":"Simple MQTT test","disabled":false,"info":"","env":[]},{"id":"2e71707328dac480","type":"mqtt in","z":"4558364fe9cbbfe7","name":"","topic":"test","qos":"2","datatype":"auto-detect","broker":"bfab6cb6c0d14073","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":240,"wires":[["2ed55d26c885245e"]]},{"id":"9d2e8fd62b0e1695","type":"mqtt out","z":"4558364fe9cbbfe7","name":"","topic":"test","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"bfab6cb6c0d14073","x":370,"y":160,"wires":[]},{"id":"5aa5b294df8c96c0","type":"inject","z":"4558364fe9cbbfe7","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello World","payloadType":"str","x":210,"y":160,"wires":[["9d2e8fd62b0e1695"]]},{"id":"2ed55d26c885245e","type":"debug","z":"4558364fe9cbbfe7","name":"debug 3515","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":390,"y":240,"wires":[]},{"id":"bfab6cb6c0d14073","type":"mqtt-broker","name":"","broker":"127.0.0.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

I Try use Mosquitto Explorer and Disconnected

Unfortunately, we are not mind readers :wink:

I Try use Mosquitto Explorer

You tried where? on which machine?

Disconnected

What disconnected/how/what did you see? Details please otherwise it is impossible to help!

Sorry, I Try MQTT Explorer in my computer and i set server to my thingsboard server. And status is disconnected

Is this the same computer where Node-RED is installed (not where you access Node-RED from in the browser) (they can be different computers)

If the answer is yes, then you have your answer!

If MQTT Explorer cannot connect that it is not a node-red problem, it is a problem with thingsboard server, or the access to it.

My Node-Red is running on an on-premise server, and I don't have access to the virtual machine running Node-Red. So I tried to establish MQTT communication from my personal laptop to the Thingsboard server, which is also installed on-premise. My laptop cannot connect to Thingsboard even though it is on the same network and the Node-Red status is also connecting. I tried sending data to Thingsboard cloud and it worked. So, in your opinion, is there an error in the Thingsboard server or the configuration in Node-Red?

Thank you, I agree. However, I haven't been able to access the ThingsBoard server, so I'm asking for your opinions in case there is something wrong with my Node-Red configuration.

@adysaputra
Could you post the screenshot of the MQTT OUT node to that other server opened?

It may not be the solution, but may show something words are missing.


Ok, looking good so far.

Just below the keep alive.....

what about the use clean session?

:person_shrugging:

Sorry, just trying to get an idea of what's going on.

Another thing.....

(As asked by others)

Ok, you've hidden the IP address of the server.
(Not sure why, it is a public server.)

Go to a CLI/Terminal/(what ever) and try to ping it.

I cannot ping that IP address because ICMP communication is closed. Only TCP communication through port 1883 is open. When I telnet , the port is open but communication is not possible.

Ok, was just wondering.

I did a quick look about Pandaan.... And it is said it is NOT an MQTT BROKER.

But is more an intermediate place.

Pushes messages to an MQTT broker.

So I am not sure you are using the correct BROKER.

(Above my pay grade)

Can someone else clarify this?

Ok, from the AI part of the reply.

"Pandaan" does not refer to a known MQTT broker; instead, the term "Pandaan" likely refers to Mustang Panda, a Chinese advanced persistent threat (APT) group that has been observed using the MQTT protocol, sometimes with a custom backdoor known as MQsTTang, for Command and Control (C2) communication with compromised systems. To clarify, a standard MQTT broker is a central server in the MQTT publish-subscribe architecture that routes messages between clients, while MQsTTang is a malware component used by the Mustang Panda APT group, not a legitimate broker. 
Understanding the Distinction

    MQTT Broker (Standard):
    A legitimate server software designed to manage IoT and machine-to-machine communication. It facilitates message exchange between publishers and subscribers, ensuring data flows between devices in a decoupled manner. 

MQsTTang (Malware):
A backdoor used by the Mustang Panda APT group to establish C2 communication with infected devices. It leverages the MQTT protocol to send and receive commands and data between the malware and the attacker's server, not for general purpose IoT communication. 

Key Points: 

    Mustang Panda is a known APT group.
    MQsTTang is their specific malware that uses the MQTT protocol for C2 communication.
    When searching for "Pandaan MQTT broker," you're likely encountering discussions about this specific malware and its malicious use of MQTT, not a legitimate broker service.

I don't know how much credence to give it, but I'd be worried.

Forget about node-red and fix that first.