Page 2 of 2

Re: MQTT PUB AND SUB

Posted: Thu Aug 24, 2017 12:20 pm
by DougieLawson
You are not describing you problem in enough detail.

Re: MQTT PUB AND SUB

Posted: Thu Aug 24, 2017 12:58 pm
by pieuser
my problem is my ip and my etho ip what i have saved in /etc/network/interface not same . what ever i saved or changed in that file no effect on pi ip address. its not saved . i think that may be a problem ,is this ?

Re: MQTT PUB AND SUB

Posted: Thu Aug 24, 2017 1:42 pm
by DougieLawson
Restore everything in /etc/network/interfaces to exactly how it was when you installed Raspbian.

Do all the stuff for IP addresses in /etc/dhcpcd.conf

Re: MQTT PUB AND SUB

Posted: Fri Aug 25, 2017 6:43 am
by pieuser
i do the same in two files but no network connection in pi. even eth-0 shows connect but no internet connection and saved ip also different.

Re: MQTT PUB AND SUB

Posted: Sat Aug 26, 2017 2:07 am
by DougieLawson
Try starting from scratch with a fresh download of Raspbian.

At each step when you change something a) make a note of what you've changed, b) save backups of every file in /etc that you change, c) reboot and test after every change.

If anything fails take a step back and see if you can understand/fix what went wrong or try a different configuration change.

Re: MQTT PUB AND SUB

Posted: Mon Aug 28, 2017 11:59 am
by pieuser
hey dougie,
i have one question is mosquitto installed at 192.168.3.14.

Re: MQTT PUB AND SUB

Posted: Mon Aug 28, 2017 12:54 pm
by DougieLawson
Your machine, you have to look.

192.168.any.any addresses are always private. I'll always use 192.168.3.14 as an example address for a Raspberry Pi (π ~= 3.14) as that address block is unlikely to be used by anyone.

Re: MQTT PUB AND SUB

Posted: Mon Aug 28, 2017 1:10 pm
by pieuser
is it needed to install mqtt at both sides.

Re: MQTT PUB AND SUB

Posted: Mon Aug 28, 2017 1:12 pm
by DougieLawson
pieuser wrote:
Mon Aug 28, 2017 1:10 pm
is it needed to install mqtt at both sides.
No. You only need one broker unless you're planning to run a bridges between brokers.
If the broker is listening on the INADDR_ANY (or in6addr_any) interface then any other machine on your LAN can connect to it.

Re: MQTT PUB AND SUB

Posted: Mon Aug 28, 2017 1:17 pm
by pieuser
no i want to send data from my pi to other network. i have installed mosquitto in pi. if i want to send data from my pi to other network should i need to install mosquitto to that network also.

Re: MQTT PUB AND SUB

Posted: Mon Aug 28, 2017 5:50 pm
by DougieLawson
NO!
Open port 1883 on this machine/router so that your other machine can connect to it.

Or run the broker on the other machine with port 1883 open on the machine/router over there so your local machine can connect to it.

You can even run port 1883 over an ssh tunnel.
http://diabolicalws.blogspot.co.uk/2012 ... r-ssh.html

Re: MQTT PUB AND SUB

Posted: Wed Aug 30, 2017 6:12 am
by pieuser
i open the port 1883 , start the mosquitto . do u have any mosquitto broker installed at ur side now so i can connect to it.

Re: MQTT PUB AND SUB

Posted: Wed Aug 30, 2017 8:43 pm
by DougieLawson
http://test.mosquitto.org/ hosts a Mosquitto server at: test.mosquitto.org:1883

To drink from the firehose from there run mosquitto_sub -h test.mosquitto.org -t "#" -v