NextCloudPi, how to set up DDNS url to work within LAN

, ,

I have a NextCloudPi server at my house. I have an No-IP address for DDNS access from outside the LAN. The external address works (I can access the server through a browser on my phone, and I can make a NextCloud client account on my Mac that works from outside.)

I have set up my Mac with an /etc/hosts entry for the external address, and that works: I can use the external address within the LAN, both in the client and for browser access. It does not work on my phone or a second Mac that doesn’t have the hosts entry: the browser waits for a minute or so and then responds “Safari can’t open the page (url) because the server where this page is located isn’t responding” or something slightly less helpful in DuckDuckGo on the phone.

(caveat: I haven’t yet tried using the external address from the Mac with the hosts entry from outside the LAN: I can imagine that the hosts entry messes that up, but I don’t know yet.)

I would like to set up the router and the NextCloudPi so that they handle this loopback. That way, I won’t have to fiddle with /etc/hosts on each machine in the LAN that needs to do this.

I feel like I’ve tried a dozen different things over the last month and none of them have worked: fiddle around with dnsmasq on the server, set up a virtual server on the router, … The admin page for dnsmasq says “Remember to point your PC and devices DNS or
your router DNS to your NCP IP” but I don’t know how to do that.

The router is a bit older, a Tp-Link Archer C7, but it has built in support for No-IP, and that all seems to work. Its documentation for NAT forwarding is not helpful.

1 Like

This way over DNS is the right way to go to make it work on all devices:

You went the right way. If the dnsmasq is running on the server, you have to check the router settings, the DHCP section, the DHCP on the router promotes one or several DNS servers/resolvers. Often it is the ip of the router itself, or one of your provider. This one you have to change to your dnsmasq server’s ip.

Some open router software (OpenWRT) already integrate dnsmasq or similar services. Not sure if your router can work with such a firmware. By the way, a nice open source router: Turris Omnia - Wikipedia (they based their firmware on openwrt).

1 Like

Thanks tflidd. Still a work in progress. I tried the easiest thing with the router (to put the NextCloud server address as primary DNS on the DHCP page) but that made the router stop working. Am taking a break for now, will come back if I make any progress.

Thanks again. I’ve made some discoveries: (1) dnsmasq was not in fact running on the NextcloudPi server. The reason is that it wants to listen on port :53, and that port was already in use. (2) Who was using it? Armbian (what Nextcloudpi runs on) and Ubuntu have systemd-resolved take that port, for TCP and UDP.

I’ve found a guide to getting systemd-resolved off of port :53, and that’s the next thing to try.

https://www.linuxuprising.com/2020/07/ubuntu-how-to-free-up-port-53-used-by.html

I don’t know what effect this might have on the *ian system.

Got it, finally. Followed this guide:

https://computingforgeeks.com/install-and-configure-dnsmasq-on-ubuntu/

to disconnect systemd-resolved and to configure and start dnsmasq.

My router is an Archer C7. The DHCP page has entries for the “Default Gateway” and the “Primary DNS” and “Secondary DNS”. I tried changing the “Default Gateway” to point to the NextcloudPi server; that failed (every attempt to get an external address timed out). I restored what was there (the local address of the router, 192.168.0.1), and put the address of the NextCloudPi in the “Primary DNS” slot.

That worked. 3 of 4 machines (2 Macs and a phone) are using the external address within the LAN (the phone client works even with wifi turned off, so it’s going through the cell network). Oddly, on the the last machine, a RaspberryPi 5 desktop, I couldn’t recreate the NextCloud Client account using the external address (it timed out and failed). But this one doesn’t matter to me since it will always be inside the LAN.

Again, thanks immensely. I hope this thread helps someone: this dance with systemd-resolved has to be done before NextcloudPi can be accessible using an external address using dnsmasq, since systemd-resolved has to be disabled in order for dnsmasq to work.

Here’s Pi-Hole’s advice about an Archer C7: How to use Pi-Hole DNS Server on TP-Link routers

That’s what I finally did, and it worked.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.