环境
宿主机:win7 64位
虚拟机: VMware10.0.0 + Ubuntu12.04
笔记本无线网卡
桥接上网:
我的网络环境是在公司里的局域网,通过交换机连网。IP地址为自动获取,网关为192.168.3.1。
1,打开宿主机“网络与共享中心”->"更改适配器设置"->"VMwareNetwork Adapter VMnet1"->"属性"中看到了"VMware Bridge Protocol",钩选它。
2, 虚拟机网络适配器选择“桥接模式”
3,启动ubuntn,配置如下文件
(1)jia -> sudo gedit /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.3.221
netmask 255.255.255.0
gateway 192.168.3.1
dns-nameservers 192.168.3.1
(2)jia -> sudo gedit /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
#dns=dnsmasq
[ifupdown]
managed=false
4,/etc/init.d/networking restart命令重启网络配置出现以下错误
* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces...
resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything.
RTNETLINK answers: File exists
Failed to bring up eth0.
网上查得解决方法如下:
sudo dpkg-reconfigure resolvconf
重启后果然成功!
NAT上网
1,Vmware->"虚拟网络编辑器"->"恢复默认配置"
2,为VMnet8分配一个子网IP网关,不能跟VMnet1重复;
3,配置虚拟机的网络适配器后启动ubuntn;
4,修改文件如下
jia -> sudo gedit /etc/network/interfaces
auto lo
iface lo inet loopback
# The primary network interface
#auto wlan0
#iface wlan0 inet loopback
iface eth0 inet static
address 192.168.137.200
netmask 255.255.255.0
gateway 192.168.137.2
auto eth0
重启网络后就能跟宿主机互通了,只是不能ping外网