- Find a good hosts file, like here
- append the file above to /srv/src/PIE/system/core/rootdir/etc/hosts
- Make sure you don’t overwrite 127.0.0.1 and ::1
- Build your ROM and now the hosts file will block a lot of adds and trackers. Now you can do this also with existing ROM’s, remount system and replace hosts file (/etc/hosts).
I’m a little confused.
- If it is so easy to setup IP blocker, why isn’t it integrated in standard.
- I have tried to block these domains
it works when using the addresses in browser. But my pi-hole shows me theses connection which are called from system direct. There the hosts file isn’t working
As in every OS, use of hosts file is not mandatory.
If the program calls system API (such as GetHostByName() with a “use hosts first” policy), it will work.
But if the program has it’s own DNS mechanisms it won’t use the hosts file.
For example the “proxy DNS” found in some browsers when using HTTP proxy (redirects DNS requests through HTTP proxy) has been proven to ignore hosts file.
I’ve posted an answer regarding host file blocking in a previous thread about more or less the same topic.