Preventing zone-transfers is a function of the server administration, and as others have said is typically disabled these days for security reasons.
When the time comes to add DNSSEC, make sure you use the new NSEC3
format records (from RFC 5155) rather than the original NSEC
format as the latter allows for zone enumeration.
Note that preventing zone enumeration really is just security-via-obscurity. If someone finds your subdomain you'll still need additional security at the application layer.
As for your example records:
www IN CNAME domain.com.
subdomain1 IN CNAME domain.com.
subdomain2 IN CNAME domain.com.
subdomain1 IN A 123.4.56.78.
subdomain2 IN A 123.4.56.79.
- You can't mix CNAME records and other RRtypes in the same entity
- The trailing dots in the A records are invalid
- It's best not to use a CNAME back to the domain for the WWW record
You need:
$ORIGIN domain.com
@ IN SOA ...
IN A 123.4.56.78
www IN A 123.4.56.78
sub1 IN A 123.4.56.79
(where sub1.domain.com
is the hidden site)