dreamszhu的个人空间 http://love.myleft.org/?2

日志

通过ssh访问virtualbox中的ubuntu

已有 53 次阅读 2010-7-26 10:36 |个人分类:软件|系统分类::互联网|关键词:ssh ubuntu virtualbox 访问

host 系统:window xp
guest系统:ubuntu 10.04 server

在做以下操作前,确定你已经把virtualbox目录(D:\Program Files\Oracle\VirtualBox;)加入了环境变量path中

1.在CMD下输入以下命令:
老版本:
VBoxManage setextradata Ubuntu10.04 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
VBoxManage setextradata Ubuntu10.04 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort"  22 //这个端口可以自由设定
VBoxManage setextradata Ubuntu10.04 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22  //ubuntu系统中的SSH服务端口22

新版本:
VBoxManage modifyvm "Ubuntu10.04" --natpf1 "guestssh,tcp,,22,,22"
vboxmanage modifyvm 虚拟机名 第几个网卡 "端口转发名(guestssh),tcp,宿主机IP,宿主机端口,虚拟机IP,虚拟机端口"

原理很简单:就是把来自Host系统的22这个端口的数据转发到Guest系统的22这个端口。

2.重启guest系统,这个很重要。

3.在Host系统下用putty登陆下,注意端口要和上面的设置一样。

PS:
可以用这个命令查看自己都对virtualbox进行了那些设置:
VBoxManage getextradata Ubuntu10.04 enumerate //Ubuntu10.04 替换成 你的guest系统名称

想删除配置,只要设置为空置即可。

路过

雷人

握手

鲜花

鸡蛋

漂亮

评论 (0 个评论)

facelist

御舟工作室. |联系我们

GMT+8, 2010-9-5 20:15, Processed in 0.026408 second(s), 16 queries.

Powered by Discuz! X1

© 2001-2010 Comsenz Inc.