# How to set up your own DNS server

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

Once the internet connection is set up in your home, it is usually configured to use the internet service provider’s DNS addresses. Using such DNS can lead to a number of inconveniences: longer website loading times, unwanted URL blocking, and query logging. All of these factors can make the browsing experience feel like a chore. Thankfully, there are various ways to overcome these hindrances, such as configuring a personal DNS server. A tool that allows you to do exactly this is [dnsmasq](https://en.wikipedia.org/wiki/Dnsmasq).

By using the free dnsmasq[ ](https://en.wikipedia.org/wiki/Dnsmasq)software, your device can function as a DNS forwarder and DHCP server. It has an integrated DNS caching feature. This means that any website that is saved in the cache will open nearly instantly. Such behavior leads to a much smoother and more enjoyable browsing experience. Additionally, you are in control of your DNS records, as you can monitor them directly on your device or disable logging altogether.

The drawback of dnsmasq is that it is designed to work only on the local network. However, with the addition of [Meshnet](https://nordvpn.com/meshnet/), you can use your dnsmasq configuration no matter how far away from home you are.

In this article, you will find instructions on how to set up a personal DNS server using dnsmasq on macOS and Linux.

{% 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 dnsmasq [with a VPN connection](#with-a-vpn-connection).
{% endhint %}

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

## Before you begin

Because dnsmasq uses port 53 for its functionality, it is important to ensure that this port is available on your system before configuring dnsmasq. To do so, open Terminal and execute the following command:

{% code overflow="wrap" %}

```bash
sudo lsof -i -n -P | grep :53
```

{% endcode %}

If port 53 is being used, in the output, you will see the name of the process that is using it.

In case the port is occupied, you will need to free it up by killing the other process which is using port 53 or changing its port to a different one.

### Install Homebrew <a href="#install-homebrew" id="install-homebrew"></a>

To install dnsmasq, you can use the [Homebrew](https://brew.sh/) package manager. Install Homebrew by taking these steps:

1. Open **Terminal**.
2. Enter the following command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
   </code></pre>

   &#x20;\
   For additional information about the installation process, refer to [Homebrew documentation](https://docs.brew.sh/Installation).
3. Follow the on-screen instructions to finish the installation.

### Find the Meshnet network interface <a href="#find-the-meshnet-network-interface" id="find-the-meshnet-network-interface"></a>

Communication between devices in Meshnet is done via the Meshnet network interface. The name of the interface can differ for each device. To find the correct name on your device:

1. [Enable Meshnet on macOS](https://meshnet.nordvpn.com/getting-started/how-to-start-using-meshnet/using-meshnet-on-macos#enable-meshnet-on-macos).
2. Open **Terminal**.
3. Run the following command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">ifconfig
   </code></pre>

   &#x20;
4. Locate the interface with your Meshnet IP and note its name. For example, `utun4`.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FzYlgK4hcuF97ucGv7y95%2Fdnsmasq_mac_utun_dark.png?alt=media&#x26;token=b1a891f4-de6d-4f3d-87ff-717649f451ed" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FbUKEGKYOdoJotngp7Zsb%2Fdnsmasq_mac_utun.png?alt=media&#x26;token=94353f5b-bb82-4586-9a0c-bb544cbab848" alt="Meshnet network interface"></picture><figcaption></figcaption></figure></div>

## Install dnsmasq <a href="#install-dnsmasq" id="install-dnsmasq"></a>

To start configuring your DNS server, you will need to install dnsmasq on your machine.

1. Open **Terminal**.
2. Install dnsmasq by running the following command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">brew install dnsmasq
   </code></pre>

The dnsmasq application will be installed.

## Configure dnsmasq <a href="#configure-dnsmasq" id="configure-dnsmasq"></a>

Dnsmasq settings are controlled via its configuration file called `dnsmasq.conf`.

1. Open the `dnsmasq.conf` file using the Nano text editor by running this command in **Terminal**:\
   &#x20;\
   For Intel Macs:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nano /usr/local/etc/dnsmasq.conf
   </code></pre>

   &#x20;\
   For [Apple silicon Macs](https://support.apple.com/en-us/HT211814):

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nano /opt/homebrew/etc/dnsmasq.conf
   </code></pre>

   &#x20;
2. Using the **Control** ⌃ + **W** keyboard shortcut, locate and uncomment the following lines by removing the hash (#) symbol at the start:
   * `domain-needed`
   * `bogus-priv`&#x20;

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FAG76If5GWhLN6L54wmhE%2Fdnsmasq_mac_domain_bogus_dark.png?alt=media&#x26;token=9940eaa5-cc8a-48cc-ae9e-6b170f9d6072" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FEPya5W81xDn7k0ghIn2L%2Fdnsmasq_mac_domain_bogus.png?alt=media&#x26;token=3584945d-301c-40dd-8d88-22549a961310" alt="domain-needed and bogus-priv lines"></picture><figcaption></figcaption></figure></div>

     &#x20;
   * `no-resolv`&#x20;

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FU5yuMjWeAMID08EqMhKP%2Fdnsmasq_mac_noresolv_dark.png?alt=media&#x26;token=c8aa2538-aed7-46c9-bcc5-123607dfcb45" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FZ9TtCOHrJuAubPKYJhuR%2Fdnsmasq_mac_noresolv.png?alt=media&#x26;token=dcef2714-6f4f-41af-a190-03ce1b856157" alt="no-resolv line"></picture><figcaption></figcaption></figure></div>

     &#x20;
3. Find the `cache-size` line, uncomment it, and change the value to 1000.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FCjNbn5REVKJEZ0ZUsHsY%2Fdnsmasq_mac_cache_size_dark.png?alt=media&#x26;token=7214f803-56d6-4360-a2bf-9358495fe795" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FhlFXk7QtR8u4rNnsAPYM%2Fdnsmasq_mac_cache_size.png?alt=media&#x26;token=1417db49-61a9-4bdc-a8a4-5fe2a8bd4b7e" alt="cache-size line"></picture><figcaption></figcaption></figure></div>

   &#x20;
4. Locate the `interface` line, uncomment it, and append the name of the network interface from the [Find the Meshnet network interface](#find-the-meshnet-network-interface) section after the equals (=) sign.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FGkOpO28C875rThO977Es%2Fdnsmasq_mac_interface_dark.png?alt=media&#x26;token=50560739-5f2b-4516-baa2-d5174fc8682a" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fip9EZO3kl17Jv9XC9uhW%2Fdnsmasq_mac_interface.png?alt=media&#x26;token=3fd782a6-0ac0-4982-9231-325d93fb400a" alt="interface line with the Meshnet network interface name"></picture><figcaption></figcaption></figure></div>

   &#x20;
5. Find the `#server=/localnet/192.168.0.1` line and replace it with the following two lines:

   <pre data-overflow="wrap"><code>server=1.1.1.1
   server=8.8.8.8
   </code></pre>

   &#x20;

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FYQyQUpSLJWfJznbjqZHM%2Fdnsmasq_mac_servers_dark.png?alt=media&#x26;token=785acb5f-e300-4d65-b326-4c88b983a403" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FhXV6RX3TqBBZDc4faPl9%2Fdnsmasq_mac_servers.png?alt=media&#x26;token=3945e9ec-f90a-40d0-b4d6-d77a99f0ad83" alt="Edited server lines"></picture><figcaption></figcaption></figure></div>

   &#x20;

   Instead of the `1.1.1.1` and `8.8.8.8` DNS addresses, you can use your preferred DNS provider for the upstream DNS.
6. Press **Control** ⌃ + **X**, **Y**, and **Return** to save changes and exit.

Start the dnsmasq process as the root user via the following command:

```bash
sudo brew services start dnsmasq
```

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

Detailed information about the altered parameters can be found in the Options section of the [dnsmasq manual page](https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html).
{% endhint %}

### Enable query logging (optional)

You can enable query logging in the `dnsmasq.conf` file to monitor for any failed DNS resolutions or inconsistencies in website loading.

1. Open **Terminal** and run the following command:\
   &#x20;\
   For Intel Macs:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nano /usr/local/etc/dnsmasq.conf
   </code></pre>

   &#x20;

   For [Apple silicon Macs](https://support.apple.com/en-us/HT211814):

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nano /opt/homebrew/etc/dnsmasq.conf
   </code></pre>

   &#x20;
2. Locate the `log-queries` line and uncomment it by removing the hash (#) symbol at the start.
3. Append a new `log-facility=/usr/local/var/log/dnsmasq.log` line below `log-queries`.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FiYVTZ0eQkhXh7hBTi8Em%2Fdnsmasq_mac_log_dark.png?alt=media&#x26;token=5f7ac771-e408-4feb-a406-188b09db96f2" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FRqkWSJn4hlJ8SONGGilx%2Fdnsmasq_mac_log.png?alt=media&#x26;token=5ce6c37d-eba6-4264-8686-d67e88afb5a6" alt="Lines for query logging"></picture><figcaption></figcaption></figure></div>

   &#x20;
4. Press **Control** + **X**, **Y**, and **Return** to save changes and exit.
5. Restart the dnsmasq process by running:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo brew services restart dnsmasq
   </code></pre>

All of the DNS queries will now be logged in the `/usr/local/var/log/dnsmasq.log` file.

## Test dnsmasq

To test if dnsmasq was configured properly and is working, do the following:

1. Open **Terminal**.
2. Check the status of the dnsmasq service via this command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo brew services list
   </code></pre>

   &#x20;&#x20;

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FBsDhtxu9NO7xBuEUPKHo%2Fdnsmasq_mac_brew_list_dark.png?alt=media&#x26;token=75cdc5e9-c6de-49de-83d4-207eb6c291cc" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fw5AoEc57IWRmeABXPz66%2Fdnsmasq_mac_brew_list.png?alt=media&#x26;token=f37104af-5d92-4b68-8d0a-05e57054f54b" alt="Status of the dnsmasq service"></picture><figcaption></figcaption></figure></div>

   &#x20;
3. Check if the domain name resolution is working properly by using `dig`:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">dig nordvpn.com @localhost
   </code></pre>

   &#x20;

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FpFYu7S2K8buf4H1WRREP%2Fdnsmasq_mac_dig_dark.png?alt=media&#x26;token=84425475-d47d-4eca-beb7-2e650c766d93" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FutmdBOcMwyFcQ3SGcKiL%2Fdnsmasq_mac_dig.png?alt=media&#x26;token=3e69e012-1691-47b4-8292-f03f9266016d" alt="Output of the &#x27;dig&#x27; command"></picture><figcaption></figcaption></figure></div>

If you receive an answer to the `dig` command, it indicates that your DNS server is working properly and ready for use.
{% endtab %}

{% tab title="Linux" %}

## Before you begin <a href="#prerequisites" id="prerequisites"></a>

Because dnsmasq uses port 53 for its functionality, it is important to ensure that this port is available on your system before configuring dnsmasq. To do so, open Terminal and execute the following command:

{% code overflow="wrap" %}

```bash
sudo netstat -tulpn | grep :53
```

{% endcode %}

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

The `net-tools` package is required to use the `netstat` command.

It can be installed by running the following:

```bash
sudo apt install net-tools
```

{% endhint %}

If port 53 is being used, in the output, you will see the number and the name of the process that is using it.

<div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F9MohzoYreisaLNzOJCfC%2Fdnsmasq_linux_port_check.png?alt=media&#x26;token=adf46558-e015-4279-b3cf-b21fca0a7484" alt="Systemd-resolved listening on port 53"><figcaption></figcaption></figure></div>

In case the port is occupied, you will need to free it up by killing the other process which is using port 53 or changing its port to a different one.

### Free up port 53 used by systemd-resolve <a href="#free-up-port-53-used-by-systemd-resolve" id="free-up-port-53-used-by-systemd-resolve"></a>

Many Linux distributions use systemd-resolve for DNS query resolution. To disable the systemd-resolved service from binding to port 53:

1. Open **Terminal**.

2. Open the `resolved.conf` file using the Nano text editor by running this command

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

3. At the end of the file, append this line:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">DNSStubListener=no
   </code></pre>

   &#x20;

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FhYuBHbYySL2KPRPCshWf%2Fdnsmasq_linux_dnsstub.png?alt=media&#x26;token=406ef3fa-baf3-47d1-92b0-aa473d061367" alt="DNSStubListener line"><figcaption></figcaption></figure></div>

   &#x20;

4. Press **Ctrl** + **X**, **Y**, and **Enter** to save changes and exit.

5. Run the following command to restart the systemd-resolved process:

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

## Install dnsmasq <a href="#install-dnsmasq" id="install-dnsmasq"></a>

To start configuring your DNS server, you will need to install dnsmasq on your machine.

1. Open Terminal.
2. Update all of your repositories and install dnsmasq by running the following command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo apt update &#x26;&#x26; sudo apt install dnsmasq
   </code></pre>

The dnsmasq application will be installed and started automatically.

## Configure dnsmasq <a href="#configure-dnsmasq" id="configure-dnsmasq"></a>

Dnsmasq settings are controlled via its configuration file called `dnsmasq.conf`.

1. Open the `dnsmasq.conf` file using the Nano text editor by running this command in Terminal:

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

2. Using the **Ctrl** + **W** keyboard shortcut, locate and uncomment the following lines by removing the hash (#) symbol at the start:
   * `domain-needed`
   * `bogus-priv`&#x20;

     <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FSMItpwRbnaHGk41msa6C%2Fdnsmasq_linux_domain_bogus.png?alt=media&#x26;token=35b20c90-df9f-45c4-a377-2ff6004da8eb" alt="Uncommented &#x22;domain-needed&#x22; and &#x22;bogus-priv&#x22; lines."><figcaption></figcaption></figure></div>

     &#x20;
   * `no-resolv`

     <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FlFMPcQVlkllZp2v84OLK%2Fdnsmasq_linux_noresolv.png?alt=media&#x26;token=b4599974-9b03-4689-9273-b8b8aa0345be" alt="no-resolv line"><figcaption></figcaption></figure></div>

3. Find the `cache-size` line, uncomment it, and change the value to 1000.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FQH418zmEScWFOLwQlJNm%2Fdnsmasq_linux_cache_size.png?alt=media&#x26;token=b9784aa2-29ca-44a3-9534-fea3ecaf5262" alt="cache-size line"><figcaption></figcaption></figure></div>

   &#x20;

4. Locate the `interface` line, uncomment it, and append `nordlynx` after the equals (=) sign.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FORlpDUjhK5PZSs9L0rMz%2Fdnsmasq_linux_interface.png?alt=media&#x26;token=613d6989-1e6d-42b9-bfbc-f6d73c91643d" alt="interface line with &#x27;nordlynx&#x27; appended"><figcaption></figcaption></figure></div>

   &#x20;

5. Find the `#server=/localnet/192.168.0.1` line and replace it with the following two lines:

   <pre data-overflow="wrap"><code>server=1.1.1.1
   server=8.8.8.8
   </code></pre>

   &#x20;&#x20;

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F953vd5SvJUb7nnM1FjfM%2Fdnsmasq_linux_servers.png?alt=media&#x26;token=ca48a242-07a0-448b-82a7-192acebc2f70" alt="Edited server lines"><figcaption></figcaption></figure></div>

   &#x20;\
   Instead of the `1.1.1.1` and `8.8.8.8` DNS addresses, you can use your preferred DNS provider for the upstream DNS.

6. Press **Ctrl** + **X**, **Y**, and **Enter** to save changes and exit.

To ensure that the changes are applied, restart the dnsmasq process via the following command:

{% code overflow="wrap" %}

```bash
sudo systemctl restart dnsmasq
```

{% endcode %}

### Enable query logging (optional) <a href="#enable-query-logging-optional" id="enable-query-logging-optional"></a>

You can enable query logging in the `dnsmasq.conf` file to monitor for any failed DNS resolutions or inconsistencies in website loading.

1. Open Terminal and run the following command:

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

   &#x20;
2. Locate the `log-queries` line and uncomment it by removing the hash (#) symbol at the start.
3. Append a new `log-facility=/var/log/dnsmasq.log` line below `log-queries`.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FbjVOvLOnH7kjUXA4OHtZ%2Fdnsmasq_linux_log.png?alt=media&#x26;token=479b3861-a98c-437d-9557-36258f1da42b" alt="Lines for query logging"><figcaption></figcaption></figure></div>

   &#x20;
4. Press **Ctrl** + **X**, **Y**, and **Enter** to save changes and exit.
5. Restart the dnsmasq process by running:

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

All of the DNS queries will now be logged in the `/var/log/dnsmasq.log` file.

## Test dnsmasq <a href="#test-dnsmasq" id="test-dnsmasq"></a>

To test if dnsmasq was configured properly and is working, do the following:

1. Open Terminal.
2. Run the following command to check the syntax in the `dnsmasq.conf` file:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">dnsmasq --test
   </code></pre>

   &#x20;

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FeX2Fr7QXiY2F8hfzvFB5%2Fdnsmasq_linux_test.png?alt=media&#x26;token=0cd7337d-a7b1-4ac1-bf48-37f51214505c" alt="dnsmasq syntax check" width="327"><figcaption></figcaption></figure></div>

   &#x20;
3. Install the `dnsutils` tool by running this command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">sudo apt install dnsutils
   </code></pre>

   &#x20;
4. Check if the domain name resolution is working properly by using `dig`:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">dig nordvpn.com @localhost
   </code></pre>

   &#x20;

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F5PzdvpE6jpeLafKIygFD%2Fdig.png?alt=media&#x26;token=25b16ea3-ac61-4158-b70e-7b87d3d452d5" alt="Output of the &#x27;dig&#x27; command"><figcaption></figcaption></figure></div>

If you receive an answer to the `dig` command, it indicates that your DNS server is working properly and ready for use.
{% endtab %}
{% endtabs %}

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

With dnsmasq fully set up, you can start using it on your devices. For usage via Meshnet, you must set the server device’s Meshnet IP address as the DNS server on each client device.

### 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 dnsmasq 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 dnsmasq 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="dnsmasq 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 dnsmasq 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="dnsmasq 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. Tap **Configure DNS** and choose **Manual**.
4. Select **Add server** and enter the Meshnet IP of the dnsmasq 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="dnsmasq 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 dnsmasq 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 dnsmasq device by clicking the plus (+) icon.
4. Ensure that the added IP address is at the top.

   <div align="left"><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="dnsmasq Meshnet IP entered in macOS DNS settings."><figcaption></figcaption></figure></div>

   &#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 select either **Network** or **Wi-Fi** based 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. In the **DNS** field, enter the Meshnet IP of the dnsmasq device and the DNS of another provider, separated by a comma.

   <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="dnsmasq 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 appropriate DNS addresses after the equals (=) sign, as shown:\
   \
   `DNS=<Meshnet IP of the dnsmasq device>`\
   `FallbackDNS=<DNS of another provider>`

   <div align="center"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FU8O1pQ8hs46Gw5XNKopT%2Flinux_dns_change.png?alt=media&#x26;token=b7647373-1ff0-441d-9c55-0fb5a85d584a" alt="Changed DNS on Linux"><figcaption></figcaption></figure></div>

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>

7. Enter your sudo password.&#x20;

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

Changes in the `/etc/systemd/resolved.conf` file take priority over settings in the Network Manager. Therefore, if you apply the DNS change directly via the Network Manager settings, ensure that there are no custom configurations in the previously mentioned `resolved.conf` file. 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 dnsmasq 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 dnsmasq DNS when connected to a VPN server:

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

1. Open the **NordVPN** app.
2. Navigate to **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"> and copy the Meshnet IP address of your dnsmasq 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 address 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 dnsmasq 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 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"> > **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="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 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 address 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 dnsmasq 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 **Enable 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 address 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 dnsmasq 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 address 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;Custom&#x22; option selected from the DNS menu."><figcaption></figcaption></figure>

   &#x20;
4. Enter the Meshnet IP address of your dnsmasq device.

   <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 `dnsmasq.conf` file.
{% endhint %}

With the DNS changes applied, you have finished the setup process. Your personal DNS server can now be used remotely, with the help of Meshnet.
