1

I have deployed a CentOS 6.6 VM (hortonwoks sandbox VM) on my Windows 7 OS. The VM publishes apache spark applications through a http url. The url's have the hostname as "sandbox.hortonworks.com" (e.g.http://sandbox.hortonworks.com:8088/proxy/application_1430918431488_0001/). All the port forwarding is set up and is working as expected. I can access the url using http://localhost:8088/proxy/application_1430918431488_0001/.

To access the url as is (i.e http://sandbox.hortonworks.com:8088/proxy/application_1430918431488_0001/) I would have to add an entry to the /etc/hosts file as below

127.0.0.1 localhost sandbox.hortonworks.com

I tried adding this and restarted the "network" service, but the url doesn't work. I get an error

This webpage is not available

ERR_NAME_NOT_RESOLVED

The complete file contents of /etc/hosts file are as below

127.0.0.1   localhost.localdomain localhost
10.0.2.15   sandbox.hortonworks.com sandbox ambari.hortonworks.com
127.0.0.1   localhost sandbox.hortonworks.com

What changes do I need to make to get the url working?

Thanks!

1

The address 10.0.2.15 is a internal address for your VM which can not be reached from the Host OS because of the NAT mode.

You need to change your network adapter to use bridged mode or host-only-adapter.

In bridged mode the guest will try to get an address in the host network and using host-only-adapter you will create an interface on the host OS, normally with address 192.168.56.1 and you need to configure an address in your guest OS (for example 192.168.56.101) to connect to it. I advise you to use a static address so you don't have to change the hosts file when the address of the guest changes.

If you reconfigured your (VM) network edit the Host OS hosts file and put the ip address (192.168.56.101) there to point to your necessary URLs.

  • Does the entry for 10.0.2.15 causing the problem? Also about using host-only adapter, can you detail on the steps to add the address in the host and guest OS. My host OS is Windows OS so which file do I need to edit? – Andy Dufresne May 8 '15 at 9:39
  • I assumed that you want to reach the website on the guest OS from the Host OS. In that case the entry 10.0.2.15 is causing the problem and you need to reconfigure the vm networking to be able to connect to the guest OS from the host OS. If you only need to access the site from within the guest OS, then correct the /etc/hosts file since you have specified sandbox.hortonworks.com twice. You should delete the last line since 127.0.0.1 localhost is already specified on the first line, and the sandbox.hortonworks.com is already specified on the second line. – Lambert May 8 '15 at 9:52
  • See also superuser.com/questions/719559/… where someone has a similar issue regarding DNS resolving/caching in browser. Can it be that your browser is performing the DNS resolving? Try the url using wget from a terminal i.e: wget -S -O /dev/null http://sandbox.hortonworks.com:8088/proxy/application_1430918431488_0001/ and see if it gets connected. – Lambert May 8 '15 at 9:57
  • Yes, the wget command seems to be working. I get a http 200 OK in response. It doesn't work from the Host OS. When I configure the host VM config to "Host Only Adapter" in Oracle virtual box I am not able to ssh to the host vm as earlier. What could be wrong? – Andy Dufresne May 8 '15 at 10:16
  • If you configure the guest OS to use a host-only-adapter, it will be connected to a logical network adapter on the host OS. The adapter on the host OS is normally configured with IP address 192.168.56.1. Open a cmd window and compare the output of ipconfig /all. Inside your guest OS you can either configure the network interface using DHCP or with a static address, I advise you to use a static one, like 192.168.56.10. On your host OS edit the file %WINDIR%\system32\drivers\etc\hosts and add 192.168.56.10 sandbox.hortonworks.com – Lambert May 8 '15 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.