Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How does /etc/hosts gets updated

How does /etc/hosts gets updated

New Contributor

I am using HDP 2.5 Sandbox on VMWare. Somewhere in startup script /etc/hosts file gets updated with line: 172.17.0.2 sandbox.hortonworks.com

Where is this update happening? I need sandbox.hortonworks.com pointing to a different IP address.

3 REPLIES 3

Re: How does /etc/hosts gets updated

Expert Contributor

Sandbox HDP Docs: https://hortonworks.com/hadoop-tutorial/hortonworks-sandbox-guide/#section_2

Sandbox build packages/component to use it localhost name by default, and depends on where you going to import sandbox deployment like VB/VMs/Docker/Azure.

127.0.0.1 localhost.localdomain localhost sadbox.hortonworks.com

Re: How does /etc/hosts gets updated

Expert Contributor

sandbox built with IP 172.17.0.2..if you try to change /etc/hosts file nothing will work...after reboot sandbox /hosts file get reloaded again same ip only...they way it build like that..

because gen_hosts.sh file time of loading sandbox use it for localhost name and route internally to sandbox IPs.

Re: How does /etc/hosts gets updated

Guru

Hello @Vikas Pashte,

HDP 2.5 Sandbox is a Docker container, which runs inside docker host image on your VMWare / VirtualBox machine. This guest machine (Docker host) uses the default `docker0` bridge network to configure networking for container. So docker0 (172.17.0.1) & container (172.17.0.2) creates their own internal network and access to outside world is provided via port mapping (request port 8080 is to connected to 172.17.0.2:8080 etc.).

Coming back to your question, how to change container's IP address. You can change container's IP address by changing the default bridge network of Docker host. Please read this Docker documentation and it has an example in this section, to do the same.

Hope this helps !