一:进入linux终端
cd /etc/network
vi interfaces
在此文件夹下复制如下配置文件(可根据需求自己配置)
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#网上百度的
# The primary network interface
auto ens32
iface ens32 inet static
address 192.168.159.130
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameserver 8.8.8.8
注:ens32 是网卡,ifconfig命令可获取,其他不改即可,重启虚拟机
注:本机是ubuntu16的版本