Accessing Nextcloud on my home network

I have installed the docker AIO Nextcloud image and have it up and running now. It works great! I am able to access Nextcloud using my DNS name when I am off of my home WiFi router. When I am on my home network and try to access my DNS name that links to my Nextcloud it doesn’t go through. I know that some network addresses have trouble looping back on themselves. Is there anyway I can be on my home WiFi and access my Nextcloud instance through my public DNS name?

BTW, I can reach other ports on my home router using my DNS name… It’s odd that I can’t hit Nextcloud locally via DNS though.

Have you defined trusted domains properly?

See GitHub - nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.

there could be multiple reasons, starting with router “rebind protection” but could be another issue e.g. missing port forwarding (for IPv6). Take a look at this discussion and specially this drawing

it describes the fastest and most stable way to implement local access using “slpit-brain” or “split-horizon” DNS.

1 Like

No, I haven’t done that yet. Where is that config file located for the AIO docker image?

@Robert-Clever on AIO you do not need to specify the trusted domains manually.

But see GitHub - nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance. in order too know how to access it locally.

The recommended way is to set up a local dns-server like a pi-hole and set up a custom dns-record for that domain that points to the internal ip-adddress of your server that runs Nextcloud AIO.

Ok, I see that link you sent. @szaimen, that’s all going over my head. Are there any instructions that you can point me to on how to set that up?

Ok, I found this tutorial online… You're running Pi-Hole wrong! Setting up your own Recursive DNS Server! - YouTube. Is this what you had mentioned that I needed to setup?

Maybe this link is good too… https://www.howtogeek.com/devops/how-to-run-your-own-dns-server-on-your-local-network/.

yeah, the dnsmasq article looks good. Two more good links for pi-hole are https://howchoo.com/pi/pi-hole-setup and Setup Local DNS A & CNAME records on PiHole | Callitkarma.me Docs

Would you recommend that I use dnsmasq or Pi-Hole to set all of this up? Seems like dnsmasq would be less taxing on system resources also seems like Pi-Hole has a bit more setup than dnsmasq.

yeah, dnsmasq looks much easier but not sure how to add custom dns entries there. pi-hole is more complicated to set up but also has much more features and an easy to use interface. setting custom entries for dnsmasq is explained in the linked article. So probabyl much easier than pi-hole anyway.

Just added them to the instructions here: GitHub - nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Sure, this is what split-horizon DNS does. You run a home DNS server that returns the LAN IP instead of the WAN IP for your server. Then you use the name regardless of location and always get the appropriate IP.

It also eliminates hairpin routing which is a network misconfiguration that many routers don’t allow.

Just add A record to your home router DNS. If using dnsmasq:
adress=/cloud.mydomain.dom/[LAN IP of your NC server, eg: 192.168.0.2]
Add
server=/8.8.8.8
server=/8.8.4.4
for supporting forward of DNS to google DNS for everything else, and tick the box for using router DNS instead of ISP enforced.

Seems like I can’t use dnsmasq to setup local access to my Nextcloud server. My Xfinity router won’t let you change the DNS server that it uses for security reasons. If that didn’t work, do you think Pi-Hole would work?

Yeah, I may be seeing this incorrectly but it seems like Pi-Hole is a replacement DNS server too. I don’t think I will be able to configure that given my routers limitations.

Indeed. However pi-hole also offers a dhcp server feature which may help to work around this issue.

Ok, so I can try the Pi-Hole install and just use the DHCP option.

Yes, dhcp together with custom dns records

You can literally just run a stand-alone DNS server too. It doesn’t have to be part of some other thing. You could just install bind on your Nextcloud server if you wanted.

2 Likes