Customize hosts using VPN

Published: 23 Apr, 2021 | Last modified: 29 Apr, 2021

#VPN#Feature#VPN Plus

Thanks to the DNS over VPN technology, we're able to build interesting things on top of the DNS servers and hence greatly expand our capability.

hosts file

This is a system file for most operating systems. It provides records of IPs for different domain names. As it overrides the answers from your DNS servers, you could use it to point "" to any IP you like. Of course, that IP will not be able to serve you Google's website. However, it is still useful especially for developers as they could point any domain to their development server temporarily and locally. You could also use hosts.txt to fool the system with a fake IP so that it won't get an advertisement from the Internet.

Unfortunately, it could be tedious to edit the hosts.txt file on certain systems.


On Windows, it is actually relatively easy. Simply run notepad as administrator, and then go to File - Open and browse to


You could write any thing in the following format

IP domain_name

with a space (or multiple ones) between the IP and the domain name.

Mac / Linux

Mac and Linux could arguably be the simplest platforms to edit the hosts file. Just edit /etc/hosts with any text editor as administrator (or root user).

Once you have saved the hosts file, you could try visiting the website in your browser, and it should now access the website with the IP you specified in the hosts file.


While it is not difficult to edit the hosts file on desktop systems, it is another story on mobile devices.


With a rooted Android device, you may use any file explorer to open up /system/etc/hosts to edit it with your favorate text editor.


This could be comprehensive. You have to download android studio from Google's developer page and install it on your computer. Yes, you need a desktop or laptop to do this.

After that, connect your Android device to your computer via USB and make sure you have enabled USB debugging in the developer settings.

Now you can run

adb pull /system/etc/hosts D:\hosts

in cmd.exe (Windows) or terminal (Mac) to save the hosts file to D:\hosts.

Once you have saved the file, edit it with any text editor you like, just like what you do to normal text files. After editing, just go back to cmd or terminal to run

adb push D:\hosts /system/etc/hosts

to save the hosts file back to you Android device.

However, this may not work on all Android device. The easier way is still to root the device.



Simply use any file browser to open /etc/hosts and edit it with any text editor.


Due to security concerns, iOS does not allow editing hosts file at all unless you jailbreak it. Even worse, you couldn't specify DNS server on an iOS device when you connect to a cellular network.


But there's an easy way. You'll use VPN and DNS to accomplish the task.

Let's talk about DNS first

As we said earlier, iOS does not allow modifying DNS on cellular networks, while Android has limited support to customizing DNS on selected devices. Generally, if you want to use a customized DNS, you'll need to connect to a VPN. The system would then use the DNS specified by the VPN instead of the one provided by your Internet service provider (ISP). Actually this is a common practice for many Apps which allow you to change DNS on a cellucar network, for example, the App developed by Cloudflare. They would setup a "pseudo-VPN" which only specifies DNS servers but does not encrypt any of your internet activities like what normal VPNs do.

It's time to manipulate DNS records

Now that you have your mobile device using a customized DNS, if you happen to be running that DNS server, you could tell the DNS server to return any particular IP for a domain name. See? You have now achieved the same result as modifying the hosts file by manipulating the DNS records on the DNS server. Sounds easy right? Just connect to a VPN which specifies DNS server and then modify DNS records on the DNS server.

But practically it is not easy

The reason is you can't modify DNS records on DNS servers. Most VPN providers will let you use public DNS, like by Cloudflare, or by Google. However, they wouldn't allow you to manipulate DNS records because they don't have the access either. They don't actually own those DNS servers.

On the other hands, some Apps would setup a local DNS server to answer all your DNS requests. This is common for those ads-blocking Apps. These Apps may allow you to specify an IP for a particular domain name. But they won't provide any VPN functionality.

Let's make everything possible

Here at, we make it possible for you to use VPN and modify IP of a domain name at the same time. Thanks to our DNS over VPN service, we own those DNS servers used by your VPN and we could easily manipulate the DNS records.

Simply login to and specify an IP for a domain. OneMole VPN would then manipulate the DNS records on our DNS servers as per your instructions, and would subsequently serve those records to all your devices connected to OneMole VPN.

You could connect to on server A with IP to do all development exercises for newer versions, while server B with IP 321.321.321.321 will serve the existing version of to the rest of the world.

VPN Plus

This function is only available to VPN Plus users and DNSonly servers for Basic users. So sign up and upgrade to VPN Plus today!

Authored by OneMole on
Licensed under CC BY-NC 4.0 except otherwise stated. © 2021