1. 关闭VirtualBox虚拟机应用程序
2. 进入VirtualBox安装目录,比如: C:/Program Files/Oracle/VirtualBox>
3. 对于VirtualBox v3.2以后版本,可以使用如下一行简化命令轻松完成ssh-22端口转发配置
VBoxManage modifyvm "db6rl" --natpf1 "gliethttp_ssh,tcp,,2222,10.0.2.19,22"
4. 可以查看C:/Documents and Settings/luther/.VirtualBox/Machines/db6rl/db6rl.xml
将含有如下一行<Forwarding name="gliethttp_ssh" proto="1" hostport="2222" guestport="22"/>
5. 启动虚拟机中的db6rl系统
2. 进入VirtualBox安装目录,比如: C:/Program Files/Oracle/VirtualBox>
3. 对于VirtualBox v3.2以后版本,可以使用如下一行简化命令轻松完成ssh-22端口转发配置
【其中db6rl是我创建的虚拟机名称,请把它替换为你的虚拟机名称】
VBoxManage modifyvm "db6rl" --natpf1 "gliethttp_ssh,tcp,,2222,,22"
如果虚拟机中的db6rl系统含有多块网卡,那么可以使用ip指定具体网卡VBoxManage modifyvm "db6rl" --natpf1 "gliethttp_ssh,tcp,,2222,10.0.2.19,22"
4. 可以查看C:/Documents and Settings/luther/.VirtualBox/Machines/db6rl/db6rl.xml
将含有如下一行<Forwarding name="gliethttp_ssh" proto="1" hostport="2222" guestport="22"/>
5. 启动虚拟机中的db6rl系统
6. 在windows上启动secureCRT,连接127.0.0.1的2222端口即可ssh连入db6rl虚拟机了。(虚拟机里别忘了装ssh)
(注:使用Bridge方式网卡可以让ubuntu10.10得到一个与host机(windows xp)同等地位的局域网ip,但是对于隐藏该ubuntu10.10的存在不利,所以nat是隐藏虚拟机存在的最好方式)