Adblock on your router

A lot of people already use Adblockers in their desktop browser, but what if you’re using your phone, tablet or an alternative browser? Getting rid of annoying ads is simple: Block them with your router.

The idea is simple: when the DNS server on your router receives queries, we’ll sort out queries that ask for the A Resource Records of ad servers and return instead of the ad server’s IP address.

There are loads of scripts out there to accomplish something like that. IMHO, some are too complex (like changing the FORWARD chain in iptables), some do stuff I don’t like (e.g. manipulating stuff in /etc/) and some even pose a security threat, because they download config files and use them without checking their content.

This is why I wrote such a script myself. What It does:

  • download a list of ad servers in dnsmasq config file format from
  • check if the file only contains address statements that assign the IP address to some domain name (with grep)
  • save the file as /tmp/dnsmasq.d/adblock.conf
  • restart dnsmasq

You need at least OpenWRT revision 39312 to use it.

Enough talk, let’s get going: Simply SSH to your router, download this script:

# mkdir -p /opt/bin
# curl "" > /opt/bin/
# chmod +x /opt/bin/
# /opt/bin/

To update the server list on a regular basis, add the line 0 0 */1 * * /opt/bin/ to your crontab by typing crontab -e.

Congrats, you now have adblock on your router!

Note: If you can’t download the script, because you’re getting curl: (51) Cert verify failed: BADCERT_NOT_TRUSTED, you’re probably missing CA certificates. Run:

# opkg update
# opkg install ca-certificates

Also check if export SSL_CERT_DIR=/etc/ssl/certs is in your /etc/profile and add it, if neccessary. Run source /etc/profile and retry.

Ogg videos on RPi/Kodi

I recently wanted to play an OGG video on my Raspberry Pi with XBMC (which has been renamed to Kodi recently). Unfortunately, it didn’t work out of the box. This is how I solved the problems.

Problem 1: Ogg video file not recognized.

If you try to open your file by using the file browser in Kodi’s video section, it won’t be displayed. This is because Kodi assumes that files with the *.ogg extension are audio files.

Solving this is easy: Simply rename somefile.ogg to somefile.ogv (somefile.ogm is also possible). For the sake of completeness: Your Ogg audio files can have *.ogg or *.oga as file extension.

Although you can also change the way Kodi detects files and make *.ogg a video file extension, I do not recommend this. That extension is much more common with audio files and renaming Ogg videos to *.ogv makes audio and video files distinguishable by just reading the filename.

Now you can see the Ogg video file in Kodi’s file browser. You hit enter and …. have another problem.

Problem 2: Ogg video file playback is audio-only

Now the file actually plays and you can hear the sound, but there’s no video. This is probably because the RPi’s GPU does not know how to decode the video. GPU accelerated software codecs are only available from start_x.elf.

Open /etc/profile/ and append /opt/vc/bin to your $PATH:

# Set our default path

Then add this to your /boot/config.txt:


That causes the RPi to load testing versions of the GPU firmware. These enable potentially unstable/not-fully-tested/hacky functionality - currently, using these files instead of the usual fixup.dat/start.elf will cause extra video codecs to become available.[1]

Note that you should set your GPU memory to at least 128 MB:

gpu_mem_256=128 # If you have 256 MB RAM (Model A)
gpu_mem_512=128 # If you have 512 MB RAM (Model B)

Et voilà. Kodi is now able to play Ogg video files (hopefully)!


Voilà, there is my new website. Do not expect regular updates.