How to Set Up an AdGuard DNS Server on Your VPS Hosting Plan
AdGuard DNS is a privacy-focused, ad-blocking DNS solution that enhances your internet browsing experience by filtering unwanted content at the DNS level. Setting up an AdGuard DNS server on your VPS hosting plan allows you to customize and control your browsing environment, block ads, and improve security. This comprehensive guide provides step-by-step instructions to set up AdGuard DNS on your VPS.
Why Choose AdGuard DNS?
AdGuard DNS is more than just a standard DNS resolver. By integrating ad-blocking and privacy-enhancing features, it provides a seamless way to filter internet traffic at the network level. Unlike browser-based ad-blockers, AdGuard DNS works for all devices on your network, providing comprehensive coverage without requiring individual installations.
- Blocks ads and trackers globally.
- Enhances privacy by filtering DNS queries.
- Improves security by blocking access to malicious domains.
- Allows custom filters and DNS settings for personalized control.
Prerequisites
Before beginning, ensure your VPS and local environment meet the following requirements:
- A VPS with a supported Linux distribution (Ubuntu/Debian recommended).
- At least 1 GB RAM and 20 GB storage space.
- Docker installed on the VPS (we’ll guide you if not).
- Basic familiarity with SSH access and Linux commands.
- A domain name (optional, but recommended for easy access).
Step 1: Update Your Server
Start by updating your server’s system packages to ensure compatibility and security:
sudo apt update && sudo apt upgrade -y
This command updates the package index and upgrades all installed packages to their latest versions.
Step 2: Install Docker
AdGuard DNS runs efficiently as a Docker container. Docker simplifies installation, upgrades, and management of the AdGuard service.
Install Docker
Run the following command to install Docker using an automated script:
curl -fsSL https://get.docker.com | bash
Start Docker
Enable Docker to start on boot and verify the installation:
sudo systemctl start docker
sudo systemctl enable docker
docker --version
Step 3: Download and Run AdGuard Home
With Docker installed, you can now pull the AdGuard Home Docker image and create a container for it. This will allow you to manage DNS queries efficiently.
Pull the AdGuard Docker Image
docker pull adguard/adguardhome
This command downloads the latest version of AdGuard Home to your VPS.
Run the AdGuard Container
Create and run the AdGuard Home container:
docker run -d --name adguardhome \
-v /opt/adguardhome/work:/opt/adguardhome/work \
-v /opt/adguardhome/conf:/opt/adguardhome/conf \
-p 53:53/tcp -p 53:53/udp \
-p 80:80/tcp \
-p 3000:3000/tcp \
adguard/adguardhome
/opt/adguardhome/work
and/opt/adguardhome/conf
store working and configuration files.- Ports 53 (DNS), 80 (HTTP), and 3000 (Admin interface) are mapped for use.
Step 4: Access AdGuard Home
After starting the container, access AdGuard Home using your server’s IP address in a web browser. Replace
your-server-ip
with your VPS’s IP:
http://your-server-ip:3000
Follow the setup wizard to configure your DNS server and set up admin credentials.
Step 5: Configure AdGuard DNS
During the setup wizard, you can:
- Enable ad-blocking, tracker-blocking, and malware filters.
- Set upstream DNS servers for enhanced privacy (e.g., Quad9, Cloudflare).
- Configure custom DNS rules to block or allow specific domains.
Step 6: Point Devices to Your DNS Server
To use AdGuard DNS, you need to configure devices or your router to use your VPS’s IP address as the DNS resolver.
- Access your device or router’s DNS settings.
- Replace existing DNS addresses with your server’s IP (use port 53).
- Save the changes and restart the network if required.
Step 7: Optimize and Secure Your AdGuard Server
Consider these additional steps to enhance functionality and security:
- Enable HTTPS: Use a Let’s Encrypt certificate to secure the admin interface.
- Enable Logging: Monitor DNS queries and blocklists for insights.
- Keep AdGuard Updated: Use Docker to pull the latest AdGuard images.
docker pull adguard/adguardhome
docker container restart adguardhome
Conclusion
Setting up AdGuard DNS on your VPS provides a robust, private, and efficient way to filter unwanted content and enhance browsing security. With this configuration, all devices on your network can benefit from ad-blocking and privacy features. For advanced configurations, explore custom filters and DNS encryption options.