首页 VM虚拟机网络设置

VM虚拟机网络设置

举报
开通vip

VM虚拟机网络设置VM虚拟机网络设置 VMWare中的几种网络设置 (1)Bridged方式 用这种方式,虚拟系统的IP可设置成和本机系统在同一网段,虚拟系统相当于网络内的一台独立的机器,和本机一起插在一个Hub上,网络内其他机器可访问虚拟系统,虚拟系统也可访问网络内其他机器,当然和本机系统的双向访问也不成问题。 (2)NAT方式 这种方式也能实现本机系统和虚拟系统的双向访问。但网络内其他机器不能访问虚拟系统,虚拟系统可通过本机系统用NAT协议访问网络内其他机器。 NAT方式的IP地址设置方法:虚拟系统先用DHCP自动获得...

VM虚拟机网络设置
VM虚拟机网络设置 VMWare中的几种网络设置 (1)Bridged方式 用这种方式,虚拟系统的IP可设置成和本机系统在同一网段,虚拟系统相当于网络内的一台独立的机器,和本机一起插在一个Hub上,网络内其他机器可访问虚拟系统,虚拟系统也可访问网络内其他机器,当然和本机系统的双向访问也不成问题。 (2)NAT方式 这种方式也能实现本机系统和虚拟系统的双向访问。但网络内其他机器不能访问虚拟系统,虚拟系统可通过本机系统用NAT 协议 离婚协议模板下载合伙人协议 下载渠道分销协议免费下载敬业协议下载授课协议下载 访问网络内其他机器。 NAT方式的IP地址设置 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 :虚拟系统先用DHCP自动获得IP地址,本机系统里的VMware services会为虚拟系统分配一个IP,之后如果想每次启动都用固定IP的话,在虚拟系统里直接设定这个IP即可。 (3)host-only方式 顾名思义这种方式只能进行虚拟机和主机之间的网络通信,既网络内其他机器不能访问虚拟系统,虚拟系统也不能访问其他机器。 (4)not use方式 既是不使用网络,虚拟系统为一个单机。 一般来说,Bridged方式最方便好用。但如果本机系统是win2000而网线没插(或根本没有网卡),网络非常可能不可用(大部分用PCI网卡的机器都如此),此时就只能用NAT方式或host-only,之前所说的那两块虚拟网卡就是适应这两种网络准备的。 vmware虚拟机的网络设置 虚拟机的网络设置(原理篇) 在正式开始之前,我想有必要先来学习一些必要的网络知识。否则,在不懂得所有原理的情况下依葫芦画瓢虽然可解一时之需要,但遇见具体情况改动的情况下就只能干瞪眼了。由于篇幅限制,这里只讲和VMware设置有关的一点简单网络知识。 1,什么是网络, Internet是指“互连网”,好象这句话说的有点多余,不过确实有非常多人对他有错误的理解,“互连网”是指一个个网络互连,而不是像有些人想象的那样把一台台计算机杂乱无章的互连。当我们需要用计算机和远方的计算机通讯的时候,先把本地计算机组成一个网络,当然,远方的计算机也要组成一个网络,在把这两个网络“互连”起来,组成“互连网”。用电话线和MODEM拨号上网的时候是通过电话线先把自己的计算机连到ISP(Internet Service Provider 网络服务提供商)的网络中,再经过ISP的网络和世界各地的计算机通信。 2,计算机怎么通过网络传递数据, 每一个网络需要一个网络地址,网络中的计算机需要一个在网络中唯一确定的标识,网络号和计算机的标识号组成了IP地址,所以IP地址是由网络号和主机号组成的。当你的计算机要和其他的计算机通信的时候,计算机会先根据IP地址和子网掩码确定目标主机是在本地网络中还是在远程网络中,如果在本地网络中则直接把一个包含信息的IP数据包发送到本地网络上,目标主机会检测到并接收,如果目标主机在远程网络则需要通过一台被称为网关的的计算机转发到远程of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out 网络,网关(geteway)能看做是连接网络和网络的桥梁,网关的概念非常广,这里为了简化起见,我们暂且认为他和路由器是同一个概念。路由器(router)是一种连接网络和网络,并选择IP数据包传送的路径的一台特别计算机。非常多情况下网关的概念等同于路由器。 3,网络中计算机的IP地址有何需求, 在同一个网络中,每台计算机必须具有相同的网络号,这样计算机才认为目标主机是在本网络中并且能正确送达,如果网络号不同,即使目标主机已用网线连到本网络中数据也不能直接送达,即使这两台计算机近在咫尺,在计算机看来仍旧是一台远程计算机.比如一个网络的网络号为192.168.0,则该网络中的计算机的IP地址必须以192.168.0开头。如果要传送一个数据包到网络号为192.168.1的网络,则必须通过路由器转发,如果该网络中没有路由器,则发送失败。因此,为了连接两个网络,一台路又器至少要有两个网络接口(网卡、调制解调器等连网设备称为网络接口)。网络和路由器的关系见下图: --------------- -------------- -------------- | 网络A | | 路由器 | | 网络B | | | | | | | | ?--|-----------|--? ?--|----------|--? | | 1 | | 2 3 | | 4 | --------------- -------------- -------------- 图 一 图中的小方框 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 示网卡或其他网络接口。 能看到路由器至少有两个网络接口。 假设网络A的地址为192.168.0 网卡1的地址为192.168.0.1 网络B的地址为192.168.1 网卡4的地址为192.168.1.1 则路由器上的网卡2必须属于网络 192.168.0 地址为192.168.0.x (x为任意小于255的数) 路由器上的网卡3必须属于网络 192.168.1 地址为192.168.1.x (x为任意小于255的数) 就是说,路由器既属于网络A,又属于网络B,这样才起到桥梁的作用。 当数据从网络A发往网络B时,路由器从网卡2接收数据,经过改装后通过网卡3发送数据到网络B。 这样,我们称网卡2的地址 192.168.0.x为网络A的网关 网卡3的地址 192.168.1.x为网络B的网关 4,VMware虚拟机提供了那些虚拟网络设备, 默认安装的情况下VMware提供了虚拟网卡vmnet1和vmnet8,更有在虚拟系统上的虚拟网卡 "AMD PCNET Family PCI Ethernet Adapter" 请注意,vmnet1和vmnet8是主系统上虚拟设备,用ifconfig命令能看到,而"AMD PCNET Family PCI Ethernet Adapter"是虚拟系统上的虚拟设备,在安装完虚拟系统后能在设备管理器中看到,前两个隶属于真实系统,是你的真实计算机中的设备,后一个隶属于虚拟系统,是虚拟计算机中的设备,不要搞混淆。 --------------- -------------- -------------- | 网络A | | 路由器 | | 网络B | | | | | | | | ?--|-----------|--? ?--|----------|--? | of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out | 1 | | 2 3 | | 4 | --------------- -------------- -------------- ---------------- ------------------------- -------------- | 虚拟系统 | | 主系统(路由器) | | 真实网络 | | | | | | | | ?--|-----------|--? ??-----|------|--? | |AMD PCNET卡 | |vmnet1 vmnet8 真实网卡 | | 4 | ---------------- ------------------------- -------------- 图 二 让我们来和上面的网络和路由器的关系做一个比对。 能看到要想虚拟系统和主系统通信必须使AMD PCNET 网卡和vmnet1组成一个网络。 而vmnet1本来就在主系统中,系统能直接访问,所以主系统又充当了路由器的功能,只要有这两个虚拟设备主系统和虚拟系统就能通讯。 关键在于三点: 1.确定网卡AMD PCNET和vmnet1的网络号相同。 2.在虚拟系统里设置网络属性,把网关地址设为vmnet1的地址。 3.开启主系统的路由功能,使他成为一台路由器。 事实上,如果你只需要虚拟系统和主系统通信,而不必和主系统所在的真实网络上的其他主机通信的话只要满足第一点就能了。因为满足第一点,主系统和虚拟系统就在同一网络中了,不必路由器便可通信。不过大多数情况下我们需要虚拟系统和主系统所在的真实网络通信,这就需要满足其他两点了。 四、虚拟机的网络设置(实施篇) 1, 我们先来让虚拟系统和主系统联系上。 在VMware安装的时候安装程式会自动给vmnet1分配一个IP地址,下面是笔者计算机上例子: vmnet1 Link encap:Ethernet HWaddr 00:50:56:C0:00:01 inet addr:192.168.221.1 Bcast:192.168.221.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:191 errors:0 dropped:0 overruns:0 frame:0 TX packets:63 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) 在第二行能看到安装程式给vmnet1分配的IP地址为192.168.221.1(注意每次安装VMware IP地址是随机分配的,实际的情况和这里的例子会不同)。即虚拟网卡vmnet1属于网络192.168.221。因此我们需要启动虚拟系统,设置网络属性,把虚拟系统的网卡"AMD PCNET Family PCI Ethernet Adapter"的IP地址设置为192.168.221.x (x为除1以外2~254之间的任意数字笔者把他设置为2),把网关设置为vmnet1的地址:192.168.221.1(如果不和外界真实网络通信的话网关能不设) windows 2000和XP 设置后即时生效,win98需要重新启动,linux需要重新启动网络服务: #service network restart 在主系统上ping一下虚拟系统: of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out #ping -c 3 192.168.221.2 PING 192.168.221.2 (192.168.221.2) from 192.168.221.1 : 56(84) bytes of data. 64 bytes from 192.168.221.2: icmp_seq=1 ttl=128 time=6.91 ms 64 bytes from 192.168.221.2: icmp_seq=2 ttl=128 time=0.425 ms 64 bytes from 192.168.221.2: icmp_seq=3 ttl=128 time=0.527 ms --- 192.168.221.2 ping statistics --- 3 packets transmitted, 3 received, 0% loss, time 2001ms rtt min/avg/max/mdev = 0.425/2.623/6.917/3.036 ms yeah!通了~ 再在虚拟系统上ping主系统: C:,>ping 192.168.221.1 Pinging 192.168.221.1 with 32 bytes of data: Reply from 192.168.221.1: bytes=32 time /proc/sys/net/ipv4/ip_forward 至此,linux的路由功能已打开,你的linux系统已成了一台路由器,连接着虚拟的网络和真实网络。虚拟网络和真实网络间就能通信了。出于安全考虑,如果有必要的话还需要用iptables命令来设置一下路由规则。 五、视窗系统下的虚拟机网络设置。 在视窗系统下的虚拟机的网络设置大致和linux下的相同,只不过需要安装额外的路由软件,在视窗系统平台上有非常多这样的软件能用,比如 SysGate WinGate等,如果用的是视窗系统 2000 Server 或是视窗系统 NT Server 的话能用系统自带的“路由和远程访问”软件。具体的设置就不祥述了,相信只要懂了其中的原理就不难找到合适的解决 方案 气瓶 现场处置方案 .pdf气瓶 现场处置方案 .doc见习基地管理方案.doc关于群访事件的化解方案建筑工地扬尘治理专项方案下载 了。如果你的计算机硬件足够的好,有1G以上的内存和2G以上的CPU的话,那你也能同时运行几台虚拟机,把这几台虚拟机组成一个网络,这样在一台计算机上就能有一个功能强大的网络实验平台了。 Vmware(虚拟机工作站)网络设置 vmware通过虚拟网络组件把虚拟机器同真实的物理网络连接起来。 虚拟网络组件主要有如下几种: 交换机:跟真实的交换机相同,他允许把多个网络组件连接起来,在vmware软件安装时根据需要自动安装,最多允许挂接9个交换机,名称分别为VMnet0-8。其中有3个已默认分配给网桥(VMnet0),宿主机虚拟网络适配器(VMnet1)和网络地址转换NAT设备(VMnet8)。 通过在虚拟机的“Editing this machine settings”的网络适配器条目,能把虚拟机器连接到未被分配的交换机。 网桥:网桥把虚拟机器连接到你的宿主机所在的局域网LAN上。其实现的方式就是把虚拟机器上的虚拟适配器连接到你的宿主机上的物理网络适配器上。创建虚拟机的向导中如果选择了“typical”或“Using bridged networking”的网络连接方式,那么网桥会自动生成。 上面图中给出了网桥连接方式下虚拟机网络适配器和宿主机物理适配器之间的关系。这是让虚拟机访问宿主机所在网络的最容易的一种方式。这种情况下虚拟机需要自己独立的标识,比如TCP/IP网络中就需要自己的IP地址,这个IP地址从网络管理员处获得,更有其他的一些网络细节都需要手工设置。网桥方式下虚拟机跟宿主机相同是本地网络中的一个独立体,如同一个物理的机器相同。如of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out 果在vmware中同时运行多个虚拟机,那么每个虚拟机都应该有一个独立的IP地址。 宿主机上的虚拟适配器:就是出目前宿主机上的供vmware工作站使用的一个虚拟的网络适配器。允许虚拟机和宿主机通信,不过这个虚拟适配器不会连接到所有外部的网络,只有在宿主机上建立起特别的软件诸如代理服务器才能把虚拟适配器和物理适配器连接起来。实际上虚拟机只和宿主机进行网络连接,这种方式也称为host-only。 在创建虚拟机的向导中选择了自定义网络设置,并且选择了“Use Host-only networking”,那么这种网络连接方式就会被自动建立起来。此时,宿主机操作系统能看到有一个虚拟的网络适配器。宿主机和虚拟机能通信。非常适合建立一个和外部网络隔绝的独立私有TCP/IP网络。虚拟机的IP地址由虚拟的DHCP服务器提供。这种连接方式结合视窗系统2000/XP/2003上的网络共享的特性,就能允许虚拟机连接到外部Internet。 网络地址转换设备:如果宿主机只有一个IP地址可用于外部物理网络的连接,那么使用NAT能把虚拟机连接到外部网络。 如果在创建虚拟机的向导中选择自定义网络设置,并选择“Use network address translation”,那么这样的连接就会被创建。如果宿主机所在网络不能给该虚拟机一个IP地址,那么NAT就是最容易的一种让虚拟机访问宿主机网络的方式。由于虚拟机没有外部物理网络的IP地址,因此vmware在宿主机上建立一个独立的私有网络,通过虚拟的DHCP服务器获得ip地址。NAT能够把多个虚拟机的网络数据加以区分并在虚拟机和外部物理网络之间进行传送。NAT方式下许多 标准 excel标准偏差excel标准偏差函数exl标准差函数国标检验抽样标准表免费下载红头文件格式标准下载 的TCP/IP协议都能在虚拟机上使用,比如HTTP/FTP/TELET等。不过默认情况下外部网络上的计算机不能连接到虚拟机上,因此虚拟机不能提供诸如WEB浏览这样的服务。 DHCP服务器:为虚拟机提供一个IP地址,只适用于NAT和host-only(指虚拟机只和宿主机进行网络连接)。 网络适配器:当用向导生成一个虚拟机时,为虚拟机建立一个虚拟网络适配器。在虚拟机的操作系统中,能看到一个名称为AMD PCNET PCI适配器。在vmware的适配器设置中,能建立最多3个虚拟网络适配器。 设置虚拟机上网 一般主机上网有两种方式,一是本机在局域网环境中,多台计算机通过交换机访问Internet,则交换机是拨号主机而不是本机,那么主机(交换机)就有一个IP地址,这种情况类似办公室的计算机。另外一种方式是本机直接拨号上网,如家庭计算机。根据本机不同的上网方式,其虚拟的计算机上网设置方法也有所差别,我们分开来介绍。 一、局域网环境 局域网环境下设置虚拟机上网其实非常简单,例如笔者的视窗系统 XP系统计算机在局域网内分配的IP地址是192.168.0.2,而局域网环境下交换机的主机IP地址是192.168.0.1,那么VMware虚拟的视窗系统 2000系统能把他看作是局域网内的一台计算机,给他分配一个IP地址为192.168.0.4即可。 设置过程: 首先在VMware程式的“虚拟机”菜单下打开“设置”命令窗口,然后在硬件设置中选择“以太网”设置一下虚拟机使用的网卡,这里选择“自定义VMnet0默认桥接”即可。 of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out 接下来在虚拟机视窗系统 2000系统中设置网络连接属性,在视窗系统 2000系统桌面上选中“网上邻居”点击右键打开“属性”窗口,然后选择“本地连接”点击右键打开其属性窗口,选中“Internet协议(TCP/IP)”点击属性按钮,设置虚拟机的IP地址,如我们上面为他分配了虚拟机在局域网的地址为“192.168.0.4”,默认网关输入局域网主机的IP地址,最佳选择DNS服务器指定为局域网主机的IP地址(图1)。设置好后确定。 打开虚拟机视窗系统 2000的IE浏览器,输入一个网址访问检测是否能正常访问Internet了。 二、本机拨号上网 如果用本机拨号上网,那么和局域网环境就不同了,本机没有一个IP地址,虚拟机该怎么设置自己的IP上网呢,VMware虚拟运行环境有一个虚拟网络(虚拟局域网)的功能,在VMware中设置一下虚拟网络的主机IP,虚拟机(即视窗系统 2000系统)就能利用虚拟网络主机的网关访问Internet了。 设置过程: 首先在VMware程式“编辑”菜单下选择“虚拟网络设置”命令,然后虚拟网络编辑器窗口的“摘要”选项卡下看到VMware能够模拟的网络类型,其中有“虚拟网络8”。 下面要添加一个虚拟网络的网卡硬件,在“主机虚拟适配器”选项卡下添加名为“VMnet8”的虚拟网络,点击“添加”按钮,选择VMnet8添加。 接着在“NAT”选项卡下查看虚拟的主机“VMnet8”的网关IP地址,VMware默认设置的网关IP地址是192.168.59.2,我们也能自己修改他。 同样我们要在“虚拟机设置”中定义一下“以太网”的硬件设备,这里选择网络连接的方式是“自定义VMnet8(NAT)”。 最后在虚拟机的“Internet协议(TCP/IP)”中设置当前环境下的虚拟计算机IP、网关、子网掩码,如分配这台虚拟机的IP为192.168.59.3,网关是上一步在“NAT”中设定的网关IP,然后单击“确定”按钮完成设置。 目前打开虚拟机的IE浏览器,输入网址便可在虚拟机中访问Internet,享受冲浪的乐趣了 vmware,qemu各种方式上网设置 vmware三种网络连接,qemu两种网络连接实现 虚拟机主机 虚拟机互连网通信的方法。 顺便写了下怎么不重新编译整个内核支持某个功能,对系统无影响,编译速度要快于编译整个内核。 如果你的XXX卡没被内核支持,又怕自己编译的内核会造成系统损坏就能试试这个方法喽 ^_^ vmware三种网络连接上网设置: 1.bridge : 默认使用vmnet0 of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out 将虚拟机的ip设置和主机同网段未使用ip,其余和主机相同: 例如主机ip是10.70.54.31,设置虚拟机ip为10.70.54.22。netmask,broadcast,gateway,dns都和主机相同即可实现虚拟机主机 虚拟机互连网 通信。 2.nat : 默认使用vmnet8 将虚拟机设置成使用dhcp方式上网,windows下选择"自动获取ip",linux下开启dhcp服务即可 也能手动设置: ip设置和vmnet8同网段,gateway设置成vmnet8的 gateway(/etc/vmware/vmnet8/nat/nat.conf)中能查到vmnet8的gateway,通常是xxx.xxx.xxx.2。 netmask,broadcast设置和vmnet8相同,dns设置和主机相同。 例如 vmnet8 ip:172.16.249.1 gw :172.16.249.2 虚拟机设置: ip :172.16.249.100 gw: 172.16.249.2 3.host-only : 默认使用vmnet1 将虚拟机ip设置和vmnet1同网段,gateway设置成vmnet1的ip,其余设置和vmnet1相同,dns设置和主机相同 例如 vmnet1 ip :172.16.245.1 虚拟机设置: ip :172.16.245.100 gateway :172.16.245.1 这样就实现了虚拟机主机 通信,不过 虚拟机互连网 仍无法通信 虚拟机和互连网通信: 1.开启主机路由功能 2.设定iptables,使主机成为一台nat server of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out 1. echo 1 >/proc/sys/net/ipv4/ip_forward 这样就主机就具有了路由功能 2. iptables -t nat -A POSTROUTING -o eth0 -s 172.16.245.0/24 -j MASQUERADE 这条规则意思是将来自172.16.245.0/24封包的来源ip伪装成eth0的ip,实现虚拟机和互连网通信 如果网络接口是ppp+或pppoe则需要修改成-o pppoe 当然-s 172.16.245.0/24 也要根据实际情况修改 qemu两种上网方式: user mode network : 这种方式实现虚拟机上网非常简单,类似vmware里的nat,qemu启动时加入-user-net参数,虚拟机里使用dhcp方式,即可和互连网通信,不过这种方式虚拟机和主机的通信不方便。 tap/tun network : 这种方式要比user mode复杂一些,不过设置好后 虚拟机互连网 虚拟机主机 通信都非常容易 这种方式设置上类似vmware的host-only,qemu使用tun/tap设备在主机上增加一块虚拟网络设备(tun0),然后就能象真实网卡相同设置他. 首先内核中支持tap/tuns设备: Device Drivers ---> Networking support ---> [M] Universal TUN/TAP device driver support 如果当前内核没有支持,能重新只编译相应模块加入,方法非常简单: 将当前内核设置文件cp到内核源码目录下: [root@LFS ~]#cp /boot/config-[kernel-version] /usr/src/linux [root@LFS ~]#cd /usr/src/linux 设置内核,将TUN/TAP选择模块(M),如上所示: of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out [root@LFS ~]#make menuconfig 重新只编译模块(M),不编译核心(*)支持的东东: [root@LFS ~]#make modules 编译好后在/usr/src/linux/drivers/net下能找到tun.ko: [root@LFS net]#ls -l /usr/src/linux/drivers/net/tun.ko -rw-r--r-- 1 root root 11116 Mar 23 20:29 /usr/src/linux/drivers/net/tun.ko [root@LFS net]# 将他cp到当前内核的模块目录的相应位置: [root@LFS net]#cp /usr/src/linux/drivers/net/tun.ko /lib/modules/`uname -r`/kernel/drivers/net 重新建立模块依赖关系: [root@LFS net]#depmod 目前就能加载他了 : [root@LFS net]#modprobe tun 检查一下: [root@LFS net]#lsmod |grep tun tun 8704 0 [root@LFS net]# OK. 成功不重新编译整个内核加入特别模块支持 如果你的xx卡不被内核支持,又能编译成模块,自己怕重新编译内核后出问题就能用这个办法只编译自己需要的模块,然后手动安装到相应位置,再加载他。 这样编译速度要也比编译整个内核快,不会对系统有所有损害,就能使用上XX卡喽。^_^ 要注意三点: 1.内核源码必须和当前内核版本完全一致,否则编译出的模块是不能用的。 of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out 2.注意只make modules(编译模块),没有make modules_install(自动安装模块到/lib/modules下) 3.加载新编译的模块前必须先运行depmod,否则modprobe未找到他 其实使用当前内核设置文件(/boot/config-[kernel-version]),只加入自己需要的模块,不做所有其他改,make modules_install应该也不会有问题的。 不过最稳妥的办法还是手动安装他,控制权在自己手里更踏实嘛 :-) OK,转回qemu上网问题 如果使用udev管理设备(通常2.6.x内核的发行版都已使用udev),当modprobe tun后就会自动建立/dev/net目录,并创建出tun设备,做好相关链接: [root@LFS net]#ls -l /dev/net/tun lrwxrwxrwx 1 root root 6 Mar 25 15:35 /dev/net/tun -> ../tun [root@LFS net]# 如果非常不幸,你没看到他,就需要自己手动做这些工作了 [root@LFS ~]#mkdir /dev/net [root@LFS ~]#mknod /dev/net/tun c 10 200 OK,相关设备已准备好了,还需要一个tun/tap的初始化脚本 : /etc/qemu-ifup : #!/bin/sh /sbin/ifconfig $1 172.20.0.1 再给予qemu-ifup x执行权限放在/etc下就能了。 这个脚本只能root用户执行,如果需要普通用户使用qemu,就需要改成sudo /sbin/ifconfig .....再设置sudo相关权限。 启动qemu后,他会在主机上增加一块虚拟网络设备(tun0): [root@LFS ~]#ifconfig tun0 tun0 Link encap:Ethernet HWaddr 0A3:8A:5D:97:CD inet addr:172.20.0.1 Bcast:172.20.255.255 Mask:255.255.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) [root@LFS ~]# 目前就能启动qemu设置虚拟机网络参数了,和vmware host-only相同: ip和tun0相同网段,gateway为tun0 ip 其余参数和tun0相同,dns和主机相同: tun0 : ip :172.20.0.1 broadcast:172.20.255.255 netmask :255.255.0.0 qemu : ip :172.20.0.100 broadcast:172.20.255.255 netmask :255.255.0.0 gateway:172.20.0.1 和host-only相同,这样只实现了虚拟机主机间通信,还需要设置router,nat才能连上互连网 [root@LFS ~]#echo 1 > /proc/sys/net/ipv4/ip_forward [root@LFS ~]#iptables -t nat -A POSTROUTING -o eth0 -s 172.20.0.0/24 -j MASQUERADE [root@LFS ~]# OK,虚拟机主机 虚拟机互连网通信 都完成啦 of the people, "Da Yi Ju", big love Yi Ju "unite to society is the atmosphere of energy to accelerate the formation. At present, in the County's recommended good in China has reached 16, Shandong good 23, at all levels of the moral model more than 200. More optimized development environment, perseverance deepen style construction, increase" Yong lazy slow hiding remediation efforts, window units in service quality, service efficiency significantly improved. While fully affirming our achievements, we also want to clearly see the majority control group The expectations of the public, control a city evaluation system standards, the county a city work, there still exist many weak links and the prominent question. Mainly in: 1, environmental sanitation, city back lane and rural road, bridge, village, ditches still exist health corner, Ji Cunla garbage is not completely clear, after the Qing chaos, while rebound phenomenon occur frequently., and the appearance of the order, city roads, key areas of illegal structures, unlicensed stalls, probe the market, Jeeves, running red lights, vehicle Luantingluanfang phenomenon still exists, part of the urban road traffic order is chaotic; Street business operators to implement the "door 3 packets" is not in place, commercial street, residential areas and other shop management repeated, serious impact on the image of the city., "five small" industries management, some operating premises license, part of the practitioners no certificates. 4, community construction, community property management is not standardized, is not in place, public service space generally lack, the insufficient number of facilities of the public fire control community minors live Dynamic venues and other infrastructure facilities is not perfect, community volunteer service activities often cannot carry out
本文档为【VM虚拟机网络设置】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_036899
暂无简介~
格式:doc
大小:80KB
软件:Word
页数:29
分类:生活休闲
上传时间:2017-09-27
浏览量:16