When Ubuntu editing card configuration static address, sometimes it fails, the following method is effective to solve the problem.
This article Reference article: https://linuxize.com/post/how-to-configure-static-ip-address-on-ubuntu-18-04/
First, view the card name ip address
Second, edit netplan network management tools
sudo vi /etc/netplan/01-network-manager-all.yaml
#Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
ens3:
dhcp4: no
dhcp6: no
addresses: [192.168.0.222/24] #配置网卡IP
gateway4: 192.168.0.1 #配置网关
nameservers:
addresses: [114.114.114.114, 8.8.8.8] #配置DNS
*温馨提示:编辑yaml文件时需严格按照格式来,空格不能使用Tab键缩进,每个冒号后边均有一个空格。*
Use the following commands to configure the application
sudo netplan --debug apply #加--debug参数可以显示报错信息,进行调试