Google Compute实例是否具有稳定的公共DNS名称? [英] Do Google Compute instances have a stable public DNS name?

查看:97
本文介绍了Google Compute实例是否具有稳定的公共DNS名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个分为两个部分的问题:

This is a question in two parts:

  • GCE实例是否具有稳定的公共DNS名称?例如具有公共IP a.b.c.d的默认DNS名称似乎是d.c.b.a.bc.googleusercontent.com
  • 如果是,获取此信息的最佳方法是什么?到目前为止,这是我一直在使用的技巧:

  • Do GCE instances have a stable public DNS name? The default DNS name for instance with public IP a.b.c.d seems to be d.c.b.a.bc.googleusercontent.com
  • If yes, what's the best way to obtain this information? Here's the hack I've been using thus far:

EXTERNAL_IP=$(curl -s http://bot.whatismyipaddress.com/)
EXTERNAL_DNS=$(dig +short -x ${EXTERNAL_IP})

推荐答案

可以反向查找,对于IP地址,您可能更喜欢使用gcutil https://developers.google.com/compute/docs/gcutil/tips

reverse lookup is okay to do, for IP address you would probably prefer using gcutil https://developers.google.com/compute/docs/gcutil/tips

EXTERNAL_IP = $(gcutil getinstance --format = csv --zone = [您的区域] [您的实例] | grep external-ip | cut -d," -f 2)

EXTERNAL_IP=$(gcutil getinstance --format=csv --zone=[your_zone] [your_instance] | grep external-ip | cut -d "," -f 2)

这篇关于Google Compute实例是否具有稳定的公共DNS名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆