16.04以后的版本配置静态IP是类似这样的文件 /etc/netplan/50-cloud-init.yaml
查询网卡名称 ip a
修改配置文件/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.
# 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:
ens33:
dhcp4: no
dhcp6: no
addresses: [192.168.1.250/24]
optional: