這是本文件的舊版!
目錄表
VirtualBox
Virtuatopia: VirtualBox 2 Essentials
下載
依照 OS 下載安裝檔。
安裝(Debian)
以 debian 而言,會缺少兩個相依套件:libxalan110、libxerces27,要先安裝。
# apt-get install libxalan110 libxerces27
# dpkg -i VirtualBox_1.3.8_Debian_etch_i386.deb
因為我有自己編 kernel,過程中需要重新編譯 kernel 加入新的 module 等等的,可能會遇到問題。解決方法是之前編 kernel 的 kernel-source 要留著。
加入群組
VirtualBox 會新增一個群組「vboxusers」,要去 /etc/group 將允許使用 VirtualBox 的使用者加入此群組中。
或者到「桌面」→「管理」→「使用者及群組」設定。
重新登入系統讓設定值生效。
使用
用右邊的 Ctrl 可以解除鎖定鍵盤滑鼠。
其他跟 VMware 差不多…
Port Forwarding
開啟 Port 讓外面可連進去 Guest OS。
首先將所有 Guest OS 及 VirtualBox 關掉,不然無法設定。
下面的範例為將 Guest OS 的 TCP Port 22 導到 Host OS 的 2222,其中 Protocol 前的「guestssh」為自訂的識別名稱:
VBoxManage setextradata "Guest OS Name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP VBoxManage setextradata "Guest OS Name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22 VBoxManage setextradata "Guest OS Name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222
若要刪除設定,最後一項數值不要填寫即可。
複製 .vdi
若直接複製 .vdi 檔案,加入 Vitual Media Manager 時,會出現 UUID 重複的錯誤:
Failed to open the hard disk D:\XP.vdi.
Cannot register the hard disk 'D:\XP.vdi' with UUID {5eaa4ad6-2742-480b-88f1-364b82c63c3d} because a hard disk 'D:\XP.vdi' with UUID {5eaa4ad6-2742-480b-88f1-364b82c63c3d} already exists in the media registry ('C:\Documents and Settings\test\.VirtualBox\VirtualBox.xml').
Result Code: E_INVALIDARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {779264f4-65ed-48ed-be39-518ca549e296}
必須要重新設定 .vdi 的 UUID:
VBoxManage internalcommands setvdiuuid [vdi路徑]
若出現以下畫面就成功了:
VirtualBox Command Line Management Interface Version 3.0.2 (C) 2005-2009 Sun Microsystems, Inc. All rights reserved. UUID changed to: 5dd9ca50-5ef1-4b3d-896e-c93a6ad9bdda
查詢設定
VBoxManage getextradata "VirtualXP" enumerate
Bridge
讓 Guest OS 的網路直接和 Host 的網卡接在一起。
安裝 uml-utilities 和 bridge-utils
apt-get install uml-utilities bridge-utils
產生 tap 連接
其中 <username> 為登入的使用者名稱。
tunctl -t tap0 -u <username>
成功後會出現:
Set 'tap0' persistent and owned by uid xxxx
產生 bridge
此 bridge 名稱為 br0。
brctl addbr br0
開啟網卡的 promiscuous 模式
ifconfig eth0 0.0.0.0 promisc
將真實網卡加入 bridge 的一端
brctl addif br0 eth0
將真實網卡的設定值設置到 br0
ifconfig br0 192.168.x.x
將產生的 tap 加入 bridge 另一端
brctl addif br0 tap0
啟動 tap
ifconfig tap0 up
設定 tun 讀寫權限
chmod 0666 /dev/net/tun
設定虛擬機器的網路卡介面
Setting → Network → Adapter0 選 HostInterface,Interface Name 填入 tap1。
Guest OS 的 IP 需和真實網卡同一個網域即可。
關閉 bridge
brctl delif br0 eth0 brctl delif br0 tap0 brctl delbr br0 ifconfig tap0 down ifconfig br0 down ifconfig eth0 down ifconfig eth0 up
USB 支援
comming soon……?
參考
Port forwarding:http://www.virtualbox.org/download/1.6.2/UserManual.pdf chapter:6.4.1
VMware
vSphere
Virtuatopia: VMware Server 2.0 Essentials
EasyVMX
線上建立 Virtual Machine 的映像檔。
VMWare Fusion
Port Forwarding in NAT Mode
sudo vi "/Library/Application Support/VMware Fusion/vmnet8/nat.conf"
[incomingtcp] 3128 = 192.168.19.69:3128
sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
