Sorry, if I made myself not clear enough...
I have a domain that hosted on public DNS server (let's call it public.com) and I want to use this public domain for both public access and local access.
The name server on the internet should provide public IPs addresses.
Currently, this is only 1 public IP.
The A and AAA record for this public domain (public.com) are updated through DynDNS.
I switched over from using a bunch of cname remaps to use a wildcard subdomain.
This all works fine.
DNSMASQ on the local network should use public.com as an internal domain.
All hosts on the local network should be mapped like this:
host1 -> host1.public.com -> local IPv4 / ULA IPv6
host2 -> host2.public.com -> local IPv4 / ULA IPv6
And so on...
All none local hostnames and unknown hostnames should not be forwarded upstream.
Only certain hostnames that are separately configured should be forwarded.
Notes:
Using the dnsmasq/uci domain option to remap domains is not an option.
Because this breaks ULA IPv6 and overwrites the "real" hostname of a host.
Current solution:
/etc/config/dhcp
option local '/public.com/'
option domain 'public.com'
Note:
public.com and all subdomains (hosted on the public DNS Server) can't be resolved, as expected.
This will break dyndns updates, when domain lookup method is specified.
To fix this, I created a new subdomain (or use wildcard subdomain), cname that points to your subdomain or domain that is updated through dyndns.
For example;
public.com is updated through dyndns.
checkip.public.com is cname subdomain pointing to public.com
Then add (/etc/config/dhcp)
list server '/checkip.public.com/IPofNameServerFoundinPublicDNS'
list server '/checkip.public.com/IPofNameServerFoundinPublicDNS'
This allows dyndns scripts to verify the IP.
Other "problem" public.com will not resolve to anything.
I used this for public.com:
/etc/config/dhcp
config domain
option name 'public.com'
option ip 'IPv4'
config domain
option name 'public.com'
option ip 'ULA IPv6'
When I was running a http/s server, I would use instead:
config cname
option cname 'public.com'
option target 'www.public.com'
And www.public.com is either definied through config domain or dhcp.
The question is now, is there a better solution?
One problem with this solution is, if someone wants public.com to resolve to the public IP (that is updated through dyndns) and adds:
list server '/public.com/IPofNS'
list server '/public.com/IPofNS'
That doesn't work. For subdomains it does work fine, though.
However, for my purpose it works fine now.
I can issue, an cert from lets crypt via acme.
And can use this cert anywhere on my network (luci,ftp and so on), local and public wise.
//edit
Using the dnsmasq/uci domain option to remap domains is not an option.
Because this breaks ULA IPv6 and overwrites the "real" hostname of a host.
Seems like I'm wrong about the ULA IPv6 part.
It is a mystery to me how Windows decides when to use ULA IPv6 or the public IPv6.