【问题标题】:How can I set a static hostname in google cloud VM?如何在谷歌云虚拟机中设置静态主机名?
【发布时间】:2018-06-01 23:33:24
【问题描述】:

我想为我的谷歌云虚拟机实例配置一个静态主机名,因为它目前在实例重启后恢复为默认主机名。

我遵循了一些教程,但没有一个有效,因此需要一个永久的解决方案。

问候

【问题讨论】:

    标签: static google-cloud-platform cloud hostname


    【解决方案1】:

    Google Cloud Platform 中的主机名用于internal DNS resolution by the metadata server,是您的实例的默认元数据的一部分。改变它会破坏一些东西。如果您想检查在元数据服务器上注册的实例主机名是什么,您可以这样做:

    curl http://metadata.google.internal/computeMetadata/v1/instance/hostname -H "Metadata-Flavor: Google"
    

    但实际上手动更改元数据是not possible,但有几种解决方法可能对您有用。 See this other answer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-08
      • 1970-01-01
      • 1970-01-01
      • 2019-06-21
      • 2020-07-17
      相关资源
      最近更新 更多