iTranslated by AI
Blocking Explicit Image Advertisements
I want to block adult image ads
Web ads are fine, but I don't want to see adult image ads.
I figured it would be good to record the server name of the image URL whenever I see an adult ad and prevent accessing the actual server during HTTP requests.
For example, making the name resolution of that server name return 127.0.0.1.
Decent images on the same server might get blocked too, but I guess that's unavoidable.
If it's on a Linux machine I use daily, I can just write it in /etc/hosts.
127.0.0.1 ero.example.com
However, I more often want to block them on my smartphone.
Android doesn't seem to allow rewriting the hosts file easily.
There is an option to set up a proper DHCP & DNS server, but I want to avoid a situation where even normal internet access becomes impossible if that server stops.
It would be great if my home router had a DNS server function, but it didn't.
However, the RT-400KI had a feature to set a DNS server for specific domain names.

Since I had a QNAP NAS, I decided to use it as the DNS server.
The IP address needs to be written in IPv6 format, so for 192.168.1.7, it becomes ::FFFF:C0A8:107.
Since I have opkg installed on my QNAP,
# opkg install dnsmasq-full
That's how I installed dnsmasq.
The configuration is like this.
/opt/etc/dnsmasq.conf
user=admin
group=administrators
addn-hosts=/opt/etc/dnsmasq.hosts
/opt/etc/dnsmasq.hosts
127.0.0.1 ero.example.com
127.0.0.1 *****.co.jp
127.0.0.1 *****.jp
127.0.0.1 *****.net
Once configured, I tested it from Linux.
% dig ero.example.com +short
127.0.0.1
Looks good.
Discussion