Nextcloud version 19:
Operating system and version VM with Debian 10 on QNAP TS 251B NAS:
Apache or nginx version Apache 2.4.38:
PHP version _7.3.14
The issue you are facing:
I running my Nextcloud on a debian VM on my NAS.
I can access my nextcloud easily via DDNS (https://nextcloud.example.com) and locally : 192.168../nextcloud.
When I am using the nextcloud clients to sync different folders, the connection ALWAYS goes over the internet.
Is it possible to use my local network, as long as i am at home? and switch to the external connection when i m elsewhere?
Hello @Ikarus_D ,
welcome to the community of Nextcloud.
You are asking for a feature called “LAN sync”.
No, this is currently not possible.
Alright rakekniven, and thank you for your answer.
I m not a professional IT’ler, but I ve had the idea to connect to the nextcloud via a kind of “DDNS Service” which checks weather a local IP is available, and if not routes the traffic through the internet…
like editing the host file, or installing a name server…
For sure that will work. Maybe there are tools around to use for that.
The proper solution to this is a technique called split-horizon DNS. This is where you have a local DNS server that responds with the local IP instead of the public IP when queried for nextcloud.example.com. And you always use the name, never the IP, to connect to it.
Two things this will fix:
- It will automatically use the LAN IP when on the same network with no client side changes needed.
- The Let’s Encrypt certificate will always be valid because you are always connecting to the proper hostname.
The Nextcloud admin guide should really mention this even though it’s not technically a Nextcloud topic. I can’t tell you how many people run into this same issue.
I m not really into these things, but after my first research it seems that it is a bit complicated to install this split DNS unless you have a powerful router (which is not case here; using a boring connectbox).
I came to the trick to manulally update the host file. By doing this i would reoute the traffic locally from my computer…But happens then if i am outside my network? Would it still work?