google-cloud-platformdnsgoogle-compute-enginebind9

Creating a DNS forward in Google Cloud Platform with Bind9


I have a DNS server which uses Bind9. I am trying to create DNS forwarding from Google's internal DNS to my nodes, which are also in the cloud.

Brief overview:

I have 3 nodes, all of them as Compute Engine in GCP. 1 node works as DNS server that has this configuration:

zone "gcloud" {
  type forward;
  forwarders {
    # IP according to their site https://cloud.google.com/dns/docs/overview#dns-forwarding
    169.254.169.254;
  };
};

I restart Bind9, everything looks good. Then on the other two nodes, I change the nameserver IP to my DNS server. When I try to use dig I don't get any records. Pinging the hostname worked before, but doesn't work now.

Any clue as to what am I doing wrong? Let me know if I need to provide more information.


Solution

  • I solved my issue.

    I thought that the name of the zone could be anything. However, that was not that case.

    What I had to do was to change the name of the zone to the domain name I had. The domain look like this: [INSTANCE_NAME].c.[PROJECT_ID].internal. So my conf had to look like this:

    zone "c.your-project-id-here.internal." {
        type forward;
        forward only;
        forwarders {
           169.254.169.254;
        };
    };
    

    Then I had to do another conf for reverse lookup. The internal IP could look something like this: 10.20.0.55, which means you had to do reverse lookup on 20.10.

    zone "20.10.in-addr.arpa." {
        type forward;
        forward only;
        forwarders {
            169.254.169.254;
        };
    };