基本信息:
Region: us-west1
Zone: us-west1-a
DNS internal IP address: 10.36.2.15 (Windows Server2016, created from marketplace image)
VCP name: Default
我按照以下链接在 google-cloud-platform 中配置了外部 DNS。
https://cloud.google.com/migrate/compute-engine/docs/4.2/how-to/networking/using-external-dns
但我认为 google-cloud-platform 不使用给定的肉数据密钥及其使用这些密钥来配置 DNS 的 Velostrata。
另一种方法是在“Cloud DNS”->“DNS Server Policies”下添加外部 DNS 配置。
在 google-cloud-platform 中配置外部 DNS 的步骤:
- 使用内部(10.36.2.15)和外部 IP 在区域“us-west1-a”中创建 Windows2016 服务器并配置 DNS
- 在“计算引擎”->“设置”->“元数据”中添加了以下键值对,如上述链接所述:
us-west1_dns-domain-name: abc.com
us-west1_dns-domain-suffixes: abc.com
us-west1_dns-servers: 10.36.2.15
- 转到“网络服务”->“云 DNS”->“DNS 服务器策略”->“创建策略”并添加以下内容:
Name: gcp-dns-server1
Inbound query forwarding : off
Alternate DNS servers (Optional)" : 10.36.2.15
Networks: Default
转到“VPC 网络”->“VPC 网络”-> 选择“默认”VPC 检查“DNS 服务器策略”:已应用“gcp-dns-server1”
现在,当我在“默认”子网中创建一个新的虚拟机并检查“/etc/resolv.conf”时,机器配置了内部 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
虚拟机成功连接到网络并能够 ping DNS。
我期待“/etc/resolv.conf”中的新虚拟机 DNS 是“10.36.2.15”,VM 应该自动选择它,但它不起作用。
注意:当我在“/etc/resolv.conf”中手动提供 DNS“10.36.2.15”时,它可以正常工作并具有预期的名称解析。这意味着没有端口问题,VM 可以与 DNS 成功通信。
我需要的是 VM 应该在启动时自动采用外部 DNS,并且条目应该反映在 google-cloud-platform 的 VM 中的“/etc/resolv.conf”中。dhclient 文件也有内部 DNS 条目。
有什么方法可以告诉 google-cloud-platform 使用外部配置的 DNS(或覆盖内部 DNS 条目)并使用外部 DNS 自动更新 VM(在启动时或刷新 dhclient 服务时)上的“/etc/resolv.conf” ?