I have Ubuntu 11.0.4 installed as a guest OS under VirtualBox on OS X Lion. I installed Apache and tested the server from Firefox on the guest. Now I'd like to connect from the host.
I followed instructions from two sources without success. From VirtualBox, add rule in the Terminal of the host:
VBoxManage modifyvm Ubuntu --natpf1 "apache,tcp,,8888,,80"
shut down Ubuntu
under Settings > Network Bridged Adaptor tried both en1: Wi-Fi and en0:ethernet
Restart VirtualBox
Restart Ubuntu
Remember to Allow from all in /etc/apache2/sites-available/default
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
# Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
Restart Apache
Safari: http://127.0.0.1 Safari: http://127.0.1.1 +/- :8888/
Doesn't say can't find server, but times out
The second approach from here:
Modify ~/Library/VirtualBox/VirtualBox.xml on the host added these to the top of the file under ExtraData
ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" value="2222" ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" value="22" ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" value="TCP" ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/HostPort" value="8888" ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/GuestPort" value="80" ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/Protocol" value="TCP"
No go. Any ideas what to try next? Thanks.
@Eric Fortis Tried going back to NAT. In the guest:
te@VB:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:88:33:a4
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe88:33a4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:69 errors:0 dropped:0 overruns:0 frame:0
TX packets:91 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:27935 (27.9 KB) TX bytes:11313 (11.3 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 B) TX bytes:480 (480.0 B)
In the host, neither 127.0.0.1 nor 10.0.2.15 works.
Update: Trying bridged mode: Attached to: Bridged Adaptor Name: en1: Wi-Fi (Airport) Promiscuous mode: Allow all Cable connected: unchecked
In the guest:
te@VB:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:88:33:a4
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
No ip address?
UPDATE 2:
Figured it out. I had Apache configured wrong for the new port. I used NAT with this from Terminal:
VBoxManage modifyvm Ubuntu --natpf1 "server,tcp,,8080,,8080"
I needed to modify ports.conf to add
> NameVirtualHost *.8080
> Listen 8080
and sites-available/default to add
<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
It comes from trying to learn too many new things at once. Thanks for your patience.