I have been playing with MQTT using two Pi zero W. I have managed to transmit and receive MQTT messages using the command line and in python code using paho-mqtt. I have one Pi set up as the MQTT broker. However, what I want to do is have the two Pi be a standalone network with no other connections (there may be more Pi at a later date). So the code I have works fine as long as both the Pi are connected to my home network, but as soon as I disconnect one from the home network, they cannot talk to each other. (My initial assumption was that the MQTT broker would be handling all the wifi protocol etc). Presumably they are communicating via the home network. Is there a way to get MQTT to work without the home network? Do i somehow need to connect the two Pi to eachother first?

Thanks DirkS and scotty101. I have followed the link and one Pi is now reconfigured as an access point and I can connect to it on my pc but I am unable to ssh into it. The wifi icon on the Pi tells me "wlan0:Configured 192.168.4.1/24. Do i need to change my ssh command in some way? I am using PuTTy

AFAIK if 192.168.4.1 is the AP addy, it should also be listed as the net gateway And be listed in the DNS servers list.

once connected to pinet can you ping either the ap or any other wifi clients?

What do you intend your mqtt clients to do ? I ask as a Pi could be overkill, within my 'under test' home automation set up with a Pi-0-W host for web server mqtt and node red, i use esp826/5 devices with a public project firmware available on github 'Tasmota'

Once you get the wrinkles ironed out of your wifi connection issues you should find all you need do is point your mqtt clients at the broker by address to get started..

to select a static ip in win10 right click on your wifi/net taskbar icon and select "open network and internet settings"->"Change adaptor settings"
Then right click on the wifi icon and select properties.

Select (click on) the "Internet Protocol 4 tcp/ipv4" so it is highlighted, and then click on the properties button below.it to get to where you can set a static addy.. set the gateway and dns to your pinet AP address and use 255.255.255.0 as a submask

PhatFil yes your right, a Pi is over kill but as I have 2 its ok to prove concept. The comms i need is very simple, just a server unit that sends a signal to the clients to start a function and the clients to send back a signal once complete. So esp8266/esp32 or similar would do. Ideal end state will be mobile phone as the server/master and simple microcontroller as the clients. But thats a long way away

I have selected a static IP address as per

to select a static ip in win10 right click on your wifi/net taskbar icon and select "open network and internet settings"->"Change adaptor settings"
Then right click on the wifi icon and select properties.

Select (click on) the "Internet Protocol 4 tcp/ipv4" so it is highlighted, and then click on the properties button below.it to get to where you can set a static addy.. set the gateway and dns to your pinet AP address and use 255.255.255.0 as a submask

I can now ssh into the Pi, but presumably need to do something to fix what I have done manually?

PhatFil yes your right, a Pi is over kill but as I have 2 its ok to prove concept. The comms i need is very simple, just a server unit that sends a signal to the clients to start a function and the clients to send back a signal once complete. So esp8266/esp32 or similar would do. Ideal end state will be mobile phone as the server/master and simple microcontroller as the clients. But thats a long way away

I have selected a static IP address as per

to select a static ip in win10 right click on your wifi/net taskbar icon and select "open network and internet settings"->"Change adaptor settings"
Then right click on the wifi icon and select properties.

Select (click on) the "Internet Protocol 4 tcp/ipv4" so it is highlighted, and then click on the properties button below.it to get to where you can set a static addy.. set the gateway and dns to your pinet AP address and use 255.255.255.0 as a submask

I can now ssh into the Pi, but presumably need to do something to fix what I have done manually?

well if your 'PiNet' is limited to 2x devices and your going to add to it 1 device at a time? whats wrong with running with static ip addys??

But if you want to get the slate clean its smelling very much like a dhcp server failure as suggested above,

im fairly sure systemd is used to manage dhcp as a service, https://www.raspberrypi.org/documentati ... systemd.md
so the systemctl command should give you a current status report on services running or halted. Any information gleaned from that regarding dhcp will indicate at what or where to look next, .- probably a typo somewhere generally is this end..

Ok Thanks. I am slowly making progress I think. I checked through everything but could not see anything wrong. Since then I have reinstalled Raspian several times and tried various other ways to set up an AP. All with not positive result. On the last attempt I again started from a clear install and followed the original instruction (from SurferTim's github rather than original link - basically the same thing) . I now seem to have an AP on some occasions ! Most of the time I am using a keyboard and mouse connected to the USB port via an adaptor and if these are connected the new network exists, but if I boot the pi with the usb adaptor disconnected, the new network does not exist.

Part of the process to set up the new network changes settings for eth0

Add a masquerade for outbound traffic on eth0:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Eth0 doesn't exist as a standalone port on the PI zero, but there is an RJ45 connector on the usb adaptor so i am presuming this is having some effect. Any ideas?