Emulate hosts file on non-rooted Android

anotheruser1488182 picture anotheruser1488182 · Oct 15, 2013 · Viewed 18.4k times · Source

Is there a way to emulate the behaviour of a hosts file on non-rooted Android?

I need to test a website on Android. I get to the website via IP address but it seems to redirect to a URL that is not available from the phone. So is there a way to emulate hosts file behaviour to map this URL to the correct IP address.

From search I have found that the real hosts file is editable with a rooted device but that isn't currently an option for me.

Answer

Yevgen Kulik picture Yevgen Kulik · Feb 5, 2014

1) You can use desktop as a source or internet for your device. And here you can use dnsmasq with some next rules (for ex. https://askubuntu.com/questions/53523/how-to-redirect-a-url-to-a-custom-ip-address) you need only share internet to device via usb.

2) you can setup on your device as dnsserver ip of your computer in that network. then same actions with dnsmasq