Ubuntu 20修改网络配置

原有的/etc/network/interfaces方法已经不适用,现需要:

sudo vi /etc/netplan/00-installer-config.yaml

yaml格式的样本:

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      dhcp4: false
      addresses: [192.168.3.18/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [223.5.5.5,119.29.29.29]

  version: 2

修改完成后,应用配置:

sudo netplan apply