Salve
Con questo articolo vorrei mostrarvi come bloccare le annose pubblicità (ads) quando navigate su internet usando direttamente il vostro router anziché usare i vari adblock plugin per il vostro browser preferito.
Inizio col dire che ho un router TP-Link WR703N modificato con firmware DD-WRT aggiornato all’ultima release.
Andando nella schermata (tradotta in italiano): Amministrazione > Comandi
Bisogna aggiungere questo Startup Script:
#!/bin/sh sleep 60 rm /tmp/hosts mkdir /tmp/ads wget -qO /tmp/ads/hostsfile https://hosts-file.net/ad_servers.txt wget -qO /tmp/ads/winhelp2002 https://winhelp2002.mvps.org/hosts.txt #cat /tmp/ads/hostsfile | sed -e 's/#.*$//' -e '/^$/d' > /tmp/hosts cat /tmp/ads/winhelp2002 /tmp/ads/hostsfile | sed -e 's/^[ t]*//' | grep -v ^# | sort | uniq > /tmp/hosts rm -rf /tmp/ads rm /etc/hosts ln /tmp/hosts /etc/hosts stopservice dnsmasq && startservice dnsmasq exit 0
Una volta aggiunto e salvato lo script, dobbiamo spuntare le seguenti opzioni:
Services > DNSMasq
Abilitare il DNSMasq e DNS Locale
Inoltre, bisognerà aggiungere il seguente comando in “Opzioni Aggiuntive DNSMasq”:
addn-hosts=/tmp/dlhosts
Salviamo, applichiamo le modifiche e dopo un minuto esatto tutto gli ads saranno automaticamente bloccati.
Ciao!