天天看點

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

我們知道vmware的網絡擴充卡類型有多種,例如e1000、vmxnet、

vmxnet 2

(enhanced)、vmxnet3等,就性能而言,一般vmxnet3要優于e1000,下面介紹如果将linux虛拟機的網絡擴充卡類型從

e1000改為vmxnet3。本文測試環境如下

           作業系統   :oracle linux server release 5.7

           虛拟機版本 :vmware 5.1

如下所示,測試前,我們可以先看看網卡類型為e1000, 此版本的linux似乎沒有配置檔案/etc/udev/rules.d/70-persistent-net.rules。隻有配置檔案60-net.rules.具體資訊請見下圖

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3
Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

方法1:在vsphere client中更改擴充卡類型

我們通過vsphere client用戶端,添加網絡擴充卡2(擴充卡類型為vmxnet3),然後删除網絡擴充卡1,重新開機伺服器

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

重新開機後,在/etc/sysconfig/network-scripts/下,你會看到有ifcfg-eth0和ifcfg-eth0.bak兩個配置檔案,系統自動生成了新的配置檔案并将原來的配置檔案重命名了

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

如下所示,新生成的配置檔案ifcfg-eth0是動态擷取ip,需要重新配置網絡資訊,重新開機網絡服務即可即可解決問題。

注意,在我多次測試驗證過程中,如果伺服器沒有安裝vmware

tools,那麼在操作過程中就會遇到“device eth0 does not seem to be present, delaying

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

方法2:修改.vmx 檔案來更改擴充卡類型

1:關閉lntest虛拟機。

2:選擇lntest,單擊右鍵選擇“從清單中移除”

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

3:在資料存儲浏覽器中找到lntest對應的目錄,找到lntest.vmx檔案。找到參數ethernet1.virtualdev(有可能為ethernet0)将其值從"e1000"改為"vmxnet3"

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3
Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

4: 選擇vmx檔案,将其“添加到清單”,然後重新開機電源,一切搞定,都不需要修改任何網絡配置資訊。

Linux 虛拟機網絡擴充卡從E1000改為VMXNET3

方法3:使用powercli修改網絡擴充卡類型

powercli,即vmware vsphere powercli 是一款功能強大的指令行工具來修改。 這個方法沒有實際驗證過,不過看其介紹,似乎是最簡單的一種方法。

<b>change the adapter type with powercli</b>

the easiest method to change the

adapter type is by using this little powercli command. just replace

&lt;vm&gt; with your virtual machines name. you can run this script

without disruption while the virtual machine is running but it’s not

active until you have powered off the virtual machine. a reboot does not

activate the configuration.

get-vm -name "&lt;vm&gt;" | get-networkadapter | where { $_.type -eq "e1000"} | set-networkadapter -type "vmxnet3"

prior to change please make sure

that your operating system contains the vmxnet3 driver or you have

installed the vmware tools. to check the required kernel module type

“modprobe vmxnet3“. if you don’t get an error message you should be

fine.

繼續閱讀