配置VirtualBox NAT方式端口转发完成windows下putty登录ubuntu10.10(转)

来源:互联网 发布:淘宝实名认证修改 编辑:程序博客网 时间:2024/05/21 10:13

 

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

 

原创粉丝点击