在 /etc/netplan/50-cloud-init.yaml 配置文件中有一段注释中有说明
root@localhost:/etc/netplan# cat 50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
翻译过来就是:
修改50-cloud-init.yaml文件在重启后不会生效,除非在 /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg 配置 network: {config: disabled}.
root@localhost:/etc/netplan# cat /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
network: {config: disabled}
在99-disable-network-config.cfg配置文件中添加
network: {config: disabled}
参数后重启服务器网络配置文件也会生效。
99-disable-network-config.cfg
文件不存在时需要创建