0

i have set up a server running Nextcloud and some other tools. To be able to access it from outside, i've already set-up DDNS and a DNS Entry for my domain nextcloud.mydomain.com referring to the DDNS, which works perfectly.

The problem is, when i use nextcloud.mydomain.com in my local network, connection is slow, because the connection is routed outside my network, using the hostname or IP everything is fine...

I checked with tracert/traceroute, and the connection is really routed one node away from my router and back.

I would have expected, that my FritzBox-Router will handle that, because it knows its own IP Address, but it doesnt...

Using /etc/hosts is not an option, because 1) that would break connection outside of the network 2) would need a setup for every device using it.

What is the best way to solve this issue?

My Traceroutes:

user@laptop:~ $ traceroute nextcloud.mydomain.com
traceroute to nextcloud.mydomain.com (*PUBLIC IP*), 30 hops max, 60 byte packets
 1  fritz.box (192.168.178.1)  10.601 ms  10.808 ms  10.362 ms
 2  ipservice-*PUBLIC IP*.pools.vodafone-ip.de (*PUBLIC IP*)  10.636 ms !X  10.631 ms !X  9.443 ms !X

AND

user@laptop:~ $ traceroute nextcloud
traceroute to nextcloud(192.168.178.150), 30 hops max, 60 byte packets
 1  nextcloud.fritz.box (192.168.178.150)  12.357 ms  14.189 ms  14.818 ms
metinkale38
  • 103
  • 3
  • Can you add the `traceroute`? You are probably behind a [Carrier-grade NAT](https://en.wikipedia.org/wiki/Carrier-grade_NAT), so your route does not have a public IP either. Some routers run a DNS resolver stub, which let's you add local entries. – Piotr P. Karwasz Jan 01 '20 at 14:46
  • @PiotrP.Karwasz i have added the traceroutes above... – metinkale38 Jan 01 '20 at 15:34
  • You are officially behind a CGN, but to get back to the topic of your question, Mikael's solution is the usual one. – Piotr P. Karwasz Jan 01 '20 at 15:41

1 Answers1

3

Do like most business IT environments (https://serverfault.com/help/on-topic): Set up an internal DNS service that points your domain names at the local addresses of the services you present. Everything on your network will find the shortest path without manual management of local hosts files.

Mikael H
  • 4,868
  • 2
  • 8
  • 15