VMWare不支援eth-tool,mii-tool等工具及使用E1000網路卡

victorymoshui發表於2010-09-06
 在VMWare中安裝Linux時發現無法使用eth-tool,mii-tool等工具查詢網路卡的資訊,導致一些程式都不能工作,其實是虛擬網路卡的問題。

    一直以來,VMware都在虛擬客戶機中提供的是古老的AMD PCNet10/100Mbps虛擬網路卡,後來,VMware通過一種類似部分虛擬化的vmxnet優化虛擬網路卡的方式提供了10/100 /1000Mbps效能,無疑效能更好。現在,VMware ESX Server已經可以提供基於Intel E1000的千兆虛擬網路卡,從相容性和效能的角度來看,E1000都是更好的選擇。但似乎,在ESX/ESXi 3.5的圖形介面中,都無法直接選擇該網路卡型別,需要手動配置。

一、為什麼要用E1000
原有很很多,其中最主要的有兩個:
1、PCNet32 網路卡太古老
這個古老的意思是,該網路卡已經不適應新作業系統的要求了。而且也不支援mii-tool等檢測工具,過去用虛擬客戶機測試HA叢集時,就無法監控虛擬的PCNet32 網路卡。
甚至在 Linux kernel的預設配置中,都需要費一番功夫才能找到該網路卡的編譯模組選項。
2、效能
現在的伺服器基本都提供千兆的網路卡,若虛擬客戶機中仍只提供100Mbps虛擬網路卡,效能肯定會降低的。
另一方面,vmxnet與E1000的對比中,也會發現E1000的效率更高,見 這裡
因此,建議把虛擬客戶機中的網路卡設定為Intel E1000型別。

 

二、指定網路卡型別

2、預設配置
在Linux中,為PCNet32 網路卡:

引用
# lspci -v
00:11.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
        Subsystem: Advanced Micro Devices [AMD] PCnet - Fast 79C971
        Flags: bus master, medium devsel, latency 64, IRQ 177
        I/O ports at 1400 [size=128]
        [virtual] Expansion ROM at 50000000 [disabled] [size=64K]
# cat /etc/modprobe.conf|grep eth
alias eth0 pcnet32
# ethtool eth0
Settings for eth0:
        Current message level: 0x00000007 (7)
        Link detected: yes
# mii-tool eth0
SIOCGMIIPHY on 'eth0' failed: Operation not supported


3、修改配置
若希望把虛擬網路卡型別改為Intel E1000,直接修改對應虛擬客戶機的.vmx檔案:

先關閉VMWare WorkStation,不然修改會被覆蓋


加入或修改:

ethernet0.virtualDev = "e1000"


儲存即可。若有多個網路卡,採取同樣的操作。

值為"e1000"指定網路卡型別為Intel(R) PRO/1000
值為"vlance"指定網路卡型別為AMD PCNet AM79C970A(預設為此項)

值為"vmxnet"指定網路卡型別為VMware PCI Ethernet Adapter


重啟虛擬客戶機後,可看到結果:

引用
# lspci -v
00:13.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
        Subsystem: VMware Inc Abstract PRO/1000 MT Single Port Adapter
        Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 193
        Memory at f4840000 (64-bit, non-prefetchable) [size=128K]
        Memory at f4810000 (64-bit, non-prefetchable) [size=64K]
        I/O ports at 14c0 [size=64]
        [virtual] Expansion ROM at 50010000 [disabled] [size=64K]
        Capabilities: [dc] Power Management version 2
        Capabilities: [e4] PCI-X non-bridge device
# cat /etc/modprobe.conf|grep eth
alias eth0 e1000
# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000007 (7)
        Link detected: yes
# mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok


下面是VMware Guest Operating System Installation Guide中的一段內容:
The AMD Ethernet card driver included with certain Windows Vista builds—including 4074 and possibly others—does not work correctly or is not included with Windows. To use networking in these Windows Vista guest operating systems, you must change the network adapter. A driver for the vmxnet adapter is included in VMware Tools.
VMware GSX Server: Choose VM > Settings > Network Adapter (Windows) or VM > Settings > NIC (Linux), and select vmxnet as the virtual device to use. Then install VMware Tools. A driver for the vmxnet adapter is included in VMware Tools.
VMware Workstation 4.x or lower, or VMware ACE, on a Windows host: Use a text editor such as Notepad to edit the configuration (.vmx) file for your Windows Vista virtual machine. Add the following line:
Ethernet[n].virtualDev = "vmxnet"
Replace [n] with the number of the Ethernet adapter. The first Ethernet adapter is number 0, so the line for that adapter is
Ethernet0.virtualDev = "vmxnet"
Include a line for each Ethernet adapter configured for the virtual machine. Then install VMware Tools. A driver for the vmxnet adapter is included in VMware Tools.
VMware Workstation 4.x or lower on a Linux host: Choose VM > Settings, select Network Adapter, and then select vmxnet as the virtual device to use. Then install VMware Tools. A driver for the vmxnet adapter is included in VMware Tools.
VMware Workstation 5.0.x: Install VMware Tools. A driver for the network adapter is included in VMware Tools.
VMware Workstation 5.5.x and VMware Server 1.x: Install VMware Tools. A vmxnet driver for the network adapter is included in VMware Tools. Installing VMware Tools automatically switches the network adapter to vmxnet, and installs the vmxnet driver.
Alternatively, you can change the network adapter to e1000 (the Intel® PRO/1000 MT Adapter) before installing Windows Vista. Use a text editor such as Notepad to edit the configuration (.vmx) file for your Windows Vista virtual machine. Add the following line:
Ethernet[n].virtualDev = "e1000"
Replace [n] with the number of the Ethernet adapter. The first Ethernet adapter is number 0, so the line for that adapter is
Ethernet0.virtualDev = "e1000"
Include a line for each Ethernet adapter configured for the virtual machine.
ESX Server 2.x: In the Hardware page, under Network Adapter, click Edit. In the Network Adapter page, in the Device Binding list, select the virtual network device that you want the virtual machine to use. In the Virtual Device list, choose vmxnet. Then install VMware Tools. A driver for the vmxnet adapter is included in VMware Tools.
ESX Server 3.x: Install VMware Tools. A vmxnet driver for the network adapter is included in VMware Tools. Installing VMware Tools automatically switches the network adapter to vmxnet, and installs the vmxnet driver.
Alternatively, you can change the network adapter to e1000 (the Intel® PRO/1000 MT Adapter) before installing Windows Vista. Use a text editor such as Notepad to edit the configuration (.vmx) file for your Windows Vista virtual machine. Add the following line:
Ethernet[n].virtualDev = "e1000"
Replace [n] with the number of the Ethernet adapter. The first Ethernet adapter is number 0, so the line for that adapter is
Ethernet0.virtualDev = "e1000"
Include a line for each Ethernet adapter configured for the virtual machine.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9390331/viewspace-672781/,如需轉載,請註明出處,否則將追究法律責任。

相關文章