最近常常遇到一些光怪陸離的事情,有些東西實在不能在實際的production環境下測試。
因為測試如果一出差錯,導致系統連不上的話,部門電話就會被call爆。然後就會被叫進去主管Office夾卵蛋...
為了不想讓上述事情發生,所以就使用一下這近幾年來,非常火熱的虛擬機器。
虛擬機器到底是啥??麻煩請至google查詢,會讓虛擬機器到底是啥的解答更為明瞭。
常見的虛擬機器有Sun Microsystems VirtualBox (現在改為Oracle負責開發) and VMware Workstation and Play
在此次的教學裡,我所使用的是VMware Workstation 8 (之前考過VCP5就會送一套workstaion8了,現在應該換9了)
首先:
1、做虛擬系統之前,先想好自己想要做(或者是測試)的系統是什麼。
舉例來說,我最常做的就是弄個簡中系統winXP 32bit、win2008 R2、Redhat
來測試一下新開發的ap能不能run,能不能正確的傳送資料...等。
2、底層硬體及OS環境,通常都是windows的系統。
再來就是硬體的環境,建議使用intel的CPU,因為不是太爛的CPU通常都有HT(Hyper-Threading)功能
記憶體、硬碟當然是愈"大"愈"快"愈好...(虛擬化很吃I/O的,HD不快,會跑到很想死)
目前我的測試環境架構為(筆電 TP-x201i):
windows 7 64bit , intel i3-M370 , 8G DDR3 ram , 256G SSD
本次測試的環境為搭建兩台VMware ESXi Server and 一台win 2008 R2
網路的部份透過兩張Workstation vNIC 來做調整。
首先,開啟workstation後,點選Edit -> Virtual Network Editor...
點選之後會看到兩張卡,通常安裝完畢後,Workstation就會安裝兩張虛擬網卡在系統上
在此要調整的為VMnet1、VMnet8這兩張vNIC
VMnet1 設定為 Server專用網段 Type set "Host-only",DHCP set "Disabled"
VMnet8 設定為 一般使用網段 Type set "NAT",DHCP set "Enabled"
由於還有不少人不曉得Bridged、NAT、Host-only這三個的不同差別
底下是截錄自VMfaq的一些介紹
Comparison of the network types | ||||||
Type | Bridged |
NAT |
Host-only | |||
Description |
The VM appears as if it was |
The VM hides behind the IP address of the VMware host. Other VMs in the same NAT network can access it directly. | The VM can only access the VMware host and other VMs in the same host-only network | |||
IP address | The VM requires it's own IP address from the network it is supposed to belong to. | The VM can have any private IP configured on the VMware host. | ||||
Accessibility from network | Same as a physical host | Hides behind NAT, so port forwarding on the VMware host required if external access required | Not accessible from external network unless routed via another VM with access to both external network and the same host-only network | |||
Use cases | An always-on server hosted on VMware, or a virtual router or firewall | VMs intended for testing, or cases when the amount of IP addresses in the external network is limited. | VMs intended for testing with no need to access the network, or VMs which will be protected by a firewall in another VM. | |||
Other | Known to have problems with some wireless chipsets especially with Linux, also with Windows Vista. | NAT is really a host-only network with a default gateway (on the VMware host) that routes and NATs. |
(目前先以英文顯示,之後我再翻譯成中文(白話一點 XD))
在VMnet8中,細部的設定項目
在此設定NAT的範圍,是否需要指定轉到某個port出去,也可以從此處設定。
接下來就是DHCP的設定範圍,依據需求進行DHCP設定。
最重要的網路設定完畢後,當然就是設定虛擬主機的一些細節設定。
在此,我就不說明虛擬主機的建置方式,直接把建置完畢後,有一些需要調整的小細節跟各位說明。
虛擬主機建立完畢後,在所設立的虛擬主機上,按滑鼠右鍵選擇Settings...
在此可以看到我已經預先設定好兩張Network Adapter
Network Adapter -> Custom
Network Adapter 2 -> Custom
點選旁邊的 Advanced...,可以看到網路卡的細部設定,如修改MAC...等。
經過了一陣手忙腳亂兼亂搞後,可以測試又可以惡搞的Lab就出現了....
雖然只是個微不足道的小說明,但是我還是希望有操作過的網友們,若有問題,也可以提出來一起討論喔!