Wednesday, March 8, 2023

Nginx to overcome Google WiFi limitations

Just recently I had to replace my old Wifi-Setup with a new system. After some investigation on the topic (and a good offer from amazon warehouse) I decided to give Google Wifi with 3 physical items a try.

I do have a lot of devices in my network that are accessible from the outside, so I set them all to bridged mode, so that they use another DHCP server in the network and use that address pool. Initially it all seemed fine, all my devices where able to keep their IP adresses and worked as before.

However, after some days I got a lot of connection issues, because it is not mesh in that way, so there was no handover between the wifi networks and especially in the areas between two of them I had frequent network switches which was quite annoying.

After a factory reset I set them up as mesh network and forwarded all the necessary traffic from the Internet gateway to the main Google Wifi IP. Devices got new IP addresses from a different pool now, but the network was working fine.

As initially said, I have devices that are visible from the outside (e.g. Home automation, NAS,...) which had set static IP addresses for simplicity. This is a problem currently for the Google Home App, which is used to setup the network, because it does show only devices that have IP addresses assigned by its DHCP. Even if the static IP is in the range of the subnet mask it will not show up.

What next? Most devices, like my Synology NAS is able to obtain an Address from the DHCP, which means that I had to assign a static address inside the Google Home App for that device to be able to access it reliably form outside.

However, some of my devices are not enabled for DHCP and then you're screwed, unless you have another device in the network that can do the job. In my case I use the Synology NAS which already runs a nginx which can be setup to forward traffic to other IPs. Its a bit tricky, but here is how it works:

  1. Install the Web-package on the NAS to have nginx in place
  2. enable (temporarily) SSH to be able to change the configuration files
  3. SSH into your NAS (you need to be. member of the admin group)
  4. cd /usr/syno/share/nginx/ (thanks to John Shine)
  5. create a new file named as you like with .mustache suffix and refer that file from the nginx.mustache file in this folder.
Now, in my case I did need random TCP traffic, so I had to refer my file outside the http block and I decided to add the reference as the very last line in the configuration. My mustache file than contains something like this

stream { upstream mytcpstream { server X.X.X.X:4321; } server { listen 1234; proxy_pass mytcpstream; } }

Now all that's left is to setup the firewall of the NAS accordingly and give it a try.

That's far from ideal I admit, but that said... PLEASE Google, add a possibility to add a random Port forward to your Home App, or show all devices in the network, not just the ones that your DHCP assigned. THANKS

No comments:

Post a Comment

Golang setup PATH

Quite recently we startet in the company to use and write some Go programs. I love Go. It's easy to learn, read and modify. One of the m...