Web Server Access on a VirtualBox Guest

来源:互联网 发布:全球央行黄金储备数据 编辑:程序博客网 时间:2024/06/04 18:11

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 VirtualBoxVBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/HostPort" 8888VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/GuestPort" 80VBoxManage 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 VirtualBoxVBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22VBoxManage setextradata MyUbuntu "VBoxInternal/Devices/pcnet/0/LUN
原创粉丝点击