PiHole without RaspberryPI on Mikrotik Routers - *upcomming function*

Januar 29, 2022

docker                                              mikrotik

Since the new OS Release 7.1rc4 Mikrotik has added the function to use Docker Containers on your Mikrotik router, this feature is awesome and I want to show how easy it is to place the very often used Pi-Hole DNS AD-Blocker onto your Router.

This function is under heavy development and at this stage paused by Mikotik I will add more informations when the Container System is accessible again.

This tutorial will guide you through the following steps

  • How to install / enable the container package
  • Prepairing of Docker PiHole Arm Package via Docker Host
  • Setup of virtual networks of Docker on Mikrotik
  • Installation and Setup of PiHole

For this setup I use my Lab Mikrotik RB5009UG+S+IN Link

Setup Container function

Use the terminal via WinBox or SSH Conection of your Mikrotik:

Check the setup of your Mikrotik:

system/device-mode/print

Enable the Container Mode on your Mikrotik, you need to have physical access to your router to press the reset button after this command:

system/device-mode/update mode=enterprise container=yes

Check the if the setup of container was done:

system/device-mode/print

Prepairing of Docker PiHole Arm Package via Docker Host

Download the latetest package of PiHole (arm64)

docker pull pihole/pihole:latest@sha256:1c02cda06ba1b997d10e0c12743002e845ed87bf010fca0ad838c3dba6ac6c58

Generate a tar file out of the docker image to transfer it to the Mikrotik (depending on plattform this can take up to 5 minutes)

docker save pihole/pihole > pihole.tar

Use SCP or WinBox to tranfer the pihole.tar to your Mikrotik

Setup Virtual Network and Enviroment for Docker and PiHole
Create a veth interface for Docker:

/interface/veth/add name=veth1 address=172.17.0.2/16 gateway=172.17.0.1

Create a bridge for containers and add veth to it:

/interface/bridge/add name=docker
/ip/address/add address=172.17.0.1/16 interface=docker
/interface/bridge/port add bridge=docker interface=veth1

Create enviromental variables:

0 list="pihole" name="TZ" value="Europe/Berlin"
1 list="pihole" name="ServerIP" value="172.17.0.2"
2 list="pihole" name="WEBPASSWORD" value="Start123"

Es wurden noch keine Kommentare verfasst, sei der erste!