1.输入ifconfig查看网络接口名称,我的网络接口名称为enp3s0
2.修改配置文件/etc/network/interfaces
auto enp3s0
iface enp3s0 inet static #static为静态,dhcp为动态获取
address 192.167.70.100 # ip地址
netmask 255.255.255.0 #子网掩码
gateway 172.20.2.254 #网关
3.修改配置文件/etc/resolv.conf
nameserver 192.167.70.254 #DNS服务器
nameserver 114.114.114.114
nameserver 8.8.8.8
4.reboot重启一下系统生效