TLDR; I have a working DDNS at ddns.example.com
, I want to make it capable of routing requests such host1.example.com
to my locally hosted machines.
So, I have a public domain at let's say example.com
at Google Domains. I have a DDNS capable router, which let's say has a dynamic IP address that is currently set to 1.2.3.4
.
I point my router to properly recognize my GD account, and at GD, I set ddns.example.com
to match my router. Everything works at this point, and I can see that, for instance, host1 on my local network whose port 1234
is forwarded, can be seen at ddns.example.com:1234
.
What I instead want to do, is to be able to write host1.example.com:1234/a/b?c
and get to host1:1234/a/b?c
on my local network.
My current thinking is that this should be possible by:
I add a wildcard record from
*.ddns
toddns.example.com
in Google Domains.Add a
CNAME
fromhost1
tohost1.ddns.example.com
on Google Domains.Set up a dynamic DNS server+client on
host2
on my local network with port 53 with port-forwarding through my router (I have a DNS server that is capable of including the current external IP address in authoritative answers which is installed onhost2
).Add the appropriate entries to my local DDNS client/server (
host2
):Add
NS
recordns.ddns.example.com
tohost2
.Add dynamic
A
recordns.ddns.example.com
tohost2
.Add dynamic
A
recordservices.ddns.example.com
tohost2
.
I port-forward
1234
fromhost1
on my router.
Here is what I think should happen:
I type in host1.example.com/a/b?c
:
NS request to
com.
,example.com.
, and thenA
request forhost1
.host1.example.com
gets redirected tohost1.ddns.example.com
Client asks for
NS
record fromddns.example.com
. Answer is1.2.3.4
.Client asks for the IP address of
host1.ddns.example.com
. Answer is1.2.3.4
.Client connects to
1.2.3.4:1234/a/b/?c
which is hosted byhost1:1234/a/b/?c
.
dig
ing the host1.example.com
domain does return the CNAME
record host1.ddns.example.com
. However, then dig
ing host1.ddns.example.com
returns the Google NS domains. It was my understanding that a CNAME
record would basically mean that any request for that record would be forwarded. So I expected that doing a dig
for the host1.ddns.example.com
would match the wildcard, become a CNAME
redirect to ddns.example.com
, which in turn would be able to handle the rest of the recursion. What am I missing here?
example.com
orddns.example.com
? It's a bit unclear at times in your question, and very important to having efficient and correct routing... Are the devices that should respond toddns.example.com
andhostN.ddns.example.com
on the same network or do each have a different external IP address?... I ask because I think ya may be missing that names are resolved in reverse order, meaning that ya could just hint where to find*.ddns.example.com
and let your server forward beyond that.