I've been searching high and low for a simple explanation for this. What configuration settings do I use to connect my Sonoff RF bridge to the Mosquitto server on my computer? I'm sure it's a configuration issue but most of the tutorials out there are for rPi. My skill level in this is basic and I'm sure it may be obvious to someone what's wrong.
I'm running Mosquitto on Windows 10 and have verified that the Mosquitto server is running using netstat -a (I can see the broker is listening at 0.0.0.0:1883.
I've installed Tasmota Eclipse on my Sonoff RF Bridge and have verified it is receiving signal from my door sensor by opening the UI in my browser and viewing the console. I've tried multiple host addresses in the configuration menu; localhost, 0.0.0.0, 10.0.0.1, however Tasmota only seems to connect when I leave the host field blank.
I've tried to use MQTTlens to verify that the broker is receiving messages on port 1883 and nothing seems to be coming through.
0.0.0.0 is a short hand to tell mosquitto to listen on all the available interfaces on the machine it is running on. It is meaningless to use it in the client configuration.
Likewise, localhost always means the same machine that the code making the request is running on, so in this case it would be the Sonoff device it's self.
It looks like 10.0.0.1 is the address of your local router, unless mosquitto is actually running on the router (it is very unlikely your windows machine is your router) this again is not going to be useful.
You need to use the IP address of the Windows machine that mosquitto is running on, this is going to start with 10.0.0. running ipconfig on the command line in windows is probably the quickest/simplest way to find that address.
Related
I am facing this issue for a couple of days and I am unable to reproduce it outside the Ubuntu Docker container.
Please refer to this simplified diagram of my architecture:
As you can see, I have everything running inside the Docker container.
This is not the typical issue of not being able to connect to inside the container, the whole application runs on the local network of the Docker container.
The Ubuntu Image is the official one with just some packages installed so that everything works (nothing too fancy, just python3 and some c++ tools).
It is running Mosquitto 2.0.15 with the following configuration:
listener 1883
protocol mqtt
allow_anonymous true
log_dest file /home/user/mosquitto.log
So, in summary, I am running an unsecured MQTT broker in the default port 1883. I also added a log file in an attempt to debug what is going on.
On my Python Client, the connection is made in the simplest way possible:
...
self.mqtt_client = mqtt.Client(client_id="Client Id")
self.mqtt_client.connect("localhost", 1883, 6000)
...
self.mqtt_client.loop_start()
...
This Client is able to connect to the broker with no issue at all.
Subscribe and Publish works perfectly too!
On my C++ Client, I try to keep it simple as well:
...
mqtt::async_client MQTTClient("tcp://localhost:1883", "Another Client Id");
MQTTClient.connect()->wait();
...
Yet, this Client fails every attempt to connect to the broker:
terminate called after throwing an instance of 'mqtt::exception'
what(): MQTT error [-1]: TCP/TLS connect failure
Aborted (core dumped)
Although it looks like a SSL/TLS error, this is actually the generic error for when the MQTT broker is not found (If I stop the broker on my local machine I get the same error).
Checking the MQTT broker logs (verbose ON), it does not record anything regarding the attempt to connect from C++ Client:
1672874968: mosquitto version 2.0.15 starting
1672874968: Config loaded from /etc/mosquitto/conf.d/default.conf.
1672874968: Opening ipv4 listen socket on port 1883.
1672874968: mosquitto version 2.0.15 running
(I do get log messages when connecting with Python Client)
On my own Linux machine I am unable to reproduce this issue. Both clients work fine.
I am using the same configuration for the Mosquitto broker and the Clients are exactly the same.
Already tried to play with the IP used to connect to the broker (localhost/127.0.0.1/0.0.0.0) and using different ports, the result is the same.
It is weird that the Python Client can connect with no issue at all.
At this point, I am fairly confident that the issue must be something Docker-specific and how it handles TCP sockets. But I am unable to find anything helpful online.
I can easily check that the port is open:
lsof -i -P -n | grep :1883
mosquitto 56 user 5u IPv4 1633274841 0t0 TCP 127.0.0.1:1883 (LISTEN)
Any ideas what is going on? Or debug tools ideas?
Thanks in advance!
I have tried:
Playing with IP and port of the broker;
Stating the preferable MQTT version (tried with every version);
Run Client with strace and try to find something unusual;
Verify if I am running the exact same Client as my Linux machine;
I finally found out what my issue was.
I had a HTTP proxy configured and Paho C will automatically use this proxy.
It is detecting by checking if "http_proxy" environment variable is set.
My solution was simply unset this variable:
unset http_proxy
Interestingly, the Python MQTT client does not have this behavior.
And for that reason, it worked perfectly!
I have a Neo4j database on my desktop computer that I would like to access remotely. I'm not very knowledgeable about servers/networking, but here's a list of things I've done to try to get it working:
Uncommented the dbms.connectors.default_listen_address=0.0.0.0 line in the settings, as well as dbms.connector.http.listen_address=:7474 and dbms.connector.https.listen_address=:7473
Set up a TCP/UDP port forward on my router mapping 30408 to 7473.
Reserved a static IP for my desktop (the same one that appears in the port forward).
Defined incoming firewall exceptions on my desktop for ports 7474, 7473, and 30408 for both TCP and UDP (I'm guessing the 30408 one doesn't matter, but I've been trying everything).
When I try to connect through Chrome with {public_ip}:30408, it gives ERR_EMPTY_RESPONSE (Firefox just says "The connection was reset").
I am able to successfully connect to the neo4j browser on my local network with {local_ip}:7474.
Edit: Should I look into trying to do this with SSH? I still don't know what is going wrong in the first place.
I've developed a Grails application and I want my coworkers to be able to test it. They are on my network so I figure they can access it by using my IP address and the port number (8080). I've tried running it according to the steps laid out here and here to no avail.
I noticed that whenever I run the program, even when I follow those instructions, it says:
Grails application running at http://localhost:8080 in environment: development
Basic networking stuff here.
When something starts on interface 127.0.0.1 port something
Usually that port is then available for all the interfaces on the machine
if you run netstat -plant you will see running ports open on the machine.
Basically what ever ipconfig or ifconfig tells under Linux as your internal interface something like 192.168.1.x
The app is then available on http://192.168.1.x:8080
If you can't access it from other machines on network start by trying to ping {your machine ip}
It sounds like network security stopping local access from 1 machine accessing another.
Or even better still your good old MS firewall try stopping your security stuff on your desktop
It's not clear if you can access the app yourself on your own machine? It should be available at:
http://localhost:8080/appname
Your co-workers should be able to access the app by changing localhost to your computer name:
http://mycomputername:8080/appname
For the first time since upgrading to OSX Yosemite, I need to view an app running on my machine from another machine on the same network. Previously, this was as simple as finding my internal IP address and using that with port 3000, eg. http://192.168.0.111:3000.
However, I am now finding that with Yosemite this doesn't work. The application is definitely running and is available via localhost:3000 but not via my internal IP.
I have run the network utility port scanner and it shows that localhost exposes port 3000 but my IP doesn't. Other machines on the network that have yet to upgrade (10.7.5 and 10.9.5) are not having this issue.
Any help would be greatly appreciated.
Edit: According to the security and privacy pane of the system preferences, the Yosemite firewall is currently off - so that isn't causing the problem.
By default, rails server will only accept connections from localhost. You can check this by looking at the console output:
Listening on localhost:3000, CTRL+C to stop
To listen on all addresses, which will allow you to connect from other machines on the local network, you must explicitly bind to a more permissive address. Try this:
rails server --binding=0.0.0.0
You should now see:
Listening on 0.0.0.0:3000, CTRL+C to stop
Now you can connect to your Rails app from elsewhere on your local network, by browsing to e.g. http://192.168.0.111:3000.
I'm developing an MQTT based application using HiveMQ, an enterprise broker. I installed it as per the instructions here- http://www.hivemq.com/docs/hivemq/2.0.1/
When I run it using ./bin/run.sh, the server connection is immediately closed due to the error - Could not bind to all interfaces and port 1883, because it is already in use. Stopping HiveMQ
As far as I'm aware, nothing else is using this port. This happens even when I restart my computer and nothing else is running. I'm running in root mode.
Why am I getting this error?
To check if something is already running on the port, please type the following into the terminal if you happen to run a Linux / BSD / OSX:
netstat -an|grep 1883
If you're running a Windows System, type the following:
netstat -an|find "1883"
After running that command you should see which application is using port 1883.
Alternatively you could edit the configuration.properties file in you conf folder of the HiveMQ installation and set the global.port property to a port of your choice.
From those results, do you have d-bus daemon installed? I don't know much about d-bus, but have you tried disabling it or modifying the config and then see if you can restart hivemq on port 1883.