# How to set up your network protection with Pi-hole

## Introduction <a href="#introduction" id="introduction"></a>

These days, the internet is full of advertisements and malicious websites. Due to this, many people resort to using third-party tools, such as [ad blockers](https://nordvpn.com/blog/what-is-ad-blocking/) or [threat protection tools](https://nordvpn.com/features/threat-protection/), to overcome the sheer amount of danger online. One such tool that enthusiasts tend to use more than others is Pi-hole.

[Pi-hole](https://docs.pi-hole.net/) allows you to transform your device to a local [DNS server](https://nordvpn.com/blog/what-is-dns-server/), which can be used as a network-wide ad blocker. While advertisement blocking is Pi-hole’s main purpose, you can use it for a variety of other options, such as local DNS mapping and website blacklisting.

On its own, Pi-hole only functions on the [local area network](https://nordvpn.com/blog/what-is-lan/) (LAN). However, with the power of [Meshnet](https://nordvpn.com/meshnet/), you can use Pi-hole on your devices remotely. Meshnet allows you to establish a secure and encrypted connection between your end device and the Pi-hole server.

While you can deploy a [Pi-hole Docker container](https://github.com/pi-hole/docker-pi-hole) on Windows and macOS, this guide will walk you through the standard installation on Linux. It will also show how to configure your devices for remote use by setting the Pi-hole Meshnet IP address as your DNS address.

See the following overview video for additional information and instructions for the Pi-hole setup.

{% embed url="<https://www.youtube.com/watch?v=6Dcyt7ueDKA>" %}

Alternatively, proceed with the detailed text-based instructions provided on this page.

## Before you begin

Ensure that the machine you will use for Pi-hole meets the following criteria:

* Linux distribution using Systemd or SysVinit
* 2 GB of free disk space or more
* 512 MB RAM or more
* Static LAN IP address
* [Meshnet is enabled on the Linux](https://meshnet.nordvpn.com/getting-started/how-to-start-using-meshnet/using-meshnet-on-linux) machine and all client devices that will be using Pi-hole

For more detailed information, refer to the [Pi-hole Prerequisites](https://docs.pi-hole.net/main/prerequisites/) documentation.

{% hint style="info" %}
**Note**

Changing DNS addresses while using cellular data and keeping the Meshnet connection active is not possible. If you are using a mobile device with a cellular connection, you will need to use Pi-hole [with a VPN connection](#with-a-vpn-connection).
{% endhint %}

## Install Pi-hole <a href="#install-pi-hole" id="install-pi-hole"></a>

1. Open **Terminal** and run the following command to download and execute the Pi-hole installation script:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">curl -sSL https://install.pi-hole.net | bash
   </code></pre>

   \
   For alternative installation methods, refer to the [Pi-hole installation](https://docs.pi-hole.net/main/basic-install/) page.
2. Enter the sudo password of your Linux machine.&#x20;
3. In the installation dialog, select **OK** until you reach the **Static IP needed** window. If your device already has a static LAN IP address configured, select **Continue**. Otherwise, complete the necessary IP adjustments in your network.
4. Choose the network interface that your device is using (for example, `eth0`, `wlan0`, `enp0s3`) and then choose **Select**.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FgHI8IUx8C2Li8p1WBLaP%2Fpihole_install_interface.png?alt=media&#x26;token=fef1e527-f043-4125-9916-eb7ff90b6971" alt="Available network interfaces listed in Pi-hole installation window." width="563"><figcaption><p><br></p></figcaption></figure></div>
5. Select your preferred upstream DNS provider and select **OK**.
6. Complete the installation process by choosing the blocklist, installing the Admin Web Interface with the required modules, and configuring the query logging settings.
7. In the **Installation complete** window, note down the address and password for the Pi-hole web interface and select **OK**.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FWMQHJgm0XE99P0h4w8uv%2Fpihole_install_finish.png?alt=media&#x26;token=9b4b32db-b5d7-4108-afbf-8f54c143f29a" alt="Pi-hole web UI address and password highlighted in the installation window." width="563"><figcaption></figcaption></figure></div>

{% hint style="success" %}
**Tip**

Make sure to change the password of your Pi-hole web interface to a unique and secure one. You can do so by executing the following command in the terminal:

{% code overflow="wrap" %}

```bash
sudo pihole setpassword
```

{% endcode %}
{% endhint %}

## Allow Meshnet connections in Pi-hole settings <a href="#allow-meshnet-connections-in-pi-hole-settings" id="allow-meshnet-connections-in-pi-hole-settings"></a>

Default Pi-hole settings allow requests only from the same local subnet of the host device (for example, `192.168.1.0/24`). Since Meshnet IP addresses use a different subnet, Pi-hole will ignore all queries to the server.

To allow remote Meshnet connections to your Pi-hole, complete the following steps:

1. Open your browser, enter the URL of the Pi-hole web interface that was provided in the **Installation complete** window, and log in.
   * If you are accessing the web interface from the host device directly, you can use this URL:\
     `http://localhost/admin`
   * Otherwise, use the device’s local IP address instead of the `localhost` part.
2. From the left side menu, under **System**, go to **Settings** > **DNS**.
3. In the upper-right corner, click the **Basic** toggle to switch to the Expert view.
4. Under **Interface**, select the **Permit all origins** option.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FkzsnXM8acZvnuB1sN7XG%2Fpihole_interfaces_dark.png?alt=media&#x26;token=3ffa0890-e3a0-414e-b0aa-4932b9cf3825" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FhmUGUQG61hr7bMnVsUOI%2Fpihole_interfaces.png?alt=media&#x26;token=e3d7a613-69d8-4603-a53e-603001bcbdcf" alt="&#x22;Permit all origins&#x22; option selected in Pi-hole&#x27;s interface settings." width="375"></picture><figcaption></figcaption></figure></div>
5. Click **Save and apply**.

Pi-hole is now installed and prepared for use via Meshnet.&#x20;

{% hint style="success" %}
**Tip**

If you want to change the upstream DNS addresses for your Pi-hole in the future, you can do so on the same **DNS** tab, under **Upstream DNS servers**.
{% endhint %}

## Import blocklists to Pi-hole <a href="#import-blocklists-to-pi-hole" id="import-blocklists-to-pi-hole"></a>

With the additional features Pi-hole offers, you can further enhance your network security. One example is to import custom website blocklists to protect your devices from malicious and dangerous URLs or phishing domains. For this guide, blocklists from the [firebog.net](https://firebog.net/) website will be used.

### Add URLs <a href="#add-urls" id="add-urls"></a>

To add blocklist URLs to Pi-hole:

1. Open your Pi-hole web interface.
2. From the menu on the left, under **Group management**, select **Lists**.
3. In the **Address** field, enter your preferred blocklist URL. Click **Add**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FbSI32d1QZe5okPPj1Qqe%2Fpihole_list_address_dark.png?alt=media&#x26;token=0b466fe0-246b-46a0-9ef4-4310638b3062" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F06TYnr64FErPF9WMNN1u%2Fpihole_list_address.png?alt=media&#x26;token=1123b809-7e99-4b75-9d61-e0c453ed1368" alt="Blocklist URL entered in Pi-hole settings."></picture><figcaption></figcaption></figure></div>

You will see the newly added blocklist under **Subscribed lists**.

<div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FJhh5qST7rTQ0XWzt1lMv%2Fpihole_lists_dark.png?alt=media&#x26;token=1ebe05e8-70d9-4997-bce8-fdc9a5782c9a" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FZVFTqusPYQ1xTESR9JKy%2Fpihole_lists.png?alt=media&#x26;token=3bf38652-10c0-4863-b869-ea822494709e" alt="Blocklist successfully added to Pi-hole."></picture><figcaption></figcaption></figure></div>

### Update gravity script <a href="#update-gravity-script" id="update-gravity-script"></a>

To start using the newly imported blocklists, update Pi-hole’s [gravity script](https://docs.pi-hole.net/core/pihole-command/#gravity).

1. Open Pi-hole’s web interface.
2. From the left side menu, under **System**, go to **Tools** > **Update gravity**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FuqukMkwilWVoWGc12KfV%2Fpihole_update_gravity_dark.png?alt=media&#x26;token=b56381d8-ac7d-4d7b-8992-a2a75a5d5d62" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FKnv7OrIkftWpjcVhverK%2Fpihole_update_gravity.png?alt=media&#x26;token=3f0abcfe-6d6f-4fa6-a26e-cda9e188372b" alt="&#x22;Update gravity&#x22; option highlighted in the Tools section of the Pi-hole web UI." width="240"></picture><figcaption></figcaption></figure></div>

   &#x20;
3. Press **Update** and wait for the process to finish.
4. Once done, you will see a success message.

Alternatively, you can run the following command in **Terminal**:

{% code overflow="wrap" %}

```bash
sudo pihole updateGravity
```

{% endcode %}

## Use your Pi-hole DNS over Meshnet <a href="#change-dns-addresses" id="change-dns-addresses"></a>

The Pi-hole configuration is now finished. However, to use Pi-hole and all of its features, you need to set up its Meshnet IP address as the DNS server on each of your client devices.

### Without a VPN connection

{% tabs %}
{% tab title="Windows" %}

### Windows 11 <a href="#windows-11" id="windows-11"></a>

1. Right-click **Start** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FGTHMj8B4fgledLDhPDUm%2Ficon_win_start_11_blue.svg?alt=media&#x26;token=045c5a29-141c-44c1-9dfa-08d59d6bf047" alt="" data-size="line"> and select **Network connections**.
2. Choose the network type your device is using (Wi-Fi or Ethernet).
3. Find the **DNS server assignment** option and click **Edit**.
4. Choose **Manual** from the dropdown menu and enable **IPv4**.
5. Fill in the DNS fields.

   * **Preferred DNS server**: the Meshnet IP of the Pi-hole device
   * **Alternate DNS server**: the DNS address of another provider

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fvl0uStZLqefgedBNSH3U%2Fpihole_win11_dns_dark.png?alt=media&#x26;token=b2159f05-81d3-49da-9487-abb0ebeac3f2" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F2oJyWGOeiDZvQ5eTAWtc%2Fpihole_win11_dns.png?alt=media&#x26;token=6b372c86-79f4-4a07-a27c-13fde71100dd" alt="Pi-hole and alternate DNS addresses entered in Windows settings." width="375"></picture><figcaption></figcaption></figure></div>

   &#x20;
6. Click **Save**.

### Windows 10 <a href="#windows-10" id="windows-10"></a>

1. Right-click **Start** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FUQJtB6BkEOeGOFJGHp5w%2Ficon_win_start_10_blue.svg?alt=media&#x26;token=f54abf2e-d9fb-46f2-893b-8dd5fa570140" alt="" data-size="line"> and select **Network connections**.
2. Select **Change adapter options**.
3. Right-click your current network adapter (Wi-Fi or Ethernet) and choose **Properties**.
4. In the new window, select **Internet Protocol Version 4 (TCP/IPv4)** and click **Properties**.
5. Select **Use the following DNS server addresses** and fill in the fields underneath.

   * **Preferred DNS server**: the Meshnet IP of the Pi-hole device
   * **Alternate DNS server**: the DNS address of another provider

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FLoLP4OsQHkWqhsKNRPtp%2Fpihole_win10_dns.png?alt=media&#x26;token=20848743-5d43-444f-9a07-46a2654e8925" alt="Pi-hole and alternate DNS addresses entered." width="375"><figcaption></figcaption></figure></div>

   &#x20;
6. Click **OK** twice to apply the changes.
   {% endtab %}

{% tab title="Android" %}
{% hint style="info" %}
**Note**

These instructions detail how to change your DNS addresses on Android 16. If you are using a different version of Android, consult your device's specific documentation for guidance, as the procedure may differ.
{% endhint %}

1. Open the **Settings** menu.
2. Go to **Network & internet** > **Internet**, find your current Wi-Fi network, and tap the gear button.
3. In the upper-right corner, select **Modify**.
4. Expand the **Advanced settings** dropdown, and change the **IP settings** value to **Static**.
5. Enter your device's local IP address, network gateway, and network prefix length.
6. Fill in the required DNS addresses.
   * Under **DNS 1**, enter the Meshnet IP of the Pi-hole device.
   * Under **DNS 2**, enter the DNS address of another provider.

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F4FoZr1ObAJBZhrZhcFsa%2FScreenshot_1761032602.png?alt=media&#x26;token=bfadd564-49c5-4182-8fba-ff5ab05e5115" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FfG1K3FXKJGlqHpjeb4Tf%2FScreenshot_1761032594.png?alt=media&#x26;token=e130e969-d661-4dad-b9af-b325c7d935e1" alt="Pi-hole and alternate DNS entered in Android settings." width="375"></picture><figcaption></figcaption></figure></div>

     &#x20;
7. Tap **Save**.
   {% endtab %}

{% tab title="iOS" %}

1. Open **Settings**.
2. Tap **Wi-Fi**, find your current network, and tap the Info<img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FOn4eqQIaY5SNditezKz4%2Ficon_mac_info_blue.svg?alt=media&#x26;token=95c5f2e5-031d-4199-9a0a-43c7006410b3" alt="" data-size="line"> button.
3. Under **DNS**, tap **Configure DNS**, and choose **Manual**.
4. Select **Add server** and enter the Meshnet IP of the Pi-hole device.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FvMyLWIbXUfC61aqdVJCn%2Fios_dns_system_dark.png?alt=media&#x26;token=0fcf9ac1-a6d6-419b-b2f9-e9e0a4ee07ea" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FhbpR2nleJfr8Q8nE5hEv%2Fios_dns_system.png?alt=media&#x26;token=f10c6f5a-7f56-4e6f-b888-98ce63936ba3" alt="Pi-hole Meshnet IP entered in iOS DNS settings." width="375"></picture><figcaption></figcaption></figure></div>

   &#x20;
5. Ensure that the added IP address is at the top.
6. Tap **Save**.
   {% endtab %}

{% tab title="macOS" %}

### macOS Ventura 13 and newer <a href="#macos-ventura-version-13-and-newer" id="macos-ventura-version-13-and-newer"></a>

1. Go to **System settings** and click **Network**.
2. Select the network interface you use (Wi-Fi or Ethernet) and click **Details**.
3. Open the **DNS** tab and click the plus (+) button at the bottom to add the Meshnet IP address of the Pi-hole device.
4. Ensure that the added IP address is at the top.

   <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FcLHe7cxdf7sg4OmM8tdy%2Fpihole_mac_dns_dark.png?alt=media&#x26;token=5fb2f81e-d6aa-4335-84c9-5d18619b7685" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fyrrso9bb1Aq0J0PCsWHm%2Fpihole_mac_dns.png?alt=media&#x26;token=dfe79f32-804f-448d-9392-ceaffbdfbe72" alt="Pi-hole DNS entered in macOS DNS settings."></picture><figcaption></figcaption></figure>

   &#x20;
5. Click **OK** to save the changes.

### macOS Monterey 12 and older <a href="#macos-monterey-version-12-and-older" id="macos-monterey-version-12-and-older"></a>

1. Go to **System preferences** and click **Network**.
2. Select the network interface you use (Wi-Fi or Ethernet) and click **Advanced.**
3. Open the **DNS** tab and add the Meshnet IP address of the Pi-hole device by clicking the plus (+) icon.
4. Ensure that the added IP address is at the top.

   <figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FwqSMP0h9WG5GTrq3K4D5%2Fimage.png?alt=media&#x26;token=36fbd3ab-107c-4e1a-8bd6-77e796ac70fc" alt="Pi-hole DNS entered in macOS DNS settings."><figcaption></figcaption></figure>

   &#x20;
5. Click **OK** and then click **Apply**.
   {% endtab %}

{% tab title="Linux" %}

### Method 1: Using Network Manager <a href="#linux-gui" id="linux-gui"></a>

1. Open **Settings**, and then open either the **Network** or the **Wi-Fi** section (depending on your network type).
2. Click the gear button and go to the **IPv4** tab.
3. Next to **DNS**, turn off the **Automatic** toggle.
4. Enter the Meshnet IP of the Pi-hole device and the DNS of another provider, separated by a comma, in the specified field.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F9LkC6l3gJ0jgd7lMKcud%2Flinux_dns_system_dark.png?alt=media&#x26;token=73445fbe-6d50-4da1-87a2-db4f77cb5f21" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FAXfwKdnnMg7T1IQbZK0T%2Flinux_dns_system.png?alt=media&#x26;token=08c88624-a6cd-44cf-932f-7580e99fe908" alt="Pi-hole Meshnet IP and alternate DNS address entered in Linux network settings."></picture><figcaption></figcaption></figure></div>

   &#x20;
5. Click **Apply**.
6. Open **Terminal** and run the following command to restart the Network Manager daemon:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo systemctl restart NetworkManager
   </code></pre>

   &#x20;
7. Enter your sudo password.&#x20;

### Method 2: Using Terminal <a href="#linux-cli" id="linux-cli"></a>

1. Open **Terminal** and run the following command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo nano /etc/systemd/resolved.conf
   </code></pre>

   &#x20;
2. Locate the `DNS` and `FallbackDNS` lines.
3. Uncomment the lines by removing the hash (#) symbols.
4. Enter the DNS addresses following the equals (=) sign.\
   &#x20;\
   `DNS=<Meshnet IP of the Pi-hole device>`\
   `FallbackDNS=<DNS of another provider>`

   &#x20;

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FZxsdvkik2lbv9GUVC1oW%2Flinux_dns_change.png?alt=media&#x26;token=2f75a20e-61d0-4695-b564-f89b54de1345" alt="Pi-hole Meshnet IP and alternate DNS address entered in the resolved.conf file."><figcaption></figcaption></figure></div>

   &#x20;
5. Press **Ctrl** + **X**, **Y**, and **Enter** to exit and save the changes.
6. Run the following command to ensure that the network changes are applied:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo systemctl restart systemd-resolved
   </code></pre>

   &#x20;
7. Enter your sudo password.&#x20;

{% hint style="info" %}
**Note**

Changes in the `/etc/systemd/resolved.conf` file have a higher priority than settings in the Network Manager. Due to this, ensure that there are no custom configurations in the previously mentioned`resolved.conf` file if you apply the DNS change directly via the Network Manager settings. Otherwise, the specified DNS addresses will not be used.
{% endhint %}
{% endtab %}

{% tab title="Android TV" %}

1. Open the Android TV **Settings** menu.
2. Select **Network & internet**.
3. Choose your network and change the **IP settings** value to **Static**.
4. Enter your device's local IP address, network gateway, and network prefix length.
5. Type in the DNS addresses:
   * In the **DNS 1** field, enter the Meshnet IP address of your Pi-hole device.

     <figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FQ0dBoplKc8J2KmyOOja4%2Ftv_dns.png?alt=media&#x26;token=ac3328da-72f8-422c-b891-07696ed1cd83" alt="Meshnet IP address entered in the DNS 1 field."><figcaption></figcaption></figure>

     &#x20;
   * In the **DNS 2** field, enter the DNS address of another provider.
     {% endtab %}
     {% endtabs %}

### With a VPN connection

Meshnet allows you to use your custom, self-hosted DNS server alongside a VPN connection via the NordVPN app. Follow these steps to use your Pi-hole DNS when connected to a VPN server:

{% tabs %}
{% tab title="Windows" %}

1. Open the **NordVPN** app.
2. Navigate to the **Devices in Meshnet** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FyNPGbeTmyQ5agRdyJD19%2Ficon_meshnet_blue.svg?alt=media&#x26;token=478d08e6-81b2-4acc-af45-46579f95599e" alt="" data-size="line"> tab and copy the Meshnet IP address of your Pi-hole device.
3. In the lower-left corner, click **Settings** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FC2hkblosbIrlIfynbBXZ%2Ficon_settings_blue.svg?alt=media&#x26;token=f897803f-fd71-4620-bc6b-bf86c5485491" alt="" data-size="line">.
4. Select the **Connection and security** section.
5. Turn on the **Use custom DNS** toggle and click the dropdown arrow.
6. In the first field, paste the copied Meshnet IP address.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fi4M8GsZYZGspDIClikdx%2Fwin_dns_app_dark.png?alt=media&#x26;token=7dd2a326-2971-451e-b867-bdd3d83126b5" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FXOEKTQ8IwTKqMq0zErJ6%2Fwin_dns_app.png?alt=media&#x26;token=c6064771-aef5-47d5-accc-dc8bd74b8591" alt="Entering the Meshnet IP address in the Use custom DNS section in the NordVPN app settings."></picture><figcaption></figcaption></figure></div>

   &#x20;
7. Click the Save checkmark.

Now, when you establish a VPN connection to a NordVPN server, the DNS addresses that you specified will be used for the connection.

{% hint style="info" %}
**Note**

In **Threat protection pro** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FBItAyv3nig6bojhmWtFD%2Ficon_tp-pro_blue.svg?alt=media&#x26;token=b7873f20-3ac5-45ef-93ff-3322bdf72ab0" alt="" data-size="line"> > **Advanced browsing protection**, ensure that the **DNS filtering** toggle is turned off. Otherwise, the [Threat Protection feature](https://nordvpn.com/features/threat-protection/) will overwrite the custom DNS change.
{% endhint %}
{% endtab %}

{% tab title="Android" %}

1. Open the **NordVPN** app.
2. Navigate to **Products** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fpj0sQNufY9ZBXInxL7cS%2Ficon_products_blue.svg?alt=media&#x26;token=40a7e012-a8ad-4ba2-9599-0bd15a3516e3" alt="" data-size="line"> > **Meshnet** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FyNPGbeTmyQ5agRdyJD19%2Ficon_meshnet_blue.svg?alt=media&#x26;token=478d08e6-81b2-4acc-af45-46579f95599e" alt="" data-size="line"> > **Manage devices** and copy the Meshnet IP address of your Pi-hole device.
3. Go to the **Profile** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FOdrTcCKmcNvjxUD1IYVE%2Ficon_profile_blue.svg?alt=media&#x26;token=aa032bd1-aa1d-48f0-8013-b50719042e37" alt="" data-size="line"> menu, and then go to **Settings** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FC2hkblosbIrlIfynbBXZ%2Ficon_settings_blue.svg?alt=media&#x26;token=f897803f-fd71-4620-bc6b-bf86c5485491" alt="" data-size="line"> > **DNS**.
4. Select **Use custom DNS**, paste the copied Meshnet IP address, and tap **Add**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FQoB8C2qQYmXGUgxjZ2W0%2Fandroid_dns_app_dark.png?alt=media&#x26;token=eb0a0f3e-e219-4d6c-8168-8d32f027fab8" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FyfvPxJWUBvinkgQtA5Lt%2Fandroid_dns_app.png?alt=media&#x26;token=430f4edd-a5e3-48cf-8943-61bdb240afde" alt="Pi-hole device&#x27;s Meshnet IP address entered in the Custom DNS field." width="375"></picture><figcaption></figcaption></figure></div>

Now, when you establish a VPN connection to a NordVPN server, the DNS addresses that you specified will be used for the connection.

{% hint style="info" %}
**Note**

On the **Threat protection** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FBItAyv3nig6bojhmWtFD%2Ficon_tp-pro_blue.svg?alt=media&#x26;token=b7873f20-3ac5-45ef-93ff-3322bdf72ab0" alt="" data-size="line"> tab, ensure that the **Use threat protection** option is turned off. Otherwise, the [Threat Protection feature](https://nordvpn.com/features/threat-protection/) will overwrite the custom DNS change.
{% endhint %}
{% endtab %}

{% tab title="iOS" %}

1. Open the **NordVPN** app.
2. Navigate to **Products** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fpj0sQNufY9ZBXInxL7cS%2Ficon_products_blue.svg?alt=media&#x26;token=40a7e012-a8ad-4ba2-9599-0bd15a3516e3" alt="" data-size="line"> > **Meshnet** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FyNPGbeTmyQ5agRdyJD19%2Ficon_meshnet_blue.svg?alt=media&#x26;token=478d08e6-81b2-4acc-af45-46579f95599e" alt="" data-size="line"> > **Manage devices** and copy the Meshnet IP address of your Pi-hole device by tapping it.
3. Go to the **Profile** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FOdrTcCKmcNvjxUD1IYVE%2Ficon_profile_blue.svg?alt=media&#x26;token=aa032bd1-aa1d-48f0-8013-b50719042e37" alt="" data-size="line"> menu and select **Settings** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FC2hkblosbIrlIfynbBXZ%2Ficon_settings_blue.svg?alt=media&#x26;token=f897803f-fd71-4620-bc6b-bf86c5485491" alt="" data-size="line">.
4. Under **VPN connection**, tap **Location and protocol**.
5. In the **Enter custom DNS address** field, paste the copied Meshnet IP address.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FbO17mZz0ZXnth5cmJkH5%2Fios_dns_app_dark.png?alt=media&#x26;token=c7b9e3ec-a3c3-4c89-b7ac-42aa889e09da" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FlazGy6XRhT28Mk0cp0Fw%2Fios_dns_app.png?alt=media&#x26;token=23cbe9e7-21db-40a2-86ea-09d29d0b70fd" alt="Entering the Meshnet IP address as the custom DNS server in the NordVPN app." width="375"></picture><figcaption></figcaption></figure></div>

Now, when you establish a VPN connection to a NordVPN server, the DNS addresses that you specified will be used for the connection.

{% hint style="info" %}
**Note**

On the **Threat protection** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FBItAyv3nig6bojhmWtFD%2Ficon_tp-pro_blue.svg?alt=media&#x26;token=b7873f20-3ac5-45ef-93ff-3322bdf72ab0" alt="" data-size="line"> tab, ensure that threat protection is turned off. Otherwise, the [Threat Protection feature](https://nordvpn.com/features/threat-protection/) will overwrite the custom DNS change.
{% endhint %}
{% endtab %}

{% tab title="macOS" %}
{% hint style="info" %}
**Note**

The custom DNS feature is available only on the [direct download](https://nordvpn.com/download/mac/) version of the NordVPN app.
{% endhint %}

1. Open the **NordVPN** app.
2. Navigate to the **Meshnet** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FyNPGbeTmyQ5agRdyJD19%2Ficon_meshnet_blue.svg?alt=media&#x26;token=478d08e6-81b2-4acc-af45-46579f95599e" alt="" data-size="line"> tab and copy the Meshnet IP address of your Pi-hole device.
3. In the upper-right corner, click **Profile** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FOdrTcCKmcNvjxUD1IYVE%2Ficon_profile_blue.svg?alt=media&#x26;token=aa032bd1-aa1d-48f0-8013-b50719042e37" alt="" data-size="line"> > **Settings** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FC2hkblosbIrlIfynbBXZ%2Ficon_settings_blue.svg?alt=media&#x26;token=f897803f-fd71-4620-bc6b-bf86c5485491" alt="" data-size="line"> and go to **Custom DNS**.
4. Click **Add new DNS**.
5. In the new entry, paste the copied Meshnet IP address.
6. Turn on the **Use custom DNS servers** toggle.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FjnfGQ9LMm2LpjqRQNJHk%2Fmac_dns_app_dark.png?alt=media&#x26;token=54724927-ecbe-419d-8c93-21f85a9d6e55" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FXoOTPGWKZktzOMJZ3jP4%2Fmac_dns_app.png?alt=media&#x26;token=04e1c44a-eaa9-4d4c-9d64-c7b11a12c553" alt="Enabling the custom DNS toggle in the NordVPN app settings."></picture><figcaption></figcaption></figure></div>

Now, when you establish a VPN connection to a NordVPN server, the DNS addresses that you specified will be used for the connection.

{% hint style="info" %}
**Note**

In **Threat protection pro** <img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FBItAyv3nig6bojhmWtFD%2Ficon_tp-pro_blue.svg?alt=media&#x26;token=b7873f20-3ac5-45ef-93ff-3322bdf72ab0" alt="" data-size="line"> > **Overview**, ensure that the **DNS filtering** toggle is turned off. Otherwise, the [Threat Protection feature](https://nordvpn.com/features/threat-protection/) will overwrite the custom DNS change.
{% endhint %}
{% endtab %}

{% tab title="Linux" %}

1. Open **Terminal**.
2. Run the following command, replacing `<MeshnetIP>` with your Pi-hole device's Meshnet IP address:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nordvpn set dns &#x3C;MeshnetIP>
   </code></pre>

   &#x20;

   **Example**

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fo1UkUvqEqUy32DZEoWYE%2Flinux_dns_app.png?alt=media&#x26;token=121541b3-0ade-4133-84f0-214992ea0228" alt="Running the &#x27;nordvpn set dns&#x27; command with the Meshnet IP address of the DNS server." width="563"><figcaption></figcaption></figure></div>

Now, when you establish a VPN connection to a NordVPN server, the DNS addresses that you specified will be used for the connection.

{% hint style="info" %}
**Note**

Make sure that **Threat protection lite** is turned off. Otherwise, the [Threat Protection feature](https://nordvpn.com/features/threat-protection/) will overwrite the custom DNS change.

To disable **Threat Protection lite**, use the `nordvpn set tplite off` command.
{% endhint %}
{% endtab %}

{% tab title="Android TV" %}

1. Open the **NordVPN** app.
2. Navigate to **Settings**<img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FC2hkblosbIrlIfynbBXZ%2Ficon_settings_blue.svg?alt=media&#x26;token=f897803f-fd71-4620-bc6b-bf86c5485491" alt="" data-size="line"> > **DNS server**.
3. Choose **Custom** and select **Add server**.

   <figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FWAT8Do32GtKp6F2EGIMp%2Ftv_dns_app_custom.png?alt=media&#x26;token=8e4d8c94-3a84-4136-8d90-f36ab129c94b" alt="&#x22;Add server&#x22; option selected from the DNS server menu."><figcaption></figcaption></figure>

   &#x20;
4. Enter the Meshnet IP address of your Pi-hole device and choose **Add custom DNS**.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FSfYb2Nd1BibSfI3dYIoQ%2Ftv_dns_app.png?alt=media&#x26;token=3a9de79e-b736-4051-a005-97949f6abd16" alt="Meshnet IP written in the &#x27;Enter DNS server&#x27; field."><figcaption></figcaption></figure></div>

Now, when you establish a VPN connection to a NordVPN server, the DNS address that you specified will be used for the connection.

{% hint style="info" %}
**Note**

In **Settings**<img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FC2hkblosbIrlIfynbBXZ%2Ficon_settings_blue.svg?alt=media&#x26;token=f897803f-fd71-4620-bc6b-bf86c5485491" alt="" data-size="line"> > **Threat protection**, ensure that the **Threat Protection** toggle is turned off. Otherwise, the [Threat Protection feature](https://nordvpn.com/features/threat-protection/) will overwrite the custom DNS change.
{% endhint %}
{% endtab %}
{% endtabs %}

{% hint style="success" %}
**Tip**

If you're looking for alternate DNS addresses, here are some of the most popular free DNS providers:

* Google — `8.8.8.8` and `8.8.4.4`
* Cloudflare — `1.1.1.1` and `1.0.0.1`
* AdGuard — `94.140.14.14` and `94.140.15.15`
* Quad9 — `9.9.9.9` and `149.112.112.112`
* OpenDNS — `208.67.222.222` and `208.67.220.220`

You can also use the same upstream DNS addresses from the Pi-hole configuration.
{% endhint %}

After changing the DNS server to the Pi-hole’s Meshnet IP address, the setup is finished. Now you can safely use Pi-hole’s protection features while being away from your home network.

&#x20;
