I have installed VirtualBox 5.0.14 on an Lubuntu 15.10 host, and created a virtual machine with Lubuntu 14.04.5 LTS as the guest OS.
I would like to set up a host-only network adapter in VirtualBox so that I can access an Apache webserver running inside the guest OS from a webbrowser running on the host system.
So far I have created a host-only adapter
vboxnet0 which I can ping successfully from the host OS. However, I cannot access port 80 using a webbrowser or any other means.
What can I do to get to the cause of the problem and configure things properly?
VM network settings
Test results inside guest
After booting the VM and starting Apache (using
sudo service apache2 start) I can access a test page on
http://localhost/ using Firefox inside the guest OS without problems.
The corresponding Apache VirtualHost is defined as
<VirtualHost *:80> in
/etc/apache2/sites-enabled/000-default.conf, so I don't see why it wouldn't be accessible from any host.
Also, sshd and MySQL server are running on the guest. I can ssh to localhost and nmap shows all relevant ports open (22, 80, 3306).
Test results on host
On the host OS,
vboxnet0 appears as follows and is pingable:
% ifconfig vboxnet0 vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00 inet addr:192.168.10.10 Bcast:192.168.10.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:192 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:16176 (16.1 KB) % ping 192.168.10.10 PING 192.168.10.10 (192.168.10.10) 56(84) bytes of data. 64 bytes from 192.168.10.10: icmp_seq=1 ttl=64 time=0.023 ms
However, none of the ports are accessible:
% nmap 192.168.10.10 -p 22,80,3306 Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-20 21:29 CEST Nmap scan report for 192.168.10.10 Host is up (0.000027s latency). PORT STATE SERVICE 22/tcp closed ssh 80/tcp closed http 3306/tcp closed mysql Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds
Trying to match IP address
As per comment by @MarkoPolo:
192.168.10.10 is pingable from the host OS, I cannot access this IP address from the guest OS.
In fact, the guest OS has an IP address from the DHCP range specified in for
eth1 Link encap:Ethernet HWaddr 08:00:27:0d:b4:6a inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe0d:b46a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:11 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1180 (1.1 KB) TX bytes:1422 (1.4 KB)
The IP address
192.168.56.101 is not reachable from the host OS, i.e. not pingable, no access using webbrowser.
I tried updating the IP address of
ifconfig. Then, Apache is reachable on
http://192.168.10.10 from the guest OS, however, still no access (aside from ping) is possible from the host OS.