使用命令查看一下网卡名称
ifconfig
使用vi或vim编辑打开配置文件
vim /etc/network/interfaces
根据ip输入以下相关内容保存即可
auto eth0
inface eth0 inet static #设置 eth0 使用默认的静态地址
address 192.168.0.22 #设置 eth0 的ip 地址
gateway 192.168.0.1 #配置当前主机的默认网关
netmask 255.255.255.0 #设置 eth0 的子网掩码
重启网络服务
systemctl restart networking.service