复制虚拟机修改ip

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

配置如下:
network:
  ethernets:
    enp4s0:
      addresses: [192.168.0.20/24] //IP址
      gateway4: 192.168.0.1 // 网关
      nameservers:
        addresses: [114.114.114.114, 192.168.0.1] //DNS
      dhcp4: no
      optional: no
  version: 2
启用生效
sudo netplan apply

猜你喜欢

转载自www.cnblogs.com/albert-think/p/11664707.html