VPS:控制 hotname 和 /etc/resolv.conf (debian 10)
VPS: Taking control of hotname and /etc/resolv.conf (debian 10)
想要设置主机名和域名或想要控制要使用的 dns 服务器。
如果我在重新启动时编辑 resolv.conf
,更改将重置为来自 dhcp 的内容
尝试 /etc/cloud/cloud.cfg
似乎并没有改变问题。
因为跟云设置没有关系哈哈
魔术师发生在 /etc/dhcp/dhclient.conf
我注释掉了那行
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
# domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
然后在 /etc/cloud/cloud.cfg 中我不得不调整一些东西
[...]
# preserve_hostname: false
preserve_hostname: true
[...]
# - timezone
[...]
# manage_etc_hosts: true
manage_etc_hosts: false
我还需要在 /etc/hosts
中添加一行
127.0.1.1 myName.Mydomain.foo myName
127.0.1.1 xxxxx.your-cloud.etc xxxxx
127.0.0.1 localhost
浪费时间...所以我认为分享解决方案可能会很好。
想要设置主机名和域名或想要控制要使用的 dns 服务器。
如果我在重新启动时编辑 resolv.conf
,更改将重置为来自 dhcp 的内容
尝试 /etc/cloud/cloud.cfg
似乎并没有改变问题。
因为跟云设置没有关系哈哈
魔术师发生在 /etc/dhcp/dhclient.conf
我注释掉了那行
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
# domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
然后在 /etc/cloud/cloud.cfg 中我不得不调整一些东西
[...]
# preserve_hostname: false
preserve_hostname: true
[...]
# - timezone
[...]
# manage_etc_hosts: true
manage_etc_hosts: false
我还需要在 /etc/hosts
中添加一行127.0.1.1 myName.Mydomain.foo myName
127.0.1.1 xxxxx.your-cloud.etc xxxxx
127.0.0.1 localhost
浪费时间...所以我认为分享解决方案可能会很好。