Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 26055  / 3 Years ago, tue, august 31, 2021, 8:36:52

Short Description:


My host OS is Ubuntu-12.04 and using VirtualBox I have set up a VM of Oracle Linux 6.4 (based on RHEL) with Apache httpd web server. I need to access the web pages served by the VM from my host Ubuntu.




Additional Details:


Here are the configurations:



  • The 1st network adapter of the VM is configured as NAT, since I need it to use the host's Internet connection. See image below:


    NAT configuration of 1st adapter:
    NAT configuration of 1st adapter



  • I have enabled a 2nd adapter as Host-only, so I can access the VM from the host (ssh or scp to guest VM from host, etc). This is working fine. The IP of the guest VM is manually set to 10.10.10.15 and I can successfully ping, ssh and scp to the guest VM without any problem. See below:


    Host-only configuration of 2nd adapter:
    Host-only configuration of 2nd adapter




Inside the VM, I have set up Apache successfully and it's working for localhost but when I try to access the page from the host, by entering 10.10.10.15 in Chromium or Firefox, it fails to connect! :(


I have also tried to add an entry inside /etc/hosts as follows, but entering test-website.net inside 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?!


More From » networking

 Answers
4

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 facing problems, checkout the following:




  • System firewall (i.e. iptables) configuration;

  • SELinux configuration;



cheers :)


[#30310] Wednesday, September 1, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
odyroc

Total Points: 324
Total Questions: 109
Total Answers: 103

Location: Belize
Member since Mon, Apr 17, 2023
1 Year ago
;