0
My Node-RED flow:
[{"id":"6c5780e.7e86f","type":"mqtt in","z":"fa8ef0ce.69a348","name":"","topic":"bs/esp8266/ldr","qos":"2","datatype":"auto","broker":"11952de3.32d7b2","x":320,"y":420,"wires":[["e5ac261a.a24058"]]},{"id":"11952de3.32d7b2","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
I have one MQTT node connected on localhost (local mosquitto server) and 4 nodes connected to HiveMQ broker. None of them can connect.
My iptables rules:
Chain INPUT (policy DROP 243 packets, 11542 bytes)
pkts bytes target prot opt in out source destination
34 1700 ACCEPT all -- lo any anywhere anywhere
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:1883
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:1883
735 80016 ACCEPT tcp -- any any anywhere anywhere tcp dpt:1880
771 55433 ACCEPT tcp -- any any anywhere anywhere tcp dpt:3000
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy DROP 156 packets, 11397 bytes)
pkts bytes target prot opt in out source destination
34 1700 ACCEPT all -- any lo anywhere anywhere
0 0 ACCEPT tcp -- any any anywhere anywhere tcp spt:1883
0 0 ACCEPT tcp -- any any anywhere anywhere tcp spt:1883
1175 2794K ACCEPT tcp -- any any anywhere anywhere tcp spt:1880
2369 6542K ACCEPT tcp -- any any anywhere anywhere tcp spt:3000
I can connect to my mosquitto server from another machine (a Windows machine with Node-RED installed), even using MQTTS and a certificate.
I was thinking maybe the problem relies on my iptables rules, but I'm not sure, and I'm a beginner in this topic. Thank you in advance.
EDIT: I could connect from my Windows machine to the broker before modifying my iptables rules. With the new ones (the ones I pasted here at first) it doesn't connect. I only used these rules before, when it still worked:
sudo iptables -A INPUT -p tcp --dport 1883--jump ACCEPT
sudo iptables -A INPUT -p tcp --dport 8883--jump ACCEPT