開啟Virtual Box 外連服務

由 andy 發表於 六月 23, 2011 / 尚無評論

開啟命令提示字元
進入你安裝virtualbox的目錄;
cd "c:\Program Files\sun\VirtualBox"
執行以下的指令;
VBoxManage setextradata [Ubuntu] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
VBoxManage setextradata [Ubuntu] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata [Ubuntu] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 3456
比較要注意的是"ubuntu"是你安裝在virtualbox上系統的名稱, 
port3456則看你自己設定;

設定http連線則複製以上指令,ssh改成http即可.
VBoxManage setextradata  [input your vb_name]  "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" TCP 
VBoxManage setextradata  [input your vb_name] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" 80 
VBoxManage setextradata  [input your vb_name] "VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" 8000

接著重新執行virtualbox即可,第一次設定請重CMD 下指令 直接修改XML可能會失敗詳細原因尚未查明
以上設定或者到目錄下C:\Users\Administrator\.VirtualBox\Machines\Work\ 找該機器的xml  
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ftp/GuestPort" value="21"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ftp/HostPort" value="2121"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ftp/Protocol" value="TCP"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/GuestPort" value="80"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/HostPort" value="8000"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/http/Protocol" value="TCP"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" value="22"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" value="2222"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" value="TCP"/>

在ubuntu預設似乎沒有ssh,
進入root權限,
apt-get install ssh 下載安裝; 

FTP相關:

How to get PASV FTP to work behind a NAT router with ProFTPD

繼續閱讀 »