Basic Info:
Region: us-west1
Zone: us-west1-a
DNS internal IP address: 10.36.2.15 (Windows Server2016, created from marketplace image)
VCP name: Default
I have followed below link to configured external DNS in google-cloud-platform.
https://cloud.google.com/migrate/compute-engine/docs/4.2/how-to/networking/using-external-dns
But I think google-cloud-platform doesn't use meata data keys given and its Velostrata that uses these keys to configured DNS.
Another approach is add external DNS configuration under "Cloud DNS"-> "DNS Server Policies".
Steps which followed to configured external DNS in google-cloud-platform:
- Created Windows2016 server in zone 'us-west1-a' with internal(10.36.2.15) and external IPs and configured DNS
- In "Compute Engine"-> "Settings" -> "metadata" added following key-value pairs as described in above link:
us-west1_dns-domain-name: abc.com
us-west1_dns-domain-suffixes: abc.com
us-west1_dns-servers: 10.36.2.15
- Go to "Network Service" -> "Cloud DNS" -> "DNS Server Policies" -> "Create Policy" and added following:
Name: gcp-dns-server1
Inbound query forwarding : off
Alternate DNS servers (Optional)" : 10.36.2.15
Networks: Default
Go to "VPC Networks" -> "VPC Networks" -> select "default" VPC Checked "DNS server policy": "gcp-dns-server1" is applied
Now when I created a new Virtual Machine in "Default" subnet and checked "/etc/resolv.conf" then machine is configured with internal DNS
#$ cat /etc/resolv.conf # Generated by NetworkManager search c.my-project.internal google.internal nameserver 169.254.169.254 #$ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 10.36.2.23 test4.c.my-project.internal test4 # Added by Google 169.254.169.254 metadata.google.internal # Added by Google
VM came up on network successfully and able to ping DNS.
I was expecting new Virtual Machine's DNS in "/etc/resolv.conf" is "10.36.2.15" which VM should pick automatically but it didn't work.
Note: When I gave DNS "10.36.2.15" manually in "/etc/resolv.conf" then its working fine with expected name resolution. Which means there are no port issue and VM can communicate successfully with DNS.
What I need is VM should take external DNS automatically at boot up time and entry should reflect in "/etc/resolv.conf" in google-cloud-platform's VM. dhclient file also have internal DNS entry.
Is there any way to tell google-cloud-platform to use external configured DNS(or override internal DNS entries) and update "/etc/resolv.conf" on VM(either on boot up or when dhclient service refreshed) automatically with external DNS?