织梦CMS - 轻松建站从此开始!

罗索实验室

当前位置: 主页 > 杂项技术 > PC常识 >

vmware虚拟机下ubuntu上网设置

落鹤生 发布于 2012-01-01 01:22 点击:次 
虚拟机下ubuntu共享方式上网:把你虚拟机中操作系统(REDHAT9.0)的“本地连接”也设置为自动获得IP、自动获得DNS服务器;若虚拟机中操作系统是ubuntu,则可查看虚拟网络设置中“DHCP”,“NAT”选项卡中所示的IP,网关地址,子关掩码等,若均存在则无需改动。
TAG:

虚拟机下ubuntu共享方式上网:

1. 有线网络

   在有线网络的条件下,vmware的安装非常简单,上网方式几乎不用怎么设置(默认NAT模式)
   如果默认情况下不能上网,则按以下步骤尝试:
**************************************************************
NAT的DHCP配置:

1 将虚拟机的上网方式选为NAT。

2 把你的虚拟网卡VMnet8设置为自动获得IP、自动获得DNS服务器,启用。具体方法:网络连接-本地连接(VMnet8)-属性-ipv4协议-属性-选择“自动获得IP、自动获得DNS服务器”。


3 把你虚拟机中操作系统(REDHAT9.0)的“本地连接”也设置为自动获得IP、自动获得DNS服务器;若虚拟机中操作系统是ubuntu,则可查看虚拟网络设置中“DHCP”,“NAT”选项卡中所示的IP,网关地址,子关掩码等,若均存在则无需改动。

4 最重要的是你的两个服务必须开启:VMware DHCP Service 和VMware NAT Service。点菜单栏里的“编辑”-选“虚拟网络设置”,先将“自动桥接”给去掉(去掉钩钩),再选“DHCP”开启DHCP服务,点“开始”-应 用,再按同样的方法开启“NAT”的功能。

核查方法具体操作如下: 开始---设置--控制面板---管理工具---服务(在运行里输入services.msc回车即可),确保 VMware DHCP Service 和VMware NAT Service 服务已经启动.

NAT的固定IP配置:(考虑到没有固定IP,主机和虚拟机间的通信叫麻烦,有时DHCP很耗时间)

1 开启两个服务:VMware NAT Service,VMware DHCP Service(后者可不开)

2 将虚拟机的上网方式选为NAT。

3 点菜单栏里的“编辑”-选“虚拟网络设置”,先将“自动桥接”给去掉(去掉钩钩),在“DHCP”关闭DHCP服务,在“Host virtual network mapping”下的VMnet8的右边选择subnet修改子网。

手动设置方法:
1.windows中CTRL+R,输入cmd,然后在dos下输入ipconfig,得到VMnet8网卡的IP为192.168.93.1(不同机器不一样)

2.Ubuntu中设置网络IP为192.168.93.X(128-254),自动分配时一般也是128,DNS设置为192.168.93.2。
**************************************************************************

资料来源:百度文库

LINUX 是个好东西,可是如果是新手.而且是想多系统共存的话,安装就会有点难。建议初装LINUX的朋友试试用虚拟机VMware workstation安装。推荐使用ubuntu10.04.1-desktop-i386。此版本安装方便,运行速度快,占用空间少,整个装完大概有 4G。

简单的说,vmware就是一个虚拟机软件,它可以在你现有的操作系统上虚拟出一个新的子机,这个子机一方面是建立在你正在运行的 操作系统之上的, 同时,它又拥有自己独立的CPU,硬盘,内存及各个硬件,当然,这些都是虚拟出来的,虚拟子机的CPU是通过i386的保护模式实现的,虚拟的硬盘其实就 是母机上的一个文件,内存当然是从物理中划出一块,别的如网络设备也都是通过某种途径实现的.

归根结底,vmware给你提供了这么一个 机会:可以在一台机器上真正同时运行两个独立的操作系统,一个是原始的操作系统,一个运行于虚拟机上,前 者称之为母机,后者为子机.基于上述原因,你现在可以在运行win32平台的机器上通过vmware安装并运行linux,反之亦然.事实上,两个操作系 统之间并没有太多的依赖关系,你也可以在linux上再装一个linux,或者在win98下装一个winXP,随你自己喜欢.关键的好处在于,你安装这 个新的操作系统并不需要重新划分硬盘空间,而且,可以同时运行而不需要reboot来reboot去.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

vmware的常见的应用有:

在win32下安装linux/Unix(适合想体会一下linux又害怕破坏现有系统的linux新手)


在linux下安装win32(可解燃眉之急)

从一个系统中引导出另一个系统(二者并存)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

VMWare安装前的准备工作

1. 硬件最低:主要是内存,最低要求为96M,如果小于96M,可以安装但无法正常使用,不过你要让VMWare运行得较好的话,128M是少不了的.
2. 如果你的英文有限,还是先下载汉化补丁,这个在网上很容易搜到。
3. 用注册机或者搜索序列号都可以成功安装。网上这类资源很多。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

以在windows下安装ubuntu为例进行说明:

安装过程:
1. 请先安装VMware workstation.

2. 建立linux虚拟机.

******************************************************************

A.用鼠标左建双击桌面中的\"VMware workstation\"图标,运行虚拟机

B.建立一台虚拟机。点击“FILE(文件)”-“NEW(新建)”--“NewVirtual Machine(

新建虚拟机)”,弹出虚拟机创建菜单。

C.根据向导一步一步地创建虚拟机,首先选择安装方式是“TYPICAL(典型)”还是

“CUSTOM(自定义)”安装。 我这里选择典型。

D.如果你的Ubuntu是iso镜像,直接在"Installer dis image file(iso)"中加载。

E.在Guest operating system(客户操作系统)“中选择”LINUX“,点击下一步。

F.在Virtual machine name(虚拟机名字)中输入你想建立的虚拟机的名字

G.在Location(位置)中选择虚拟机的安装位置。因为会在虚拟机中安装操作系统

和应用软件,所以建议将虚拟机安装在一个有较大空间的磁盘分区中。

H.如果你的电脑连接在网络中,一般会自动的选择一个合适的网络环境。

I.点击finish,返回VMWARE主界面,LINUX虚拟机就建好了。

*******************************************************************

3. Powered on 你刚建好的虚拟机,则开始自动安装。注意安装此版本ubuntu时请选择英文版,否则系统会出现半英文半中文,而且在安装VMware Tools时会因为在终端中不易输入中文而很难安装。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

附:Ubuntu安装虚拟机工具(VMware Tool)详解

在VMware下安装Ubuntu,那么必须安装VMware-tools,才能获得更好的体验,包括屏幕分辨率、声音、和windows共享剪贴板等等。

1、点击VMware菜单的-VM-Install VMware Tools

这时,在Ubuntu下会自动加载Linux版的VMware Tools的安装光盘镜像。你会看到虚拟机的桌面上出现了一个名为VMware Tools的光盘图标,并且被自动打开。


其中包括VMwareTools-xxx-i386.rpm和VMwareTools- xxx.tar.gz两个文件。

如果你双击那个 rpm 文件,会提示说不支持的软件包,因为 rpm 是为 RedHat 准备的安装包,我们需要的是 .tar.gz 那个。

2、 把 .tar.gz 文件拷贝而到桌面,右键菜单-解压缩到此处。会自动解压为一个 vmware-tools-distrib 目录(使用ctrl+L快捷键可以查看此目录的真实路径,注意Desktop有两个,一个是所有用户公用的,一个是home/administrator /Desktop,请把文件解压在第一个/Desktop下)。

打开终端(系统的应用程序菜单-附件-终端)


3、然后在终端里面执行以下命令行:

$ cd Desktop(要是中文的就是 $ cd 桌面) 注意:没有“/”
$ cd vmware-tools-distrib

$ sudo ./vmware-install.pl

4、 回车之后提示输入管理员密码,然后一路确认回车后(不用输“y”,直接回车,相当于在Windows里安装软件时所填答的诸多对话框,我们这里 均采用缺省设置),直到最后出现“Enjoy——the VMware team”的字样后,VMwareTools终于安装完成了。

过程如下:
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/usr/bin] y

The path "y" is a relative path. Please enter an absolute path.

In which directory do you want to install the binary files?
[/usr/bin] y

The path "y" is a relative path. Please enter an absolute path.

In which directory do you want to install the binary files?
[/usr/bin] y

The path "y" is a relative path. Please enter an absolute path.

In which directory do you want to install the binary files?
[/usr/bin] y

The path "y" is a relative path. Please enter an absolute path.

In which directory do you want to install the binary files?
[/usr/bin] y

The path "y" is a relative path. Please enter an absolute path.

In which directory do you want to install the binary files?
[/usr/bin] y

The path "y" is a relative path. Please enter an absolute path.

In which directory do you want to install the binary files?
[/usr/bin] y

The path "y" is a relative path. Please enter an absolute path.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]

What is the directory that contains the init scripts?
[/etc/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]

The installation of VMware Tools 6.5.0 build-118166 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]


Stopping VMware Tools services in the virtual machine:
Guest operating system daemon: done
Virtual Printing daemon: done
The bld-2.6.24-16-i386generic-Ubuntu8.04 - vmmemctl module loads perfectly into
the running kernel.

The bld-2.6.24-16-i386generic-Ubuntu8.04 - vmhgfs module loads perfectly into
the running kernel.

The bld-2.6.24-16-i386generic-Ubuntu8.04 - vmxnet module loads perfectly into
the running kernel.

update-initramfs: Generating /boot/initrd.img-2.6.24-16-generic
The bld-2.6.24-16-i386generic-Ubuntu8.04 - vmblock module loads perfectly into
the running kernel.

[EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that
creates backups of virtual machines. Please refer to the VMware Knowledge Base
for more details on this capability. Do you wish to enable this feature?
[no] yes

The bld-2.6.24-16-i386generic-Ubuntu8.04 - vmsync module loads perfectly into
the running kernel.

The bld-2.6.24-16-i386generic-Ubuntu8.04 - vmci module loads perfectly into the
running kernel.

The bld-2.6.24-16-i386generic-Ubuntu8.04 - vsock module loads perfectly into
the running kernel.

Detected X.org version 7.3.0.


Please choose one of the following display sizes that X will start with (1 -
29):

[1] "320x200"
[2] "320x240"
[3] "400x300"
[4] "512x384"
[5] "640x400"
[6] "640x480"
[7] "720x480"
[8] "800x480"
[9] "854x480"
[10]< "720x576"
[11] "800x600"
[12] "1024x768"
[13] "1280x720"
[14] "1280x768"
[15] "1152x864"
[16] "1280x800"
[17] "1366x768"
[18] "1280x960"
[19] "1440x900"
[20] "1280x1024"
[21] "1400x1050"
[22] "1680x1050"
[23] "1600x1200"
[24] "1920x1080"
[25] "1920x1200"
[26] "1920x1440"
[27] "2048x1536"
[28] "2560x1600"
[29] "2560x1920"
Please enter a number between 1 and 29:

[10] 11 //或其他尺寸,一般不要超过宿主机的屏幕分辨率,要不看起来还得拖动滚动条。全屏显示虚拟机的快捷键是CTRL+ALT+ENTER.


This is a pre-release version of the X server from The X.Org Foundation.
It is not supported in any way.
Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.
Select the "xorg" product for bugs you find in this release.
Before reporting bugs in pre-release versions please check the
latest version in the X.Org Foundation git repository.
See http://wiki.x.org/wiki/GitPage for git access instructions.

X.Org X Server 1.4.0.90
Release Date: 5 September 2007
X Protocol Version 11, Revision 0
Build Operating System: Linux Ubuntu (xorg-server 2:1.4.1~git20080131-1ubuntu9)
Current Operating System: Linux jim-desktop 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686
Build Date: 15 April 2008 05:26:17PM

Before reporting problems, check http://wiki.x.org to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "/tmp/vmware-config0/XF86ConfigLog.6478", Time: Fri Sep 26 18:16:38 2008
(++) Using config file: "/tmp/vmware-config0/XF86Config.6478"
(II) Module "ramdac" already built-in

X is running fine with the new config file.

expected keysym, got XF86KbdLightOnOff: line 70 of pc
expected keysym, got XF86KbdBrightnessDown: line 71 of pc
expected keysym, got XF86KbdBrightnessUp: line 72 of pc
expected keysym, got XF86KbdLightOnOff: line 70 of pc
expected keysym, got XF86KbdBrightnessDown: line 71 of pc
expected keysym, got XF86KbdBrightnessUp: line 72 of pc
FreeFontPath: FPE "/usr/share/fonts/X11/misc" refcount is 2, should be 1; fixing.
Checking acpi hot plug done
Starting VMware Tools services in the virtual machine:
Switching to guest configuration: done
Guest filesystem driver: done
Mounting HGFS shares: failed
Guest memory manager: done
Guest vmxnet fast network device: done
VM communication interface: done
VM communication interface socket family: done
Blocking file system: done
File system sync driver: done
Guest operating system daemon: done
Virtual Printing daemon: done

The configuration of VMware Tools 6.5.0 build-118166 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an X server session.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

To use the vmxnet driver, restart networking using the following commands:
/etc/init.d/networking stop
rmmod pcnet32
rmmod vmxnet
modprobe vmxnet
/etc/init.d/networking start

If the virtual printer feature is enabled, you will need to restart the CUPS
service to make use of this feature.

Enjoy,

--the VMware team

//至此VMware Tools安装结束。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

虚拟机下ubuntu共享方式上网:

1. 有线网络

   在有线网络的条件下,vmware的安装非常简单,上网方式几乎不用怎么设置(默认NAT模式)
   如果默认情况下不能上网,则按以下步骤尝试:
**************************************************************
NAT的DHCP配置:

1 将虚拟机的上网方式选为NAT。

2 把你的虚拟网卡VMnet8设置为自动获得IP、自动获得DNS服务器,启用。具体方法:网络连接-本地连接(VMnet8)-属性-ipv4协议-属性-选择“自动获得IP、自动获得DNS服务器”。


3 把你虚拟机中操作系统(REDHAT9.0)的“本地连接”也设置为自动获得IP、自动获得DNS服务器;若虚拟机中操作系统是ubuntu,则可查看虚拟网络设置中“DHCP”,“NAT”选项卡中所示的IP,网关地址,子关掩码等,若均存在则无需改动。

4 最重要的是你的两个服务必须开启:VMware DHCP Service 和VMware NAT Service。点菜单栏里的“编辑”-选“虚拟网络设置”,先将“自动桥接”给去掉(去掉钩钩),再选“DHCP”开启DHCP服务,点“开始”-应 用,再按同样的方法开启“NAT”的功能。

核查方法具体操作如下: 开始---设置--控制面板---管理工具---服务(在运行里输入services.msc回车即可),确保 VMware DHCP Service 和VMware NAT Service 服务已经启动.

NAT的固定IP配置:(考虑到没有固定IP,主机和虚拟机间的通信叫麻烦,有时DHCP很耗时间)

1 开启两个服务:VMware NAT Service,VMware DHCP Service(后者可不开)

2 将虚拟机的上网方式选为NAT。

3 点菜单栏里的“编辑”-选“虚拟网络设置”,先将“自动桥接”给去掉(去掉钩钩),在“DHCP”关闭DHCP服务,在“Host virtual network mapping”下的VMnet8的右边选择subnet修改子网。

手动设置方法:
1.windows中CTRL+R,输入cmd,然后在dos下输入ipconfig,得到VMnet8网卡的IP为192.168.93.1(不同机器不一样)

2.Ubuntu中设置网络IP为192.168.93.X(128-254),自动分配时一般也是128,DNS设置为192.168.93.2。
**************************************************************************

2. 无线网络

   不同于有线网络,用笔记本无线上网,问题出来了,主机为无线上网,虚拟机该怎么设定呢?

    在主机为无线上网,虚拟机设定的时候最好用“桥接模式”(有些资料说用NAT模式,我试了很久,都没有成功),方法如下:

      1. 关闭正在运行的虚拟机ubuntu,将其联网方式设定为“桥接模式”。

      2. 在vmare菜单edit中找到VMware的虚拟网络编辑器,如果是绿色版,直接找到vmnetcfg.exe,双击就可以了。

     3. 找到“主机虚拟网络映射”选项(host virtual network mapping),在vmnet0 上的下拉列表中,找到自己本本的无线网卡。

     4. 启动ubuntu虚拟机即可。

    注:此情况下DHCP和NAT服务状态无论是开启还是关闭都没有影响。


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

如果宿主机是linux,用vmware下的ubuntu桥接无线网卡方法见:
http://forum.ubuntu.org.cn/viewtopic.php?p=776672

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

非虚拟机下ubuntu9.10 10.04上网IP设置
1。设定IP
sudo gedit /etc/network/interfaces

auto lo
iface lo inet loopback            #lo 是本地回环地址:127.1

auto eth0
iface eth0 inet static
address 192.168.1.152
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255      #设定eth0的IP

这样,IP并没有立即生效。
sudo /etc/init.d/networking restart

2。这时候就能ping到局域网中的电脑了。但是上不了Internet,是因为没有设置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。

sudo gedit /etc/resolv.conf

nameserver 208.67.222.222
nameserver 208.67.220.220

现在可以上网了。

附网卡设置相关命令:

查看网卡信息: ifconfig

设定一个网卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0

重启网卡使设定生效:sudo /etc/init.d/networking restart

更改MAC地址:ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

(hainei_)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www1.rosoo.net/a/201201/15567.html]
本文出处:百度博客 作者:hainei_ 原文
顶一下
(2)
100%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容