dnsDiGi Auto-DNS Script

The intelligent, all-in-one automatic DNS bash script for Linux.

Get Started

Tired of manually editing DNS settings? This script automates everything. Install it with a single command and let it handle the rest.

curl -sL https://dnsdigi.com/auto-dns/auto-dns.sh | sudo bash
sudo auto-dns --uninstall

A Deep Dive into Auto-DNS Features

This all-in-one DNS bash script is more than just a simple tool; it's a complete, autonomous system for managing your server's DNS. It was built with reliability and performance as top priorities. Below is a detailed look at the core features that make it an essential utility for any Linux administrator.

Automated Health Checks & Self-Healing

The cornerstone of the script's reliability is its autonomous health monitoring. On a schedule you define, the script performs an **auto health check** to ensure your server can successfully resolve domains. The real intelligence, however, is in its **auto-healing** capability. Before committing any changes, the script takes a snapshot of your working configuration. After applying the new, optimized DNS servers, it runs another health check. If this check fails for any reason, the script immediately performs an **auto reverting** action, rolling back to the last-known-good configuration. This ensures that a faulty DNS server update can never leave your system without internet connectivity.

Robust Backup and Restore System

Peace of mind is built-in with a comprehensive backup and restore system. The script automatically creates **backups** of its own configuration on a daily, weekly, or monthly basis. It also intelligently prunes old backups to save disk space. More importantly, it creates a special backup right before making any significant changes, such as applying a new DNS profile. Should you ever wish to revert to a previous state, the interactive menu provides an easy-to-use **restore** function. You can view a list of all available backups and restore any of them with a single command, providing a complete safety net for your settings.

Intelligent, Performance-Based DNS Selection

This script is not just a static `/etc/resolv.conf` editor. It actively seeks out the best possible performance for your server's specific location. It fetches curated lists of top-tier DNS providers and runs real-time latency tests against every single server. It then sorts the servers by their response time and selects the top two IPv4 and top two IPv6 servers to build your new, optimized DNS configuration. This dynamic process ensures you are always using the absolute fastest resolvers available to you, minimizing lookup times and speeding up your server's network requests.

Smart System Integration

The automatic DNS bash script is smart enough to know it shouldn't just blindly overwrite `/etc/resolv.conf`. It first detects the system's primary DNS manager. If you're running NetworkManager (common on desktops and many servers) or systemd-resolved (the modern standard), it will use the correct command-line tools (`nmcli` or `resolvectl`) to apply settings in a way that is persistent and compliant with your OS. This intelligent integration ensures maximum stability and compatibility.

Supported Operating Systems

The script is designed for wide compatibility across the most popular Linux distributions. The installer automatically detects the OS and handles any necessary dependencies. Supported systems include:

AlmaLinux Alpine Linux CentOS Stream Debian Fedora Rocky Linux Ubuntu