for a Domain mydomain.com, I have the following entries:
; Canonical Name definition
* 600 IN CNAME www
*.staging 600 IN CNAME newdomain.com.
www IN CNAME olddomain.com.
My expectation would be, that a.mydomain.com would always resolve to whatever is behind olddomain.com, and that a.staging.mydomain.com would always resolve to whatever is behind newdomain.com.
Sadly, my results are not consistent, although all TTLs have been expired a week ago. Sometimes i get the expected results:
$ nslookup abc.staging.mydomain.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
abc.staging.mydomain.com canonical name = newdomain.com.
Name: newdomain.com
Address: 2.2.2.2
Sometimes I don't:
$ nslookup abc.staging.mydomain.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
abc.staging.mydomain.com canonical name = www.mydomain.com.
www.mydomain.com. canonical name = olddomain.com
Name: olddomain.com
Address: 1.1.1.1
How can I configure my DNS zone to achieve what I want?