<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>夜行人 &#187; 虚拟化</title>
	<atom:link href="http://www.187299.com/archives/tag/virtual/feed" rel="self" type="application/rss+xml" />
	<link>http://www.187299.com</link>
	<description>寻觅生命中的那一片浅草......</description>
	<lastBuildDate>Wed, 16 Nov 2011 11:25:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>xenserver license</title>
		<link>http://www.187299.com/archives/1275</link>
		<comments>http://www.187299.com/archives/1275#comments</comments>
		<pubDate>Wed, 14 Oct 2009 03:06:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[XenServer]]></category>
		<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1275</guid>
		<description><![CDATA[1.使用XenCenter工具,连接至Server,Tool--&#62;License Manager--&#62;选择要更新License的服务器,点击Activate....按钮.如果,此服务器可以直接连接到外网,将可以直接获取LIC文件安装,如果不能连接至外网,将会出... ]]></description>
			<content:encoded><![CDATA[<p>1.使用XenCenter工具,连接至<span>Server</span>,Tool--&gt;<span>License</span> Manager--&gt;选择要更新License的<span>服务器</span>,点击Activate....按钮.如果,此服务器可以直接连接到外网,将可以直接获取LIC文件安装,如果不能连接至外网,将会出现更新失败提示,并提示保存申请License文件.选择将申请文件保存.<br />
2.访问:<a href="https://activate.vmd.citrix.com/" target="_blank">https://activate.vmd.citrix.com</a>,  upload申请文件.<br />
3.填写相关信息,主要是MAIL地址,用来接收License  文件.提交.<br />
4.打开邮箱下载License文件.<br />
5.使用Winscp工具将License文件<span>复制</span>到XenServer的/etc/<span>xen</span>source/下,并重新命名为license.<br />
6.重新启动XenServer.<br />
7.License更新完成,可以正常使用.</p>
<p>关于<span>Citrix</span>公司的XenServer免费使用,个人理解,虽然为免费版本,但为了方便<span>管理</span>, 以及获取用户的相关信息,Citrix采用了Free License管理的模式,在到期后,用户只需要再次重复申请新的License文件并进行License安装即可.不会影响XenServer的正常使 用.但是,Citrix公司并未发表声明永久性提供免费使用,至少我没有找到.特别在正式的生产<span>环境</span>,还是建议大家购买正式的服务,以提供更高的性能以及安全的合法的保障.</p>
<p>转载自：<a href="http://hi.baidu.com/ts%B4%F3%D1%BC%C0%E6/blog/item/c58976fb885250809f514653%2Ehtml" target="_blank">http://hi.baidu.com/ts%B4%F3%D1%BC%C0%E6/blog/item/c58976fb885250809f514653%2Ehtml</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1275/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XenServer_export_import命令</title>
		<link>http://www.187299.com/archives/1261</link>
		<comments>http://www.187299.com/archives/1261#comments</comments>
		<pubDate>Sun, 11 Oct 2009 07:55:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[XenServer]]></category>
		<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1261</guid>
		<description><![CDATA[XenServer的vm export与import，可以通过XenCenter来做，手头上又没有Windows的服务器，如果保存到本地，export和import都很麻烦 在网上查了些资料，可以通过命令来将vm export到服务器上，但XenServer主机上... ]]></description>
			<content:encoded><![CDATA[<p>XenServer的vm export与import，可以通过XenCenter来做，手头上又没有Windows的服务器，如果保存到本地，export和import都很麻烦<br />
在网上查了些资料，可以通过命令来将vm export到服务器上，但XenServer主机上，可用空间有限，又无法访问XenServer用于存储虚拟机的空间<br />
于是决定使用nfs，将另外一台Linux服务器A的空间mount过来，用于保存export出来的vm文件</p>
<p>A上的操作192.168.1.2<br />
yum -y install nfs*<br />
yum -y install portmap<br />
mkdir /data/nfs<br />
chmod 777 /data/nfs<br />
允许192.168.1.0/24网段的计算机挂载/home/nfs<br />
echo '/data/nfs 192.168.1.*(rw,root_squash)' &gt;&gt; /etc/exports<br />
service portmap start<br />
service nfs start</p>
<p>XenServer主机1上操作<br />
mkdir /data/export<br />
mount -t nfs 192.168.1.2:/data/nfs /data/export</p>
<p>开始导出<br />
先把要导出的vm关掉，然后查看要导出vm的UUID<br />
xe vm-list params=all</p>
<p>xe vm-export filename=/data/export/017-otrs.xva vm=09faa5ff-ceea-1234-e02e-97cae69878d5</p>
<p>XenServer主机2上操作<br />
mkdir /data/export<br />
mount -t nfs 192.168.1.2:/data/nfs /data/export</p>
<p>xe vm-import filename=/data/nfs/017-otrs.xva</p>
<p>等一下就可以了</p>
<p>我vm分了30G的空间，导出来的文件大概7G，应该也就是vm实际存储的文件大小吧</p>
<p>参考文章：<a href="http://tiri.li/schneller-xen-vm-import-auch-via-befehlszeile" target="_blank">http://tiri.li/schneller-xen-vm-import-auch-via-befehlszeile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1261/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>卸载Linux下的VMware Server 1.0.6</title>
		<link>http://www.187299.com/archives/757</link>
		<comments>http://www.187299.com/archives/757#comments</comments>
		<pubDate>Wed, 06 May 2009 06:00:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.momati.net/?p=757</guid>
		<description><![CDATA[只需要执行一条命令，好简单 # perl /usr/bin/vmware-uninstall.pl Uninstalling the tar installation of VMware Server. 停止 xinetd：[  确定  ] 启动 xinetd：[  确定  ] Stopping VMware services: Virtual machine monitor[  确定  ] ... ]]></description>
			<content:encoded><![CDATA[<p>只需要执行一条命令，好简单<br />
# perl /usr/bin/vmware-uninstall.pl<br />
Uninstalling the tar installation of VMware Server.</p>
<p>停止 xinetd：[  确定  ]<br />
启动 xinetd：[  确定  ]<br />
Stopping VMware services:<br />
Virtual machine monitor[  确定  ]<br />
Bridged networking on /dev/vmnet0[  确定  ]<br />
DHCP server on /dev/vmnet8[  确定  ]<br />
NAT service on /dev/vmnet8[  确定  ]<br />
Host-only networking on /dev/vmnet8[  确定  ]<br />
Virtual ethernet[  确定  ]</p>
<p>File /etc/vmware/config is backed up to /etc/vmware/config.old.0.<br />
<span id="more-757"></span><br />
This program previously created the file /dev/vmnet5, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /dev/vmnet2, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /dev/vmnet4, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /dev/vmnet1, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /dev/vmnet7, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /dev/vmnet9, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /dev/vmnet6, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /dev/vmnet3, and was about to remove<br />
it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /etc/vmware/not_configured, and was<br />
about to remove it.  Somebody else apparently did it already.</p>
<p>This program previously created the file /etc/pam.d/vmware-authd, and was about<br />
to remove it.  Somebody else apparently did it already.</p>
<p>This program previously created the directory /var/log/vmware, and was about to<br />
remove it. Since there are files in that directory that this program did not<br />
create, it will not be removed.</p>
<p>This program previously created the directory /var/run/vmware, and was about to<br />
remove it. Since there are files in that directory that this program did not<br />
create, it will not be removed.</p>
<p>This program previously created the directory /etc/vmware, and was about to<br />
remove it. Since there are files in that directory that this program did not<br />
create, it will not be removed.</p>
<p>The removal of VMware Server 1.0.6 build-91891 for Linux completed<br />
successfully. Thank you for having tried this software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/757/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMware Server for Linux的NAT及转发设置</title>
		<link>http://www.187299.com/archives/103</link>
		<comments>http://www.187299.com/archives/103#comments</comments>
		<pubDate>Wed, 15 Apr 2009 07:39:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.momati.net/archives/103</guid>
		<description><![CDATA[.不禁概叹VMware的强大，以下的English就不翻译了 主要注意两点： 1、当虚拟机用NAT方式与宿主进行连接时，IP地址设置时的网关是×.*.*.2,而不是*.*.*.1，这一点同样适用于Host only连接方式。因为以... ]]></description>
			<content:encoded><![CDATA[<p>.<span style="font-size: small;">不禁概叹VMware的强大，以下的English就不翻译了<br />
主要注意两点：<br />
1、当虚拟机用NAT方式与宿主进行连接时，IP地址设置时的网关是×.*.*.2,而不是*.*.*.1，这一点同样适用于Host only连接方式。因为以前一直是用桥接方式，所以不存在这个网关问题，上次配置虚拟机网络时，因为是直连外网，再没有私有地址给我桥接，所以要用NAT，我把网关设置成172.16.86.1，结果是虚拟机可以ping通172.16.86.1，也可以ping通宿主系统的外网IP，但就是ping不通www.baidu.com等。究其原因，就是网关设置错误。如果虚拟系统的IP地址获取方式是DHCP，我想不会有这么多麻烦，但服务器嘛，当然需要固定IP啦。</span></p>
<p><span style="font-size: small;"><span id="more-103"></span><br />
</span></p>
<p><span style="font-size: small;">2、我还真的不知道VMware自带NAT的转发功能，我原来是打算把宿主系统和虚拟系统用Host only连接，然后用iptables把访问特定端口的服务转发到虚拟系统上。但因为数据一直出不去，Google了一些资料，发现VMware有NAT转发功能，才决定用NAT方式连接。</span></p>
<p><span style="font-size: small;">NAT的设置和转发设置均在这里/etc/vmware/vmnet8/nat/nat.conf<br />
这个文件是只读的，为了编辑，可以chmod +w /etc/vmware/vmnet8/nat/nat.conf<br />
也可以在编辑完成后用:wq!来强行写入。</span></p>
<p><span style="font-size: small;">不过，网上有文章说VMware的NAT转发不是很稳定。</span></p>
<p><span style="font-size: small;">Unfortunately, VMware Server on Linux currently lacks a user friendly equivalent of the Windows Manage Virtual Networks tool, instead requiring the manual editing of the /etc/vmware/vmnet8/nat/nat.conf file (keeping in mind that the vmnet8 name will need to be changed if the settings are to be configured for a custom created virtual network).<br />
The nat.conf file contains a number of different sections, each allowing a different aspect of the NAT device to be configured:<br />
[host]<br />
ip - The IP address of the NAT device on the virtual network. By default this will be &lt;xxx&gt;.2 where the &lt;xxx&gt; is the subnet address assigned to the virtual network (for example, 172.16.86.2).<br />
netmask - The subnet mask to be used for the NAT device.<br />
configport - The port to be used for accessing information about the NAT device. By default this directive is commented out with a # character for security purposes and is supposedly only for use by VMware Inc's technical support staff.<br />
device - The VMnet virtual network switch to which the NAT device is attached.<br />
activeFTP - A value of 1 indicates that active FTP sessions (i.e connections initiated by remote FTP servers) are supported. A setting of 0 limits connections to passive sessions.<br />
[udp]<br />
timeout - The amount of time, in seconds, to keep UDP mapping for the NAT device. This is essentially the amount of time for which the NAT device remembers which virtual machine initiated a specific UDP based connection with an external system. If the external system responds after the timeout period has elapsed, the NAT will no longer know to which virtual machine the data should be forwarded, and the UDP packet will be discarded.<br />
[incomingtcp]<br />
The [incomingtcp] section of the nat.conf file is used to configure TCP port forwarding. This essentially involves mapping an incoming TCP port on the host to the IP address and TCP port of a virtual machine. For example, to map data coming into TCP port 8080 on the host to port 80 on a virtual machine with an IP address of 172.16.86.128, the following directive would need to be entered into the [incomingtcp] section of the configuration file:<br />
8080 = 172.16.86.128:80<br />
As many TCP port forwarding directives as necessary may added to this section of the NAT configuration file.<br />
[incomingudp]<br />
The [incomingudp] section of the nat.conf file is used to configure UDP port forwarding. Similar to the [incomingtcp]] section, this essentially involves mapping an incoming UDP port on the host to the IP address and UDP port of a virtual machine. For example, to map data coming into UDP port 8081 on the host to port 8082 on a virtual machine with an IP address of 172.16.86.128, the following directive would need to be entered into the [incomingudp] section of the configuration file:<br />
8081 = 172.16.86.128:8082<br />
As many port UDP forwarding directives as necessary may added to this section of the NAT configuration file.</span></p>
<p><span style="font-size: small;">主要参考文章：http://www.virtuatopia.com/index.php/VMware_Server_NAT_Configuration#Configuring_NAT_on_Linux_Hosts</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/103/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vmware esxi 3.5命令</title>
		<link>http://www.187299.com/archives/134</link>
		<comments>http://www.187299.com/archives/134#comments</comments>
		<pubDate>Sat, 07 Mar 2009 07:23:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.momati.net/archives/134</guid>
		<description><![CDATA[今天在esxi 3.5上装panabit，把lnc0配置好后，再把lnc1,lnc2归入网桥1，lnc1为外网，lnc2为内网，一点击提交，本地Netmeter就显示本地网卡的流量为几百K每秒，顿觉不妙，导致路由器也死了，ping路由器... ]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;">今天在esxi 3.5上装panabit，把lnc0配置好后，再把lnc1,lnc2归入网桥1，lnc1为外网，lnc2为内网，一点击提交，本地Netmeter就显示本地网卡的流量为几百K每秒，顿觉不妙，导致路由器也死了，ping路由器网关，显示超时，怀疑是产生广播风暴了。</span></p>
<p><span style="font-size: small;">因为上面有运行一个2003系统，正在破解一个rar文件的密码，不能重启，想到如果把esxi的物理网卡地址改成跟虚拟机的网卡不同网段，是否依然会产生风暴呢？我打开显示器，把IP地址设置为10.1.2.22，连接到路由器2上，同时，本地计算机也连到路由器2，连接上后，本地网卡显示流量依然为几百K每秒，无法用infrastructure client连接服务器端。既然连接到路由器上不可以，那就试下host to host把，真是天助我也，服务器连路由器的线是交叉线，连做线都省了，本机和服务器连起来后，一切正常，也可以用infrastructure client连接，马上把装了panabit的机器关掉，重新将本机和服务器连接到路由器1，哈哈，可以用Remote Desktop连接2003，看来物理网卡的IP网管跟虚拟机的网卡网段是没有关联的，即使不在同一网段，不影响本机对虚拟机的访问，只是不能用infrastructure client管理esxi了，因为物理网卡的地址依然是10.1.2.22，重新回到显示器前，这下好了，Configure Management Network那个不能用了，按ESC、ENTER也没有用，幸好昨天查如何开启ESXi的SSH时知道如何进命令行模式，进入后，以为在/etc/sysconfig/下会有类似于eth0,eth1之类的文件，结果发现没有，整个磁盘都差不多找遍了，都没有，幸好网上找到这篇文章:</span></p>
<p><span style="font-size: small;"><span id="more-134"></span><br />
</span></p>
<p><span style="font-size: small;">更改esx console的物理IP地址及esx console命令</p>
<p>http://aiirii.spaces.live.com/blog/cns!E59E9AB7297384A7!692.entry?sa=578345425</span></p>
<p><span style="font-size: small;">但上面所写的命令，在esxi 3.5 update 2上已经不适用了，在/sbin下主要有如下的命令<br />
~ # cd /sbin<br />
/sbin # ls esxcfg*<br />
esxcfg-advcfg     esxcfg-init-eesx  esxcfg-nas        esxcfg-swiscsi<br />
esxcfg-dhcp       esxcfg-locker     esxcfg-nics       esxcfg-vmhbadevs<br />
esxcfg-dumppart   esxcfg-loglevel   esxcfg-rescan     esxcfg-vmknic<br />
esxcfg-hwiscsi    esxcfg-module     esxcfg-resgrp     esxcfg-vswitch<br />
esxcfg-info       esxcfg-mpath      esxcfg-route</span></p>
<p><span style="font-size: small;">查看vmknic信息<br />
/sbin # esxcfg-vmknic -l<br />
Interface  Port Group          IP Address      Netmask         Broadcast       MAC Address       MTU     TSO MSS   Enabled<br />
vmk4       Management Network  192.168.100.120 255.255.255.0   192.168.100.255 00:1e:c9:ff:3c:cd 1500    40960     true </span></p>
<p><span style="font-size: small;">修改vmknic的IP地址等<br />
/sbin # esxcfg-vmknic -i 192.168.100.120 -n 255.255.255.0 "Management Network"</span></p>
<p><span style="font-size: small;">修改网关<br />
/sbin # esxcfg-route 192.168.100.1</span></p>
<p><span style="font-size: small;">修改马上生效，不用重启network</span></p>
<p><span style="font-size: small;">以上各命令均可加-h参数显示帮助信息，另外说下查看物理网卡信息的命令<br />
/sbin # esxcfg-nics -l<br />
Name    PCI      Driver      Link Speed    Duplex MTU    Description<br />
vmnic1  05:00.00 tg3         Down 0Mbps    Half   1500   Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet<br />
vmnic0  04:00.00 tg3         Up   100Mbps  Full   1500   Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet</span></p>
<p><span style="font-size: small;">经过以上设置，可以用infrastructure client连接了。</span></p>
<p><span style="font-size: small;">copy以上介绍那篇文章的内容：</span></p>
<p><span style="font-size: small;"> 今天安装了另外一台esx 3.5 测试，安装完成后，发觉设置错了网段，本来想用修改linux网卡Ｉｐ的方法操作，后来，上网找了下，有专用的命令可用，很简单，如下：<br />
列出当前网卡信息<br />
esxcfg-vswif -l</span></p>
<p>删除原来的配置vswif0, 没有修改的命令，该文件应该在：/etc/sysconfig/network-scripts/ifcfg-vswif0<br />
esxcfg-vswif -d vswif0</p>
<p>新增配置<br />
esxcfg-vswif -a vswif0 -p "Service Console" -i 172.28.2.2 -n 255.255.255.0 -b 172.28.2.255<br />
（也可使用-i命令直接修改，没测试过）</p>
<p>检查修改后配置是否正确<br />
esxcfg-vswif -l</p>
<p>修改原来hosts的IP, 及网关<br />
vi /etc/hosts<br />
vi /etc/sysconfig/network</p>
<p>附：vmware esx 上的命令行</p>
<p>http://leesun.blog.51cto.com/58664/60092</p>
<p>esx上特有的命令很多，有些是很方便，就用这个来记录我平时在esx上用到的命令<br />
1：看你的esx版本。<br />
vmware -v<br />
2：列出esx里知道的服务<br />
esxcfg-firewall -s<br />
3：查看具体服务的情况<br />
esxcfg-firewall -q sshclinet<br />
4：重新启动vmware服务<br />
service mgmt-vmware restart<br />
5: 修改root的密码<br />
passwd root<br />
6：列出你当前的虚拟交换机<br />
esxcfg-vswitch -l<br />
7：查看控制台的设置<br />
esxcfg-vswif -l<br />
8：列出系统的网卡<br />
esxcfg-nics -l<br />
9：添加一个虚拟交换机，名字叫（internal）连接到两块物理网卡，（重新启动服务，vi就能看见了）<br />
esxcfg-vswitch -a vSwitch1<br />
esxcfg-vswitch -A internal vSwitch1<br />
esxcfg-vswitch -L vmnic1 vSwitch1<br />
esxcfg-vswitch -L vmnic2 vSwitch1<br />
10：删除交换机,(注意，别把控制台的交换机也删了）<br />
esxcfg-vswitch -D vSwitch1<br />
11：删除交换机上的网卡<br />
esxcfg-vswitch -u vmnic1 vswitch2<br />
12：删除portgroup<br />
esxcfg-vswitch -D internel vswitch1<br />
13：创建 vmkernel switch ，如果你希望使用vmotion，iscsi的这些功能，你必须创建( 通常是不需要添加网关的）<br />
esxcfg-vswitch -l<br />
esxcfg-vswitch -a vswitch2<br />
esxcfg-vswitch -A "vm kernel" vswitch2<br />
esxcfg-vswitch -L vmnic3 vswitch2<br />
esxcfg-vmknic -a "vm kernel" -i 172.16.1.141 -n 255.255.252.0<br />
esxcfg-route 172.16.0.254<br />
14：打开防火墙ssh端口<br />
esxcfg-firewall -e sshclient<br />
esxcfg-firewall -d sshclient<br />
15: 创建控制台<br />
esxcfg-vswitch -a vSwitch0<br />
esxcfg-vswitch -A "service console" vSwitch0<br />
esxcfg-vswitch -L vmnic0 vSwitch0<br />
esxcfg-vswif -a vswif0 -p "service console" -i 172.16.1.140 -n 255.255.252.0<br />
16: 添加nas设备(a 添加标签，-o，是nas服务器的名字或ip，-s 是nas输入的共享名字）<br />
esxcfg-nas -a isos -o nas.vmwar.cn -s isos<br />
17：列出nas连接<br />
esxcfg-nas -l<br />
18: 强迫esx去连接nas服务器(用esxcfg-nas -l 来看看结果）<br />
esxcfg-nas -r<br />
esxcfg-nas -l<br />
19：连接iscsi 设备(e:enable q:查询 d：disable s:强迫搜索）<br />
esxcfg-swiscsi -e<br />
20：设置targetip<br />
vmkiscsi-tool -D -a 172.16.1.133 vmhba40<br />
21：列出和target的连接<br />
vmkiscsi-tool -l -T vmhba40<br />
22：列出当前的磁盘<br />
ls -l /vmfs/devices/disks</p>
<p><span style="font-size: small;">http://itil.org.cn/thread-1336-1-1.html<br />
There are two ways you can change the IP address:<br />
From the VI Client<br />
Or, from the Physcial Console Connection<br />
See the following sections for details on each method.</span></p>
<p><span style="font-size: small;">From the VI Client</span></p>
<p><span style="font-size: small;">Using the Virtual Infrastructure Client, the DNS information (Configuration tab &gt; DNS and Routing) can be changed on the fly. Similarly, the gateway address (routing subtab of the DNS and Routing window) and the hostname (DNS Configuration subtab of DNS and Routing) can be changed through the user interface. Hostname and domain changes through the VI Client do not take place until the ESX host is rebooted.</span></p>
<p><span style="font-size: small;">From the Physical Console Connection</span></p>
<p><span style="font-size: small;">Changing the IP for the service console must be done from a physical console connection, either at the host, through a KVM or other remote console connection. If you make changes through a network connection such as SSH, network connectivity to the service console will disconnect because the service console's network interface will change.<br />
For this example, it is assumed that vswif0 is the service console adapter that is the interface to which to apply the IP address change. Running the command </span></p>
<p><span style="font-size: small;">esxcfg-vswif -i x.x.x.x vswif0 </span></p>
<p><span style="font-size: small;">will set the IP address to the value substituted for x.x.x.x in the command. You will need to edit the /etc/hosts file and change it so that it reflects the new IP address in use for the service console.<br />
The gateway address and hostname are in /etc/sysconfig/network.</span></p>
<p><span style="font-size: small;">After you edit these files, you must reboot the host or restart the network service using the following command:</span></p>
<p><span style="font-size: small;">service network restart </span></p>
<p><span style="font-size: small;">Note: This command breaks any current network connections to the service console.</span></p>
<p><span style="font-size: small;">You can also dynamically change the host name using the command:</span></p>
<p><span style="font-size: small;">hostname newname</span></p>
<p><span style="font-size: small;">Note: This command creates a temporary host name change. This change is lost when the system is rebooted.</span></p>
<p><span style="font-size: small;">To change the DNS server settings, edit the /etc/resolv.conf file and update the nameserver IPs and search domain if applicable.</span></p>
<p><span style="font-size: small;"> </span></p>
<p><span style="font-size: small;"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/134/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMware ESXi 3.5开启SSH</title>
		<link>http://www.187299.com/archives/135</link>
		<comments>http://www.187299.com/archives/135#comments</comments>
		<pubDate>Fri, 06 Mar 2009 11:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[虚拟化]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.momati.net/archives/135</guid>
		<description><![CDATA[刚装好Vmware ESXi，发现确实非常好用，比Vmware Server也方便很多，但在使用时发现Vmware Infrastructure client中的上传 功能好像不能用，研究了半天也未找到具体原因，问了kenneth了解到Vmware Esxi还可以... ]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;">刚装好Vmware ESXi，发现确实非常好用，比Vmware Server也方便很多，但在使用时发现Vmware Infrastructure client中的上传 功能好像不能用，研究了半天也未找到具体原因，问了kenneth了解到Vmware Esxi还可以打开SSH上传，参见他的Blog:http://blog.24reader.com/ken666/2008/08/27/esxi-ssh/。</span></p>
<div>
<div id="art" style="margin: 15px;">
<div><span style="font-size: small;">整理如下：</span></div>
<div><span style="font-size: small;"> 1、 在控制台上按Alt+1键<br />
2、看到控制台文字后，直接输入”unsupported“ ，注意这时没有光标，也不会显示你的输入。<br />
3、输入完成后输入Root密码，就进入了相当于Linux的控制台。<br />
4、编辑：/etc/inetd.conf  找到#SSH 这一行，把#号去掉，保存。<br />
5、执行： /sbin/services.sh restart<br />
6、执行：ps | grep inetd 查看对应的pid，然后：kill -HUP &lt;process_id&gt;</span></div>
<div><span style="font-size: small;">这时就可以用SSH登录了，登录后如果想上传 ISO文件的话直接找到：  /vmfs/volumes/对应的datastore对应的位置，然后上传即可。</span></div>
<div></div>
<div><span style="font-size: small;">但貌似不能用SFTP功能！支持SCP</span></div>
<div>转载自：<a href="http://blog.chinaunix.net/u3/91738/showart_1827896.html">http://blog.chinaunix.net/u3/91738/showart_1827896.html</a></div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/135/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vmware server 1.0.6 for linux相关命令</title>
		<link>http://www.187299.com/archives/144</link>
		<comments>http://www.187299.com/archives/144#comments</comments>
		<pubDate>Tue, 09 Dec 2008 12:08:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.momati.net/archives/144</guid>
		<description><![CDATA[vmware server 1.0.6 for linux 一、服务启动、关闭等,跟普通服务的启动一样 /etc/init.d/vmware {start&#124;stop&#124;status&#124;restart} 如果启动正常，用status参数查看，则应该会有如下信息： [root@vmware svn.abc.net... ]]></description>
			<content:encoded><![CDATA[<p>vmware server 1.0.6 for linux</p>
<p>一、服务启动、关闭等,跟普通服务的启动一样<br />
/etc/init.d/vmware {start|stop|status|restart}</p>
<p>如果启动正常，用status参数查看，则应该会有如下信息：<br />
[root@vmware svn.abc.net]# /etc/init.d/vmware status<br />
At least one instance of VMware Server is still running.</p>
<p>Bridged networking on /dev/vmnet0 is running<br />
Host-only networking on /dev/vmnet8 is running<br />
NAT networking on /dev/vmnet8 is running<br />
Module vmmon loaded<br />
Module vmnet loaded</p>
<p><span id="more-144"></span></p>
<p>查看进程 ps aux | grep vmware,信息如下：</p>
<p>root      4623  0.0  0.0  1636  328 ?        Ss   09:43   0:00 /usr/bin/vmnet-natd -d /var/run/vmnet-natd-8.pid -m /var/run/vmnet-natd-8.mac -c /etc/vmware/vmnet8/nat/nat.conf<br />
root      4629  0.0  0.3 17380 14692 ?       Ss   09:43   0:02 /usr/sbin/vmware-serverd -s -d<br />
root      4653  0.0  0.0  1640  220 ?        Ss   09:43   0:00 /usr/bin/vmnet-dhcpd -cf /etc/vmware/vmnet8/dhcpd/dhcpd.conf -lf /etc/vmware/vmnet8/dhcpd/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8<br />
root      4919  5.1 28.2 1277260 1172768 ?   S&lt;sl 09:55   7:43 /usr/lib/vmware/bin/vmware-vmx -C /vmware/vmware/Windows.2003/Windows Server 2003 Enterprise Edition.vmx -@ ""<br />
root      5669 13.6  5.6 362908 234864 ?     S&lt;sl 11:04  11:16 /usr/lib/vmware/bin/vmware-vmx -C /vmware/vmware/svn.abc.net/Red Hat Enterprise Linux 4.vmx -@ ""<br />
root      5686  1.1  0.0     0    0 ?        S&lt;   11:04   0:57 [vmware-rtc]<br />
root      5767  0.0  0.0  4872  648 pts/1    S+   12:26   0:00 grep vmware</p>
<p>二、命令行启动虚拟机<br />
vmrun命令参数：<br />
[root@vmware svn.abc.net]# vmrun --help<br />
Invalid switch -help<br />
vmrun version 1.0.6 build-91891</p>
<p>Usage: vmrun [Authentication flags] COMMAND [PARAMETERS]</p>
<p>Authentication flags<br />
-h &lt;hostName&gt;<br />
-P &lt;hostPort&gt;<br />
-u &lt;userName&gt;<br />
-p &lt;password&gt;</p>
<p>COMMAND          PARAMETERS                  DESCRIPTION<br />
list                                         List all running VMs<br />
start            Path to vmx file            Start a VM<br />
stop             Path to vmx file            Stop a VM<br />
reset            Path to vmx file            Reset a VM<br />
suspend          Path to vmx file            Suspend a VM<br />
upgradevm        Path to vmx file            Upgrade VM file format, virtual hw<br />
installtools     Path to vmx file            Install Tools in Guest OS<br />
snapshot         Path to vmx file            Create a snapshot of a VM<br />
deleteSnapshot   Path to vmx file            Remove a snapshot from a VM<br />
revertToSnapshot Path to vmx file            Set VM state to a snapshot</p>
<p>Examples:<br />
vmrun list<br />
vmrun upgradevm w2k.vmx</p>
<p>因为新建虚拟机时，vmware新建的机器名默认是有空格的，不过不要紧，系统会自动在空格前添加转移字符:\，如下</p>
<p>vmrun start /vmware/wmware/Red\ Hat\ Enterprise\ Linux\ 4.vmx</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/144/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vmware-server目标主机积极拒绝,无法连接</title>
		<link>http://www.187299.com/archives/143</link>
		<comments>http://www.187299.com/archives/143#comments</comments>
		<pubDate>Tue, 09 Dec 2008 12:06:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.momati.net/archives/143</guid>
		<description><![CDATA[昨天重启了Linux服务器，服务器上装了结果在XP下无法用VMware Server Console远程连过去，一直显示“目标主机积极拒绝,无法连接”，迫于无奈，用命令行启动了虚拟机，下班后继续Google，找到了这... ]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;">昨天重启了Linux服务器，服务器上装了结果在XP下无法用VMware Server Console远程连过去，一直显示“目标主机积极拒绝,无法连接”，迫于无奈，用命令行启动了虚拟机，下班后继续Google，找到了这篇文章,用service xinetd status查看xinetd是关着的，用service xinetd start就可以打开了。</span></p>
<p><span style="font-size: small;"><span id="more-143"></span><br />
</span></p>
<p><span style="font-size: small;">Vmware-server 安装过程问题</span></p>
<p><span style="font-size: small;">今天安装VMware-server-1.0.3遇到不少问题,让我熟悉了”目标主机积极拒绝,无法连接”,以前安装读非常顺利,今天就这么特别,KAO.<br />
这次用的centos5 X64位的系统,可能的因素应该就是他,安装过程提示xinetd未安装,那我就<br />
yum install xinetd<br />
安装嘛.安装好后再次安装vmware,到最后出现<br />
Starting VMware services:<br />
Virtual machine monitor<br />
done<br />
Virtual ethernet done<br />
Bridged networking on /dev/vmnet0<br />
done<br />
Host-only networking on /dev/vmnet1 (background) done<br />
Bridged<br />
networking on /dev/vmnet2 done<br />
Host-only networking on /dev/vmnet8<br />
(background) done<br />
NAT service on /dev/vmnet8 done<br />
Virtual ethernet<br />
failed<br />
经过网上查呀查,发现是vmware-player 服务引起的,并在/etc/vmware/目录下产生了not_configured文件,<br />
具体地址是:http://www.debuntu.org/vmware-server-not-starting-after-reboot<br />
按照这方法操作完,reboot,无效.他NND,邪门了真是.因为以前32位的系统安装都没问题的,所以就去32位的系统上查查了,费了9牛2虎之力,终于发现现在的机器缺少一个vmnet的模块,如<br />
[root@localhost ~]# lsmod|grep vmnet<br />
# vmnet                 106288  13<br />
难道是这模块没有编译通过?把32位系统的vmnet.ko复制到64位系统上加载此模块,失败.郁闷了..<br />
执行vmware-uninstall.pl<br />
把vmware卸了先,重新安装,这次/lib/modules/2.6.18-8.el5/misc终于看见vmnet.ko<br />
vmnet.o两个文件了,安装完毕,启动服务过程先前的问题消失.<br />
新的问题来鸟,ifconfig能看到启动的vmnet1和vmnet8设备,用VMware-console却连接不上…<br />
telnet IP xinetd_port(telnet 125.65.110.121<br />
904)<br />
能连接,出现<br />
220 VMware Authentication Daemon Version 1.10: SSL Required,<br />
MKSDisplayProtocol:<br />
VNC<br />
说明vmware服务对外对了,怎么VMware-console就是出现”目标主机积极拒绝,无法连接”<br />
再一次进32位的系统,检查他的xinetd分配给vmware端口居然是902,现在装的杂就变成904了呢….<br />
2话不说,将现在的机器xinetd分配给vmware端口改为902<br />
vi /etc/xinetd.d/vmware-authd<br />
# default: on<br />
# # description: The VMware remote access authentification daemon<br />
# service vmware-authd<br />
# {<br />
#     disable         = no<br />
#     port            = 902<br />
#     socket_type     = stream<br />
#     protocol        = tcp<br />
#     wait            = no<br />
#     user            = root<br />
#     server          = /usr/sbin/vmware-authd<br />
#     type            = unlisted<br />
# }<br />
重新启动xinetd,<br />
oh….能连接了.<br />
</span></p>
<p><span style="font-size: small;">转载的：本文来自ChinaUnix博客，如果查看原文请点：http://blog.chinaunix.net/u/31547/showart_1082299.html</span><span style="font-size: small;"></p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/143/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vmware,qemu各种方式上网设置</title>
		<link>http://www.187299.com/archives/172</link>
		<comments>http://www.187299.com/archives/172#comments</comments>
		<pubDate>Mon, 16 Jun 2008 08:25:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[虚拟化]]></category>

		<guid isPermaLink="false">http://www.momati.net/archives/172</guid>
		<description><![CDATA[vmware三种网络连接,qemu两种网络连接实现 虚拟机&#60;---&#62;主机 虚拟机&#60;---&#62;互联网通信的方法。 顺便写了下如何不重新编译整个内核支持某个功能,对系统无影响,编译速度要快于编译整个... ]]></description>
			<content:encoded><![CDATA[<p>vmware三种网络连接,qemu两种网络连接实现 虚拟机&lt;---&gt;主机</p>
<p>虚拟机&lt;---&gt;互联网通信的方法。<br />
顺便写了下如何不重新编译整个内核支持某个功能,对系统无影响,编译速度要快于编译整个内核。<br />
如果你的XXX卡没被内核支持,又怕自己编译的内核会造成系统损坏就可以试试这个方法喽</p>
<p>^_^</p>
<p><span id="more-172"></span></p>
<p><span style="font-weight: bold;">vmware三种网络连接上网设置：</span></p>
<p><span style="font-weight: bold; color: #ee040b;">1.bridge : </span><br />
默认使用vmnet0<br />
将虚拟机的ip设置与主机同网段未使用ip,其余与主机相同:<br />
例如主机ip是10.70.54.31,设置虚拟机ip为10.70.54.22。netmask,broadcast,gateway,dns都与主机相同即可实现虚拟机&lt;---&gt;主机</p>
<p>虚拟机&lt;----&gt;互联网 通信。</p>
<p><span style="font-weight: bold; color: #ee040b;">2.nat </span></p>
<p>:<br />
默认使用vmnet8<br />
将虚拟机设置成使用dhcp方式上网,windows下选择"自动获取ip",linux下开启dhcp服务即可<br />
也可以手动设置:<br />
ip设置与vmnet8同网段,gateway设置成vmnet8的gateway(/<span style="color: #2f0ef9;">etc/vmware/vmnet8/nat/nat.conf</span>)中可以查到vmnet8的gateway,通常是xxx.xxx.xxx.2。<br />
netmask,broadcast设置与vmnet8相同,dns设置与主机相同。<br />
例如</p>
<p>vmnet8 ip:172.16.249.1 gw :172.16.249.2<br />
虚拟机设置: ip :172.16.249.100  gw:</p>
<p>172.16.249.2</p>
<p><span style="font-weight: bold; color: #fb0328;">3.host-only </span></p>
<p>:<br />
默认使用vmnet1</p>
<p>将虚拟机ip设置与vmnet1同网段,gateway设置成vmnet1的ip,其余设置与vmnet1相同,dns设置与主机相同<br />
例如</p>
<p>vmnet1 ip :172.16.245.1<br />
虚拟机设置: ip :172.16.245.100 gateway :172.16.245.1</p>
<p>这样就实现了虚拟机&lt;---&gt;主机 通信,但是 虚拟机&lt;---&gt;互联网 仍无法通信</p>
<p><span style="font-weight: bold;">虚拟机与互联网通信： </span><br />
<span style="color: #700eff;">1.开启主机路由功能</span><br style="color: #700eff;" /><span style="color: #700eff;">2.设定iptables，使主机成为一台nat server</span><br />
1. <span style="color: #700eff;">echo 1 &gt;/proc/sys/net/ipv4/ip_forward </span></p>
<p>这样就主机就具有了路由功能<br />
2. <span style="color: #700eff;">iptables -t nat </span></p>
<p>-A POSTROUTING -o eth0 -s 172.16.245.0/24 -j</p>
<p>MASQUERADE<br />
这条规则意思是将来自172.16.245.0/24封包的来源ip伪装成eth0的ip，实现虚拟机与互联网通信<br />
如果网络接口是ppp+或pppoe则需要修改成-o</p>
<p>pppoe<br />
当然-s  172.16.245.0/24 也要根据实际情况修改</p>
<p><span style="font-weight: bold; color: #f90319;">qemu两种上网方式： </span></p>
<p><span style="font-weight: bold;">user mode network </span></p>
<p>:<br />
这种方式实现虚拟机上网很简单，类似vmware里的nat，qemu启动时加入<span style="color: #5d08f9;">-user-net</span>参数，虚拟机里使用dhcp方式，即可与互联网通信，但是这种方式虚拟机与主机的通信不方便。</p>
<p><span style="font-weight: bold;">tap/tun network : </span><br />
这种方式要比user</p>
<p>mode复杂一些，但是设置好后 虚拟机&lt;--&gt;互联网 虚拟机&lt;--&gt;主机 通信都很容易</p>
<p>这种方式设置上类似vmware的host-only,qemu使用tun/tap设备在主机上增加一块虚拟网络设备(tun0),然后就可以象真实网卡一样配置它.</p>
<p><span style="color: #fd0220;">首先内核中支持tap/tuns设备：</span><br />
Device Drivers</p>
<p>---&gt;<br />
Networking support  ---&gt;<br />
[M] Universal TUN/TAP</p>
<p>device driver support<br />
<span style="font-weight: bold;">如果当前内核没有支持，可以重新只编译相应模块加入，方法很简单：</span></p>
<p>将当前内核配置文件cp到内核源码目录下:<br />
[root@LFS</p>
<p>~]#<span style="color: #3d0cff;">cp /boot/config-[kernel-version] </span></p>
<p>/usr/src/linux<br />
[root@LFS ~]#<span style="color: #3d0cff;">cd </span></p>
<p>/usr/src/linux<br />
配置内核，将TUN/TAP选择模块(M)，如上所示:<br />
[root@LFS ~]#<span style="color: #3d0cff;">make menuconfig </span><br />
重新只编译模块(M),不编译核心(*)支持的东东:<br />
[root@LFS ~]#<span style="color: #3d0cff;">make </span></p>
<p>modules<br />
编译好后在/usr/src/linux/drivers/net下可以找到tun.ko:<br />
[root@LFS</p>
<p>net]#<span style="color: #3d0cff;">ls -l </span></p>
<p>/usr/src/linux/drivers/net/tun.ko<br />
-rw-r--r--  1 root root 11116 Mar 23</p>
<p>20:29 /usr/src/linux/drivers/net/tun.ko<br />
[root@LFS</p>
<p>net]#<br />
将它cp到当前内核的模块目录的相应位置：<br />
[root@LFS net]#<span style="color: #3d0cff;">cp /usr/src/linux/drivers/net/tun.ko </span></p>
<p>/lib/modules/`uname -r`/kernel/drivers/net<br />
重新建立模块依赖关系：<br />
[root@LFS</p>
<p>net]#<span style="color: #3d0cff;">depmod</span><br />
现在就可以加载它了</p>
<p>:<br />
[root@LFS net]#<span style="color: #3d0cff;">modprobe </span></p>
<p>tun<br />
检查一下：<br />
[root@LFS net]#<span style="color: #3d0cff;">lsmod </span></p>
<p>|grep tun<br />
tun                     8704  0<br />
[root@LFS net]#<br />
<span style="font-weight: bold; color: #f30a26;">OK. 成功不重新编译整个内核加入特殊模块支持 </span></p>
<p><span style="color: #f30a26;">如果你的xx卡不被内核支持，又可以编译成模块，自己怕重新编译内核后出问题就可以用这个办法只编译自己需要的模块，然后手动安装到相应位置，再加载它。 </span><br />
这样编译速度要也比编译整个内核快，不会对系统有任何损害，就可以使用上XX卡喽。^_^</p>
<p><span style="font-weight: bold;">要注意三点：</span><br />
<span style="color: #620af2;">1.内核源码必须与当前内核版本完全一致，否则编译出的模块是不能用的。 </span><br />
<span style="color: #f90959;">2.注意只make modules(编译模块),没有make </span></p>
<p>modules_install(自动安装模块到/lib/modules下)<br />
3.加载新编译的模块前必须先运行<span style="color: #6d0cf9;">depmod</span>，否则<span style="color: #6d0cf9;">modprobe</span>找不到它</p>
<p>其实使用当前内核配置文件(/boot/config-[kernel-version]),只加入自己需要的模块，不做任何其他改，make</p>
<p>modules_install应该也不会有问题的。<br />
不过最稳妥的办法还是手动安装它,控制权在自己手里更踏实嘛</p>
<p>:-)</p>
<p>OK,转回qemu上网问题 :)</p>
<p>如果使用udev管理设备(通常2.6.x内核的发行版都已经使用udev),当<span style="color: #6d0cf9;">modprobe </span></p>
<p>tun后就会自动建立/dev/net目录，并创建出tun设备，做好相关链接：<br />
[root@LFS net]#<span style="color: #6d0cf9;">ls -l /dev/net/tun</span><br />
lrwxrwxrwx  1 root</p>
<p>root 6 Mar 25 15:35 /dev/net/tun -&gt; ../tun<br />
[root@LFS</p>
<p>net]#</p>
<p>如果很不幸，你没看到它，就需要自己手动做这些工作了 :(<br />
[root@LFS ~]#<span style="color: #6d0cf9;">mkdir /dev/net</span><br />
[root@LFS ~]#<span style="color: #6d0cf9;">mknod /dev/net/tun c 10 </span></p>
<p>200<br />
OK,相关设备已经准备好了，还需要一个tun/tap的初始化脚本 :<br />
<span style="color: #f4022e;">/etc/qemu-ifup </span></p>
<p>:<br />
#!/bin/sh<br />
/sbin/ifconfig $1 172.20.0.1<br />
再给予qemu-ifup</p>
<p>x执行权限放在/etc下就可以了。<br />
这个脚本只能root用户执行，如果需要普通用户使用qemu，就需要改成<span style="color: #4708f9;">sudo /sbin/ifconfig </span></p>
<p>.....再设置sudo相关权限。<br />
启动qemu后，它会在主机上增加一块虚拟网络设备(tun0):<br />
[root@LFS</p>
<p>~]#<span style="color: #4708f9;">ifconfig tun0</span><br />
tun0      Link</p>
<p>encap:Ethernet  HWaddr 0A:D3:8A:5D:97:CD<br />
inet addr:<span style="color: #f4093b;">172.20.0.1 </span> Bcast:<span style="color: #f4093b;">172.20.255.255</span> Mask:<span style="color: #f4093b;">255.255.0.0</span><br />
UP BROADCAST</p>
<p>RUNNING MULTICAST  MTU:1500  Metric:1<br />
RX packets:0 errors:0</p>
<p>dropped:0 overruns:0 frame:0<br />
TX packets:0 errors:0 dropped:0</p>
<p>overruns:0 carrier:0<br />
collisions:0 txqueuelen:500<br />
RX</p>
<p>bytes:0 (0.0 b)  TX bytes:0 (0.0 b)<br />
[root@LFS</p>
<p>~]#<br />
现在就可以启动qemu配置虚拟机网络参数了，和vmware host-only一样:<br />
<span style="color: #4304f4;">ip与tun0相同网段,gateway为tun0 ip </span></p>
<p>其余参数与tun0相同,dns与主机相同：<br />
tun0 : <span style="color: #f30c2e;">ip </span></p>
<p>:172.20.0.1 broadcast:172.20.255.255 netmask :255.255.0.0<br />
qemu :</p>
<p><span style="color: #4304f4;">ip :172.20.0.100 </span></p>
<p>broadcast:172.20.255.255 netmask :255.255.0.0 <span style="color: #4304f4;">gateway:172.20.0.1</span></p>
<p>与host-only一样，这样只实现了虚拟机&lt;----&gt;主机间通信,还需要设置router,nat才可以连上互联网</p>
<p>[root@LFS ~]#<span style="color: #6408fb;">echo 1 &gt; </span></p>
<p>/proc/sys/net/ipv4/ip_forward<br />
[root@LFS ~]#<span style="color: #6408fb;">iptables -t nat -A POSTROUTING -o eth0 -s </span></p>
<p>172.20.0.0/24 -j MASQUERADE<br />
[root@LFS ~]#</p>
<p>OK，虚拟机&lt;---&gt;主机</p>
<p>虚拟机&lt;----&gt;互联网通信 都完成啦<br />
快去做网络实验吧 ^_^</p>
<p>转载自：http://www.vmware.cn/Article/376.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/172/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

