Support for CNAMEs pointing to different zones
Closed this issue · 3 comments
I may be mistaken, but I don't see a way to add a CNAME/DNAME that is pointing to a different zone like this:
;
; Zone file for zone1.example.com
;
...
host1 IN CNAME host1.zone2.example.com.
...
The current mechanism using aliases only allows to set a host in the local domain as a target for an alias, which limits the functionality to only defining aliases within the very same domain.
Or am I missing something?
@peteeckel , this is indeed supported.
Let say we want to add google dns as google-dns
CNAME to our zone. Define it as below:
- name: dns.google.
aliases:
- google-dns
Pay attention to "." at the end name definition - that what will signify record outside of the current zone.
❯ molecule login --host ns1
[root@ns1 /]# host google-dns.acme-inc.com localhost
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases:
google-dns.acme-inc.com is an alias for dns.google.
dns.google has address 8.8.4.4
dns.google has address 8.8.8.8
dns.google has IPv6 address 2001:4860:4860::8844
dns.google has IPv6 address 2001:4860:4860::8888
In your case the record will look like this:
- name: host1.zone2.example.com.
aliases:
- host1
@GR360RY: Thanks, that makes sense.
It's a little unintuitive because of the reversal of host and cname - actually you define a host entry for the cname, not vice versa. But anyway, it works as it should.
@peteeckel , agreed that this is unintuitive. I will look for a way to improve it.