> ## Documentation Index
> Fetch the complete documentation index at: https://e-gurl.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting DNS

> How DNS-MNS configures DNS on different operating systems

# Setting DNS

DNS-MNS can automatically configure DNS on Windows, macOS, and Linux. This page explains how DNS is set on each platform.

## Automatic DNS Configuration

After testing DNS servers, you can apply one of the top results:

```
Would you like to apply one of these DNS servers? (y/n): y
Enter selection (1-3): 1
```

The tool automatically detects your operating system and uses the appropriate method.

## Platform-Specific Methods

<Tabs>
  <Tab title="Linux">
    DNS-MNS supports multiple Linux DNS management systems:

    ### systemd-resolved (Default on Ubuntu 18.04+, Fedora, etc.)

    Creates a configuration file at `/etc/systemd/resolved.conf.d/dns-mns.conf`:

    ```ini theme={null}
    [Resolve]
    DNS=1.1.1.1 1.0.0.1
    ```

    Then restarts the service:

    ```bash theme={null}
    sudo systemctl restart systemd-resolved
    ```

    ### NetworkManager

    Uses `nmcli` to configure the active connection:

    ```bash theme={null}
    nmcli connection modify "Your Connection" ipv4.dns "1.1.1.1 1.0.0.1"
    nmcli connection modify "Your Connection" ipv4.ignore-auto-dns yes
    nmcli connection up "Your Connection"
    ```

    ### Fallback (resolv.conf)

    If neither systemd-resolved nor NetworkManager is available:

    ```bash theme={null}
    # Backs up existing configuration
    cp /etc/resolv.conf /etc/resolv.conf.backup

    # Writes new DNS
    echo "nameserver 1.1.1.1" > /etc/resolv.conf
    echo "nameserver 1.0.0.1" >> /etc/resolv.conf
    ```
  </Tab>

  <Tab title="macOS">
    Uses the `networksetup` command to configure all active network services:

    ```bash theme={null}
    # Detects active interfaces (Wi-Fi, Ethernet, etc.)
    networksetup -listallnetworkservices

    # Sets DNS for each active interface
    networksetup -setdnsservers "Wi-Fi" 1.1.1.1 1.0.0.1

    # Flushes DNS cache
    dscacheutil -flushcache
    killall -HUP mDNSResponder
    ```
  </Tab>

  <Tab title="Windows">
    Uses PowerShell to configure DNS:

    ```powershell theme={null}
    # Sets DNS for the active interface
    Set-DnsClientServerAddress -InterfaceAlias "Wi-Fi" -ServerAddresses ("1.1.1.1","1.0.0.1")

    # Clears DNS cache
    Clear-DnsClientCache
    ```

    <Warning>
      Requires Administrator privileges. Right-click Git Bash or PowerShell and select "Run as Administrator".
    </Warning>
  </Tab>
</Tabs>

## Manual DNS Configuration

You can also set DNS manually using option `2` from the main menu:

```
[ SET CUSTOM DNS ]

Choose DNS server or enter custom:

  [1]  Cloudflare (1.1.1.1)
  [2]  Google (8.8.8.8)
  [3]  Shecan (178.22.122.100)
  ...
  [99] Enter custom DNS

Enter your choice:
```

### Using Custom DNS

Select option `99` to enter custom DNS IPs:

```
Enter primary DNS: 1.2.3.4
Enter secondary DNS (or press Enter to skip): 5.6.7.8
```

## Verifying DNS Changes

After setting DNS, verify it's working:

<Tabs>
  <Tab title="Linux">
    ```bash theme={null}
    # Check current DNS
    resolvectl status

    # Or
    cat /etc/resolv.conf

    # Test resolution
    dig google.com
    ```
  </Tab>

  <Tab title="macOS">
    ```bash theme={null}
    # Check current DNS
    scutil --dns

    # Or for specific interface
    networksetup -getdnsservers Wi-Fi

    # Test resolution
    nslookup google.com
    ```
  </Tab>

  <Tab title="Windows">
    ```powershell theme={null}
    # Check current DNS
    Get-DnsClientServerAddress

    # Test resolution
    nslookup google.com
    ```
  </Tab>
</Tabs>

## Making DNS Persistent

By default, DNS changes made by DNS-MNS are persistent. However, some systems may reset DNS on reboot.

<Tabs>
  <Tab title="Linux">
    **For NetworkManager:**

    ```bash theme={null}
    sudo nmcli connection modify "Your Connection" ipv4.ignore-auto-dns yes
    ```

    **For systemd-resolved:**
    The configuration file at `/etc/systemd/resolved.conf.d/` is automatically persistent.
  </Tab>

  <Tab title="macOS">
    DNS changes via `networksetup` are persistent across reboots.
  </Tab>

  <Tab title="Windows">
    DNS changes via `Set-DnsClientServerAddress` are persistent across reboots.
  </Tab>
</Tabs>

## Administrator Privileges

DNS-MNS automatically requests elevated privileges when needed:

* **Linux/macOS:** Prompts for sudo password
* **Windows:** Requires running as Administrator

If you see "Permission denied", run the tool with elevated privileges:

```bash theme={null}
# Linux/macOS
sudo dns-mns

# Windows: Right-click terminal -> Run as Administrator
```
