Can't access Apache on VirtualBox VM (using NAT + host only)


Said Muhammad|

short introduction:

My host OS is Ubuntu-12.04 and have setup a virtual machine of Oracle Linux 6.4 (RHEL based) with Apache httpd web server using VirtualBox. I need to access a web page served by a VM from the host Ubuntu.


Additional details:

Here is the configuration:

  • The VM's first network adapter is configured as NATI need it to use the host's internet connection. See below:

    NAT configuration for the first adapter:NAT configuration for the first adapter

  • I've enabled the second adapter as "host only" so I can access the VM from the host ( sshor scpthe guest VM from the host, etc). everything is normal. The IP of the guest vm is manually set as 10.10.10.15I was able to succeed pingand sshthe scpguest vm has no issues. as follows:

    Host-only configuration for the second adapter:Host-only configuration for the second adapter

Inside the VM, I've successfully setup Apache and it works fine, localhostbut when I try to access the page from the host by typing 10.10.10.15Chromium or Firefox , it won't connect!:(

I've also tried adding an entry /etc/hostslike below inside , but typing test-website.netinside Chromium or Firefox still gives the same error!:(

10.10.10.15    test-website.net

One more thing to note is about SELinux. As you might know, SELinux is enabled by default on RHEL-based distros such as CentOS and Oracle-Linux. To make sure that SELinux is not messing up my work, I have configured it to permissive mode in /etc/selinux/config and confirming the effect after reboot using sestatus:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          permissive
Policy version:                 26
Policy from config file:        targeted

This may sound like a duplicate of the following questions, but the answers in these questions suggest to set up a Host-only adapter for the guest and configure /etc/hosts in the host, which I have already tested and didn't work for me:

Any help?!

Seyed Mohammad |

I figured out what was causing the problem ... iptables!

The configuration I have set up for the VM should work without any problem.

If anyone with the same setup is having issues, please check the following:

  • System firewall (ie iptables) configuration;
  • SELinuxconfigure;

cheers:)

Related


Can't access Apache on VirtualBox VM (using NAT + host only)

Said Muhammad| short introduction: My host OS is Ubuntu-12.04 and have setup a virtual machine of Oracle Linux 6.4 (RHEL based) with Apache httpd web server using VirtualBox. I need to access a web page served by a VM from the host Ubuntu. Additional details:

Can't access Apache on VirtualBox VM (using NAT + host only)

Said Muhammad| short introduction: My host OS is Ubuntu-12.04 and have setup a virtual machine of Oracle Linux 6.4 (RHEL based) with Apache httpd web server using VirtualBox. I need to access a web page served by a VM from the host Ubuntu. Additional details:

Unable to connect to VirtualBox VM from Kubuntu host using NAT

Gilberts I am using Kubuntu 13 as host and Xubuntu 12 as guest. In the VM network options, I selected NAT, and like 127.0.0.1:23 => 10.0.2.15:22. I can access the internet from the guest, but when I try to SSH to the guest, I get connection refused. Recently I

VirtualBox: Host and NAT conflict only?

Wikowitz I have a Windows XP w/ SP2 (guest additions installed) configured with 2 network cards. Network Card 1: Host-only IP: 10.0.2.15 (static) Mask: 255.255.255.0 DG: 10.0.2.1 (vboxnet0) Network Card 2: NAT IP: 10.0.3.1

VirtualBox: Host and NAT conflict only?

Wikowitz I have a Windows XP w/ SP2 (guest additions installed) configured with 2 network cards. Network Card 1: Host-only IP: 10.0.2.15 (static) Mask: 255.255.255.0 DG: 10.0.2.1 (vboxnet0) Network Card 2: NAT IP: 10.0.3.1

VirtualBox: Host and NAT conflict only?

Wikowitz I have a Windows XP w/ SP2 (guest additions installed) configured with 2 network cards. Network Card 1: Host-only IP: 10.0.2.15 (static) Mask: 255.255.255.0 DG: 10.0.2.1 (vboxnet0) Network Card 2: NAT IP: 10.0.3.1

Can't access Apache on VM via LAN

Swartz I installed a CentOS machine on VMware Fusion and connected it to the LAN via a bridge connection. everything works fine and i can Surf the Internet from the guest computer. Ping other network machines from the guest. Ping the guest computer from the ho

Can't access Apache on VM via LAN

Swartz I installed a CentOS machine on VMware Fusion and connected it to the LAN via a bridge connection. everything works fine and i can Surf the Internet from the guest computer. Ping other network machines from the guest. Ping the guest computer from the ho

Can't access virtual host on Centos/apache

Sean Cunningham I'm running a CentOS 6.8 server with VMWare Fusion and have Apache up and running, although I can't access any virtual hosts. I also followed this walkthrough ( https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts

Can't access virtual host on Centos/apache

Sean Cunningham I'm running a CentOS 6.8 server with VMWare Fusion and have Apache up and running, although I can't access any virtual hosts. I also followed this walkthrough ( https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts

Access server on Ubuntu VM in VirtualBox with host offline

Page__ I have an Ubuntu VM running on VirtualBox and several servers are running on this VM that I need to access from the host. The host needs to be disconnected (offline) from any network. What kind of network do I want to define for this VM and how do I acc

Access server on Ubuntu VM in VirtualBox with host offline

Page__ I have an Ubuntu VM running on VirtualBox and several servers are running on this VM that I need to access from the host. The host needs to be disconnected (offline) from any network. What kind of network do I want to define for this VM and how do I acc

How to access Apache2 virtual host from VirtualBox (or any VM)

hail I'm running Ubuntu 11.04 and have set up localhost so my website can be accessed via site1.local site2.local By setting up a virtual host and adding the entry to my hosts file. I want to test them in IE, so I have VirtualBox installed on Windows. My

How to access Apache2 virtual host from VirtualBox (or any VM)

hail I'm running Ubuntu 11.04 and have set up localhost so my website can be accessed via site1.local site2.local By setting up a virtual host and adding the entry to my hosts file. I want to test them in IE, so I have VirtualBox installed on Windows. My

How to access Apache2 virtual host from VirtualBox (or any VM)

hail I'm running Ubuntu 11.04 and have set up localhost so my website can be accessed via site1.local site2.local By setting up a virtual host and adding the entry to my hosts file. I want to test them in IE, so I have VirtualBox installed on Windows. My

Can't access USB UART in VirtualBox Guest on macOS host

Martin I have created a virtualbox via docker-machine: $ docker-machine create --driver virtualbox default In the guest OS, I want to access my USB serial device, which is the Nordic nRF52840 DevKit, listed in macos /dev/tty.usbmodem144241. However, virtualbox

Can't access USB UART in VirtualBox Guest on macOS host

Martin I have created a virtualbox via docker-machine: $ docker-machine create --driver virtualbox default In the guest OS, I want to access my USB serial device, which is the Nordic nRF52840 DevKit, listed in macos /dev/tty.usbmodem144241. However, virtualbox

Can't access USB UART in VirtualBox Guest on macOS host

Martin I have created a virtualbox via docker-machine: $ docker-machine create --driver virtualbox default In the guest OS, I want to access my USB serial device, which is the Nordic nRF52840 DevKit, listed in macos /dev/tty.usbmodem144241. However, virtualbox

Can't access USB UART in VirtualBox Guest on macOS host

Martin I have created a virtualbox via docker-machine: $ docker-machine create --driver virtualbox default In the guest OS, I want to access my USB serial device, which is the Nordic nRF52840 DevKit, listed in macos /dev/tty.usbmodem144241. However, virtualbox