我使用的是Google Cloud DNS管理的私有区,该私有区无法由该区域允许的网络中的Compute实例解析。我使用了两个Ubuntu 18.04 LTS标准镜像。这两个实例位于同一网络的两个不同的子网上,该网络已被允许查看私有区。
我使用的是GCloud CLI,我通过gcloud init登录并验证了我所选择的项目,我是该项目的所有者。
我尝试调整/etc/resolv.conf以明确指向元数据服务器,但是这完全停止了解析。我最初在私有专区中使用A记录,但不起作用;基于本文https://www.jhanley.com/google-cloud-private-dns-zones/,我尝试对INSTANCE_NAME.ZONE.c.PROJECT.internal域使用CNAME,但也不起作用。
我正在进行的设置是通过GCloud命令行界面进行的,如下所示:
#!/bin/bash
# gcloud init or gcloud auth activate-service-account must have been previously run
CUSTOMER=test
NETWORK=testnetwork
# configure Cloud DNS - create customer.workshop.local
gcloud dns managed-zones create "${CUSTOMER}internal" \
--dns-name="${CUSTOMER}.workshop.local" --description="A zone" \
--visibility=private --networks="$NETWORK"
# IP is derived through a gcloud compute call but presume it is:
IP=10.10.0.4
gcloud dns record-sets transaction start --zone="${CUSTOMER}internal"
gcloud dns record-sets transaction add "$IP" \
--name="server.${CUSTOMER}.workshop.local." \
--ttl=300 \
--type=A \
--zone="${CUSTOMER}internal"
gcloud dns record-sets transaction execute --zone="${CUSTOMER}internal"当我在子网10.10.1.0/24中的Ubuntu 18.04 LTS机器上执行pinging操作时,我得到:
david.alexander@jump-ubuntu-01:~$ ping server.test.workshop.local
ping: server.test.workshop.local: Temporary failure in name resolution有谁有什么想法吗?干杯!
发布于 2019-07-17 06:40:57
事实证明,这只是Ubuntu 18.04的一个问题。Windows不会复制此问题。Edit - CentOS也已经过测试,未复制此问题。
当我在这个网络中创建一个Windows服务器并尝试名称解析时,它工作得很好。Ubuntu 18.04的Canonical镜像(即非自定义镜像)通过Netplan默认名称解析为127.0.0.53,无法查询Google元数据服务器。Dig在默认图像上显示这一点-如果您指定了元数据服务器,则可以解析该名称。
我会用Canonical记录一个关于这个的bug。谢谢John Hanley,我不能给你加分,因为你发表了评论,而不是回答--如果你能告诉我怎么做,我可以做到。
干杯!
发布于 2019-07-17 05:07:37
您是否已经尝试按照Google Public documentation中的官方指南进行操作:
Creating a private zone through GCloud CLI
Creating a private zone through GUI
只是,我发现你错过了这个项目:
gcloud dns --project=test record-sets transaction start --zone=testinternal
gcloud dns --project=test record-sets transaction add 10.10.0.4 --name=test.workshop.local. --ttl=300 --type=A --zone=testinternal
gcloud dns --project=test record-sets transaction execute --zone=testinternalhttps://stackoverflow.com/questions/57050200
复制相似问题