I have a problem when I try to specify an area for my network in the mosquitto.conf file so that it takes the range 192.168.0.1 to 192.168.255.254 without allowing all addresses.
I tried to do:bind_address 192.168.0.1-192.168.255.254
in the mosquitto.conf file but it doesn't work. I would like to avoid using: bind_address 0.0.0.0
if possible.
Thank you for sharing your ideas.
You are misunderstanding what bind_address
does.
This option controls which single IP address that is bound to the machine running mosquitto on is used (with the exception where 0.0.0.0
means use all the local IP addresses). It is basically picking which network interface mosquitto will use to accept connections on.
There is no way to configure mosquitto to only accept incoming connections from a given range of IP addresses. If you want to do this then you should use the machine's firewall to filter connection requests from outside that range.
e.g. something like
iptables -I INPUT -p tcp -s 192.168.0.0/24 --dport 1883 -j ACCEPT