Mapping a hostname to an IP address on Android

user800666 picture user800666 · Jun 16, 2011 · Viewed 21.6k times · Source

I know that I have to edit the /system/etc/hosts to map an IP address to a host name, but it seems that I can't edit the file. Is it because my android phone is not rooted?

Kindly advise. Thanks.

Answer

ldrrp picture ldrrp · Mar 2, 2018

You can use the following guide and application to setup rules for specific domains.

  • Download (Daedalus) and open the application.
  • Click on the menu then click “Servers”

menu

  • Click the add button and add the two google servers “8.8.8.8” and “8.8.4.4”, You can substitute these for your preferred DNS provider as well.

dns settings

  • Activate these dns servers in the menu by clicking on “Settings”
  • Then select Google and Google 2 from the settings. Also activate Advance settings and select the two following options in the image below

settings

  • Back to the menu now, Click on “Rules”.
  • Add a new rule for each development mode, Live, staging, dev. Filename is not crucial, just make something up.
  • Hit sync rule before leaving to make sure the file is downloaded.

    rules

  • Tap and activate the mode you wish to be in, You can activate more than one at a time so be careful as this will override one or the other.

  • In the menu go to home, and hit the “Activate” button.

activate

Source: https://silocitylabs.com/post/2018/03/02/changing-dns-settings-for-android-development/