PC机的环境:(1)host:win XP ;(2)guest:VMWare+ubuntu
本人近两年一直使用VMWare6.5.2 + Kubuntu8.10网络正常,在XP上使用ssh可以与虚拟机互传文件。虚拟机也可以访问局域网、公网。
昨天新装了VMWare7.0.1 (build-203739).还继续使用原来做的虚拟机Kubuntu8.10,host<->guest网络互ping都不通,XP使用ssh也连接不上虚拟机。
我在ubuntu10.10, ubuntu9.10, ubuntu8.10三个版本上实验过,都没有问题。配置完之后,虚拟机通过公司网络能访问公网,虚拟机能ping通除了host XP外其它局域网内的IP。Host XP能ping通guest ubuntu10.10
【1】设置静态IP
linux@ubuntu:~$ sudo gedit /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth1
##iface eth0 inet dhcp
iface eth1 inet static
address 192.168.0.234
netmask 255.255.254.0
network 192.168.0.0
broadcast 192.168.1.255
gateway 192.168.0.1
【2】ubuntu特有设置:[ifupdown] managed=false
linux@ubuntu:~$ sudo gedit /etc/NetworkManager/nm-system-settings.conf
# This file is installed into /etc/NetworkManager, and is loaded by
# NetworkManager by default. To override, specify: '--config file'
# during NM startup. This can be done by appending to DAEMON_OPTS in
# the file:
#
# /etc/default/NetworkManager
#
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
【3】设置域名解析dns服务器IP
linux@ubuntu:~$ sudo gedit /etc/resolv.conf
# Generated by NetworkManager
domain localdomain
search localdomain
nameserver 192.168.0.1
##nameserver 8.8.8.8 ##备选的dns服务器
【之前我设置了前两项,忘了第3项设置dns服务器,Firefox无法访问外网,如www.google.com, 无法ping通 www.baidu.com,
但是能ping通baidu的IP地址:
linux@ubuntu:~$ ping 119.75.218.45
PING 119.75.218.45 (119.75.218.45) 56(84) bytes of data.
64 bytes from 119.75.218.45: icmp_req=1 ttl=54 time=34.3 ms
64 bytes from 119.75.218.45: icmp_req=2 ttl=54 time=11.2 ms】
本人参考了以下两个链接(修改ubuntu的两个系统文件,如红色字体)
(1) http://wiki.ubuntu.org.cn/index.php?title=UbuntuHelp:Zenoss&variant=zh-cn
....
7. Ubuntu server installs using DHCP – we should be using a static IP:
sudo gedit /etc/network/interfaces
iface eth0 inet dhcp - change this line to the following (assume 192.168.3.10)
iface eth0 inet static address 192.168.3.10
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
gateway 192.168.3.1
8. Edit /etc/hosts file for your new IP address. Assuming you named the server “zenoss” and running in “mydomain.inc”, change the second 127.0.0.1 to:
192.168.3.10 zenoss.mydomain.inc zenoss
9. Restart the network:
/etc/init.d/networking restart
(二) http://blogold.chinaunix.net/u1/37510/showart_2447184.html
如果没有安装,可以通过下面的方式进行安装,要确保你的网络上了桥接的协议如下图所示:
|
|
然后执行sudo /etc/init.d/network-manager restart,重新配置一下。
补充:ubuntu8.04默认是false,ubuntu9.10默认是true. 使用静态IP都需要改成false