Web Server Access on a VirtualBox Guest

Web Server Access on a VirtualBox Guest

In: Computing 数码编程

7Oct2008

I been using VirtualBox to deploy virtual machines on my Windowsmachine since a significant memory upgrade. VirtualBox is suprisinglyeasy to used if compared to VMWare and it just fit to my basic needs.

Access the web server from the guest on host is pretty straightforward but not the other way.

In my scenario, my host OS is XP and the guest OS is Ubuntu. First,we go to the XP host and open a command prompt, and configure the portforwarding in the VirtualBox installation directory, as follows:

cd
 C:/Program Files/Sun/xVM VirtualBox

VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0
/LUN#0
/Config/apache/HostPort" 8888


VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0
/LUN#0
/Config/apache/GuestPort" 80


VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0
/LUN#0
/Config/apache/Protocol" TCP

This simply arbitrarily assign port 8888 of our host XP to forwardconnections to the guest Ubuntu’s port 80, which is the default portfor HTTP connections.

Having done that, we now turn on our guest Ubuntu and use our webbrowser on host XP to browse http://localhost:8888/. Alright, now wegot a local web server to play with.

We can also allowing SSH connections from the host OS to the guest OS as follows:

cd
 C:/Program Files/Sun/xVM VirtualBox

VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0
/LUN#0
/Config/ssh/HostPort" 2222


VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0
/LUN#0
/Config/ssh/GuestPort" 22


VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0
/LUN
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值