### Ubuntu netplan 网络配置 + ##### 找到配置文件 ```shell cd /etc/netplan sudo vim ***-config.yaml ``` + ##### 配置netplan ```shell 配置如下: network: ethernets: enp4s0: #网卡名称 我这里默认是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 ``` + ##### 启用生效 ```shell sudo netplan apply ```