<?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>Linux ABC &#187; vmware</title>
	<atom:link href="http://www.linuxabc.net.cn/tag/vmware/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxabc.net.cn</link>
	<description>那些人/那些事...</description>
	<lastBuildDate>Tue, 09 Feb 2010 14:09:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>如何在Debian Etch中修改网卡id？</title>
		<link>http://www.linuxabc.net.cn/debian/how-to-modify-the-nic-id-on-debian.html</link>
		<comments>http://www.linuxabc.net.cn/debian/how-to-modify-the-nic-id-on-debian.html#comments</comments>
		<pubDate>Tue, 09 Sep 2008 17:09:44 +0000</pubDate>
		<dc:creator>alfie</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[网卡id]]></category>

		<guid isPermaLink="false">http://www.linuxabc.net.cn/?p=15</guid>
		<description><![CDATA[用户在使用VMware做实验的时候，往往需要创建多个虚拟机，为此，VMware提供了一个便利的功能：clone（克隆）。用户只需要装好一台虚拟机，然后使用clone功能就可以复制出多个虚拟机了，省时省事。
然而VMware为了避免目标和源这两台虚拟机之间的网卡冲突，在复制的过程中，自动修改了目标虚拟机网卡的MAC地址。于是当目标虚拟机启动的时候，系统就会赋予这些网卡新的id，譬如源虚拟机装了3张网卡，那么目标虚拟机的网卡id就是eth3、eth4和eth5，这是因为udev这个服务进程检测到有新的网卡（新的mac地址），于是重新加载驱动，赋予该网卡新的id（因为旧网卡id尚未删除）。假如在目标虚拟机上再重新clone，网卡id还会继续增长，这样的网卡id看起来很碍眼，我们来看看如何手工改变它。

修改udev的相关配置文件。

alfie@server:/ # vim /etc/udev/rules.d/zNN_persistent-net.rules
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==&#34;net&#34;, DRIVERS==&#34;?*&#34;, ATTRS&#123;address&#125;==&#34;00:0c:29:a8:e8:91&#34;, NAME=&#34;eth0&#34;
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==&#34;net&#34;, DRIVERS==&#34;?*&#34;, ATTRS&#123;address&#125;==&#34;00:0c:29:a8:e8:9b&#34;, NAME=&#34;eth1&#34;
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==&#34;net&#34;, DRIVERS==&#34;?*&#34;, ATTRS&#123;address&#125;==&#34;00:0c:29:a8:e8:a5&#34;, NAME=&#34;eth2&#34;
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==&#34;net&#34;, DRIVERS==&#34;?*&#34;, ATTRS&#123;address&#125;==&#34;00:0c:29:2e:e1:61&#34;, NAME=&#34;eth4&#34;
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==&#34;net&#34;, DRIVERS==&#34;?*&#34;, ATTRS&#123;address&#125;==&#34;00:0c:29:2e:e1:6b&#34;, NAME=&#34;eth3&#34;
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==&#34;net&#34;, DRIVERS==&#34;?*&#34;, ATTRS&#123;address&#125;==&#34;00:0c:29:2e:e1:57&#34;, NAME=&#34;eth5&#34;

配置文件中有6张网卡，实际在用的只有三张，其mac地址末尾分别是61，6b和57，eth0、eth1和eth2已经失效，我们只需将旧的th0、eth1、eth2注释掉，然后再将这几个网卡id赋予新的网卡即可。
修改后如下所示：

# PCI device 0x1022:0x2000 (pcnet32)
# SUBSYSTEM==&#34;net&#34;, DRIVERS==&#34;?*&#34;, ATTRS{address}==&#34;00:0c:29:a8:e8:91&#34;, NAME=&#34;eth0&#34;
# PCI [...]]]></description>
			<content:encoded><![CDATA[<p>用户在使用VMware做实验的时候，往往需要创建多个虚拟机，为此，VMware提供了一个便利的功能：clone（克隆）。用户只需要装好一台虚拟机，然后使用clone功能就可以复制出多个虚拟机了，省时省事。</p>
<p>然而VMware为了避免目标和源这两台虚拟机之间的网卡冲突，在复制的过程中，自动修改了目标虚拟机网卡的MAC地址。于是当目标虚拟机启动的时候，系统就会赋予这些网卡新的id，譬如源虚拟机装了3张网卡，那么目标虚拟机的网卡id就是eth3、eth4和eth5，这是因为udev这个服务进程检测到有新的网卡（新的mac地址），于是重新加载驱动，赋予该网卡新的id（因为旧网卡id尚未删除）。假如在目标虚拟机上再重新clone，网卡id还会继续增长，这样的网卡id看起来很碍眼，我们来看看如何手工改变它。</p>
<p><span id="more-15"></span><br />
修改udev的相关配置文件。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">alfie<span style="color: #000000; font-weight: bold;">@</span>server:<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #666666; font-style: italic;"># vim /etc/udev/rules.d/zNN_persistent-net.rules</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:a8:e8:91&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth0&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:a8:e8:9b&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth1&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:a8:e8:a5&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth2&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:2e:e1:61&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth4&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:2e:e1:6b&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth3&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:2e:e1:57&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth5&quot;</span></pre></div></div>

<p>配置文件中有6张网卡，实际在用的只有三张，其mac地址末尾分别是61，6b和57，eth0、eth1和eth2已经失效，我们只需将旧的th0、eth1、eth2注释掉，然后再将这几个网卡id赋予新的网卡即可。<br />
修改后如下所示：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #666666; font-style: italic;"># SUBSYSTEM==&quot;net&quot;, DRIVERS==&quot;?*&quot;, ATTRS{address}==&quot;00:0c:29:a8:e8:91&quot;, NAME=&quot;eth0&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #666666; font-style: italic;"># SUBSYSTEM==&quot;net&quot;, DRIVERS==&quot;?*&quot;, ATTRS{address}==&quot;00:0c:29:a8:e8:9b&quot;, NAME=&quot;eth1&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #666666; font-style: italic;"># SUBSYSTEM==&quot;net&quot;, DRIVERS==&quot;?*&quot;, ATTRS{address}==&quot;00:0c:29:a8:e8:a5&quot;, NAME=&quot;eth2&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:2e:e1:61&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth1&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:2e:e1:6b&quot;</span>, <span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth2&quot;</span>
<span style="color: #666666; font-style: italic;"># PCI device 0x1022:0x2000 (pcnet32)</span>
<span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;net&quot;</span>, <span style="color: #007800;">DRIVERS</span>==<span style="color: #ff0000;">&quot;?*&quot;</span>, ATTRS<span style="color: #7a0874; font-weight: bold;">&#123;</span>address<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;00:0c:29:2e:e1:57&quot;</span>,<span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">&quot;eth0&quot;</span></pre></div></div>

<p>重启电脑便大功告成了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxabc.net.cn/debian/how-to-modify-the-nic-id-on-debian.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
