1.环境:
VMware Workstation 12;
ubuntu16.04
2.设置VMware网络链接模式 设置虚拟机为NAT(网络地址转换模式)模式,设置方法以下:
(1).打开虚拟机设置,选择网络适配器;
(2).选择“NAT”模式。
3.查看gateway地址及ip范围
点击VMware编辑,进入VMware虚拟网络编辑器,选择NAT模式。
(1).查看gateway地址
(2).查看ip地址范围
4.设置虚拟机ip地址
(1) 进入/etc/network目录;
(2).编辑interfaces文件;
(3).interfaces内容以下。 # The loopback network interface auto lo iface lo inet loopbackubuntu
# The primary network interface #auto ens33 #iface ens33 inet dhcp auto ens33 iface ens33 inet static #custom ip address 192.168.8.132 netmask 255.255.255.0 #gateway ip gateway 192.168.8.2 #dns dns-nameservers 192.168.8.2