在虚拟机中安装ubuntu 16.04用的桥接模式,设置静态ip在interfaces中修改: auto ens33 iface ens33 inet static address 192.168.1
在虚拟机中安装ubuntu 16.04用的桥接模式,设置静态ip在interfaces中修改:
auto ens33
iface ens33 inet static
address 192.168.1.80
netmask 255.255.255.0
gateway 192.168.1.1
//用桥接是为了用putty,ssh虚拟机方便,但是不能上网
重新切换NAT上网模式后发现上不了网,需要修改interfaces
auto lo
iface lo inet loopback
重启后就可以上网了。
还有一种没有验证的方法:
ubuntu 重启网卡方法
查看网卡信息: ifconfig
设定一个网卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0
重启网卡使设定生效:sudo /etc/init.d/networking restart
用ubuntu的系统——>系统管理——>网络的网络设置
关闭网卡 ifdown eth0
开启网卡 ifup eth0
重启网卡,优点是可以指定网卡,不影响其他网络接口2.上面设置网卡信息后,重启发现网卡又恢复了,这在前面加上自动加载网卡auto eth0,重启后就会显示信息了。