Setup Pihole On Your Synology NAS Using Docker with Macvlan & Bridge Networks

3 min read 2 hours ago
Published on Oct 14, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, you will learn how to set up Pi-hole on your Synology NAS using Docker with Macvlan and Bridge networks. Pi-hole is a network-wide ad blocker that enhances your browsing experience by filtering out unwanted ads and trackers. By the end of this guide, you’ll have a fully functional Pi-hole container that improves your network's security and control.

Step 1: Review Prerequisites

Before you begin, ensure you have the following:

  • A Synology NAS device with Docker installed.
  • Basic knowledge of Docker and networking concepts.
  • Access to your Synology NAS's administration interface.
  • An understanding of your local network configuration.

Step 2: Create the Macvlan Network

The Macvlan network allows containers to be directly connected to your network, appearing as individual devices. Follow these steps to create it:

  1. Open the Synology Docker application.
  2. Access the terminal or SSH into your Synology NAS.
  3. Run the following command to create the Macvlan network:
    sudo docker network create -d macvlan -o parent=eth(x) --subnet=192.168.x.0/24 --gateway=192.168.x.1 --ip-range=192.168.x.x/32 ph_network
    
    • Replace eth(x) with your network interface (e.g., eth0).
    • Adjust the subnet, gateway, and IP range according to your network settings.

Step 3: Create the Pi-hole Bridge Network

The Bridge network is used to allow communication between Docker containers. To create it, do the following:

  1. In the Docker application, navigate to the network section.
  2. Create a new Bridge network by specifying a name (e.g., pihole_bridge).
  3. Configure any necessary options based on your requirements.

Step 4: Create the Pi-hole Docker Container

Now that you have both networks set up, you can create the Pi-hole container:

  1. Open the Docker application on your Synology NAS.
  2. Go to the "Registry" section and search for the Pi-hole image.
  3. Download the official Pi-hole image.
  4. Once downloaded, go to the "Image" section and select the Pi-hole image.
  5. Click on "Launch" to create a new container.
  6. Configure the container settings:
    • Set the network to use the Macvlan and Bridge networks created earlier.
    • Assign a static IP address from the range you defined in the Macvlan network.
    • Set environment variables as necessary (e.g., WEBPASSWORD for the Pi-hole admin interface).
  7. Save and start the container.

Step 5: Access the Pi-hole Admin Interface

To access the Pi-hole dashboard:

  1. Open a web browser.
  2. Enter the static IP address you assigned to your Pi-hole container.
  3. Log in using the password set in the environment variables.

Step 6: Configure DNS Settings

To ensure all devices on your network use Pi-hole:

  1. Go to your router's settings.
  2. Change the DNS server settings to point to the IP address of your Pi-hole instance.
  3. Save the changes and restart your router if necessary.

Conclusion

You've successfully set up Pi-hole on your Synology NAS using Docker with both Macvlan and Bridge networks. This setup not only blocks unwanted ads and trackers but also provides better control over your network traffic. As a next step, consider exploring additional Pi-hole features or integrating it with other network tools for enhanced functionality. Enjoy a cleaner and more secure browsing experience!