如何删除 GCP 实例上的 dns 名称服务器 169.252.169.254

How do I remove dns nameserver 169.252.169.254 on GCP instance

在 GCP 上,在我删除一个 ubuntu 16.04 实例后,它的 /etc/resolv.conf

中有一个默认名称服务器 169.254.169.254

我不想使用它,所以我去/etc/resolvconf/resolv.conf.d/base(我第一次打开时是空白的)并添加了我自己的名称服务器

在 运行 sudo resolvconf -u 之后,我自己的名称服务器显示在 /etc/resolv.conf 中,但它位于 169.254.169.254

之下

只要169.254.169.254负责,我自己的域名服务器就不会用....

我只是想知道如何删除 169.254.169.254.....

来自Google云的VPC Documentation:

Google runs a local metadata server alongside each instance at 169.254.169.254. This server is essential to the operation of the instance, so the instance can access it regardless of any firewall rules you configure.

所以,就这样吧。

不要修改/etc/resolve.conf。这由 Google Cloud DHCP 管理,每 60 分钟和 DHCP 刷新时被覆盖。除非你有充分的理由,否则不要 disable/remove Google 名称服务器。

相反,将您的名称服务器添加到 /etc/dhcp/dhclient.conf

prepend domain-name-servers 172.16.1.1;