Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosquitto running in Synology Docker and multiple gateways in DSM enabled - not connecting to Homeassistant anymore #3205

Open
compumark opened this issue Jan 19, 2025 · 5 comments
Labels
Status: Available No one has claimed responsibility for resolving this issue.

Comments

@compumark
Copy link

I have a strange problem that involves the Synology, multiple VLANs and Docker container with Mosquitto running.

First the structure:

VLAN 1 - 192.168.1.0/24 - NAS has the 192.168.1.2
VLAN10 - 192.168.10.0/24
VLAN20 - 192.168.20.0/24
VLAN30 - 192.168.30.0/24

connected devices via LAN are in VLAN1
Mobile devices are in the VLAN10 via SSID 1
IoT Devices for Homeassistant are in VLAN20 via SSID2
Kids mobile devices are in VLAN30 with another external DNS server for secure browsing via SSID3

Docker Containers are running on the NAS
eg. Homeassistant - host network mode
MQTT Broker Server - bridge mode
Omada SDN Controller - bridge mode
Uptime Kuma - bridge mode
Plex - bridge mode

I want to connect from a VLAN30 device to the NAS - which I found that this is not working, either any of the docker services is reachable, nor the NAS itself.
I tried to ping the 192.168.1.2 and got no response - what is strange
I tried to ping any other device in the VLAN1 - which is working
I connected to the VLAN10 and I could ping the NAS and services
I connected to VLAN20 and 30 and only the NAS is not pingable

I found in DSM the advanced network setting - multiple Gateways
When I enable this, instantly the NAS was reachable from the other VLANs BUT in the sametime, the homeassistant Docker Container was unable to reach the MQTT Broker.
The IoT devices continued to send data to the MQTT Broker, but Homeassistant could not connect anymore.
Disabling the multiple Gateways, returned the HA to MQTT connection to normal operation, but killed the reachability from other VLANs.

I am out of ideas how this can be solved to be working on both sides. To my finding I would nail it down to an mosquitto issue.

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Jan 19, 2025
@Daedaluz
Copy link
Contributor

I doubt this is a mosquitto problem as mosquitto doesn't do any advanced networking itself.
Though, I have had issues with docker + multiple subnets.

how does your mosquitto config look like, and where does your homeassistant connect to mqtt?

@compumark
Copy link
Author

compumark commented Jan 20, 2025

Hi - thats my mosquitto config

persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
#allow_anonymous true
listener 1883
####autentication enabled######
allow_anonymous false
password_file /mosquitto/config/password.txt

The homeassistant connects via the MQTT Integration

Image

Once the "multiple gateways" is selscted the Homeassistant cant connect and a reconfiguration of the MQTT Integration is not possible, because of the unreachability.
But from another windows machine I can start the MQTT Explorer and can sucessfully connect to the mosquitto and see values changing, only Homeassistant cant reach it anymore.

Both Homeassistant and MQTT are running on the same Docker instance in two different containers

@Daedaluz
Copy link
Contributor

what if you use the containers IP instead of the hosts ip in HA together with this "multiple gateways" option?

this is hardly ideal, but i'm just trying to figure out where it breaks.

@Daedaluz
Copy link
Contributor

Daedaluz commented Jan 20, 2025

wait. homeassistant is running in host mode.
does localhost or 127.0.0.1 work for the mqtt connection instead of 192.168.1.2?

@compumark
Copy link
Author

Yes, that really worked with 127.0.0.1 - thanks for the hint.
Now I figured out a lot other containers have the same issue communicating with each other... I need to did there deeper, but thanks again for the hint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available No one has claimed responsibility for resolving this issue.
Projects
None yet
Development

No branches or pull requests

2 participants