Can you not just edit /system/etc/hosts? You'll need to remount system rw to make the change, assuming you have rooted your device that is.
That's what I did.
You need to have flashed it with rooted Android. Then you:
su root
and:
mount -o rw,remount /system
After that you can change /system/etc/hosts. When done:
mount -o ro,remount /system
to make it read-only again.
But I have a related issue. If I, as root, write a file, then my normal user can't read it —
even if I add world read/write/execute permission, and/or set the file's owner and group to my normal user.
I hit this when editing the hosts file; the root user can't run vim, so I tried to copy the existing file somewhere my normal user could see and edit it. But I couldn't find any way other than catting it to the screen and copy-and-pasting from there…
There's clearly something about the way file permissions are set up in Android that I don't understand!
I also don't understand why I can't write files to my SD card (/storage/8048014E3/) from Termux…