我有一个 Ubuntu 20.04.2 服务器版本模板。我已按照通过 netplan 的流程配置了 IP 地址、名称服务器网关 4 等。每当我从该模板部署虚拟机并提供特定 IP(使用自定义规范)时。虚拟机在第一次正确配置时显示正确的 IP。如果我重新启动新虚拟机,它再次使用旧模板 IP 地址。不知道我错过了什么。
少量结果:
administrator@Ubuntu20LTS:~$ ls -al /etc/netplan
total 20
drwxr-xr-x 2 root root 4096 Jun 12 16:44 .
drwxr-xr-x 100 root root 4096 Jun 9 10:28 ..
-rw-r--r-- 1 root root 1024 Jun 12 16:44 .99-netcfg-vmware.yaml.swp
-rw-r--r-- 1 root root 485 Jun 12 16:43 50-cloud-init.yaml
-rw-r--r-- 1 root root 346 Jun 12 16:42 99-netcfg-vmware.yaml
administrator@Ubuntu20LTS:~$ cat /etc/netplan/99-netcfg-vmware.yaml
# Generated by VMware customization engine.
network:
version: 2
renderer: networkd
ethernets:
ens192:
dhcp4: no
dhcp6: no
addresses: [10.xx.xx.xx/23]
gateway4: 10.xx.xx.1
nameservers:
search: [xxx.xxx.com, xxx.xxx.com, xxx.xxx.com]
addresses: [xxxx.xxxx.xxxx.xxxx]
administrator@Ubuntu20LTS:~$ cat /etc/netplan/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}
network:
ethernets:
ens192:
dhcp4: true
match:
macaddress: 00:50:56:82:b7:a0
set-name: ens192
version: 2
more result:
administrator@Ubuntu20LTS:/etc/netplan$ ls
50-cloud-init.yaml 99-netcfg-vmware.yaml
Cat .99-netcfg
administrator@Ubuntu20LTS:~$ cat /etc/netplan/.99-netcfg-vmware.yaml.swp
b0nano 4.8▒rootUbuntu20LTS/etc/netplan/99-netcfg-vmware.yamladministrator@Ubuntu20LTS:~$
有人能帮我解决这个问题吗? 99-netcfg.yaml 中配置的 IP netplan 中的可用文件 50-cloud-init.yaml 中启用了 dhcp