Resolve root domain to IP, forward all other sub domains to public DNS

This is my zones file

zone "domain.com"{
        type master;
        file "/etc/bind/db.override";
};

zone "cpanel.domain.com"{  
        type forward;
        forwarders { 8.8.8.8;8.8.4.4; };
        forward only;
}

The root domain resolves to this file

;
; BIND data file for overridden IPs
;
$TTL  86400
@   IN  SOA ns1 root (
            2012100401  ; serial
            604800      ; refresh 1w
            86400       ; retry 1d
            2419200     ; expiry 4w
            86400       ; minimum TTL 1d
            )

; need atleast a nameserver
    IN  NS  ns1
; specify nameserver IP address
ns1 IN  A   `My IP`
; provide IP address for domain itself
@   IN  A   `My IP`
;all other subdomains
*   IN  A   `My IP`

The main domain.com resolves fine but then it resolves cpanel.domain.com to the same IP as the root when I actually want to be determined by Google's DNS which should be something completely different.


You should be able to do this with delegation like so:

*    IN  NS    google-public-dns-a.google.com.
*    IN  NS    google-public-dns-b.google.com.

If you know the specific records you want to delegate, you can create the NS records for those only:

cpanel    IN  NS    google-public-dns-a.google.com.
cpanel    IN  NS    google-public-dns-b.google.com.

I am using the DNS names for google's public DNS servers because I don't think you can use an IP address in NS records.

Edit:

I see now you have a forward-only zone for cpanel.domain.com. You can remove that and use the second version of what I wrote above, or you can keep that, and then do this in the domain.com zone:

cpanel    IN  NS    ns1.domain.com.

I am assuming that ns1.domain.com is the nameserver on which these zones are defined. If not, then use the correct name instead.