cat /etc/netplan/50-cloud-init.yaml

 

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [192.168.1.102/24]
      gateway4: 192.168.1.1
      nameservers:
              addresses: [192.168.1.1, 8.8.8.8]

应用

netplan --debug apply

[Linux] Ubuntu 19.10 server 配置静态IP