Set up SmartDNS in Alpine Linux (LXC)
SmartDNS is a local DNS server that retrieves DNS query results from multiple upstream DNS servers and delivers the fastest results to clients. It supports secure DNS protocols such as DoT (DNS over TLS) and DoH (DNS over HTTPS), providing enhanced privacy protection, avoiding DNS pollution, and improving network access speed. Additionally, SmartDNS supports high-performance ad filtering for an overall better browsing experience
Features |
- Multiple upstream DNS servers
- Return the fastest IP address
- Support for multiple query protocols
- Domain IP address specification
- Domain name high-performance rule filtering
- Linux/Windows multi-platform support
- Support IPV4, IPV6 dual stack
- DNS64
- High performance, low resource consumption
- DNS domain forwarding
Architecture |
Install SmartDNS on Alpine Linux (PVE LXC) |
Here is how to install SmartDNS on Alpine Linux running in a Proxmox VE LXC container
Download the latest version of SmartDNS from official website
|
|
Connecting to github.com (20.205.243.166:443) Connecting to objects.githubusercontent.com (185.199.111.133:443) saving to ‘smartdns.1.2023.05.07-1641.x86_64-linux-all.tar.gz’ smartdns.1.2023.05.0 100% |******************************************************************************************| 1628k 0:00:00 ETA ‘smartdns.1.2023.05.07-1641.x86_64-linux-all.tar.gz’ saved
Start to install
|
|
created directory: ‘/etc/smartdns’ ‘usr/sbin/smartdns’ -> ‘/usr/sbin/smartdns’ ’etc/smartdns/smartdns.conf’ -> ‘/etc/smartdns/smartdns.conf’ install: can’t create ‘/etc/default/smartdns’: No such file or directory
copy the execute file to binaries with superuser (root) privileges directory
|
|
backup original SmartDNS configuration file
|
|
create a new SmartDNS configuration file
Official reference: https://pymumu.github.io/smartdns/en/config/basic-config/
|
|
Disable DNS queries from UDHCP
|
|
Update the nameserver to localhost from /etc/resolv.conf
in the PVE’s LXC
Enable the service to start on boot
|
|
Now Apply setting and functions by reboot
|
|
Create a systemd service file for SmartDNS (alternative) |
Create a new systemd service file at /etc/init.d/smartdns
|
|
Add the following content to the file:
|
|
Save and exit the text editor.
Enable and start SmartDNS
|
|
Now, set to start on boot on your Alpine Linux system.
Ad Blocking by SmartDNS |
SmartDNS can block ads by returning SOA for the corresponding domain name. Official reference: https://pymumu.github.io/smartdns/en/config/ad-block/
Create a script to download the anti-ad-smartdns.conf
file from the community URL
|
|
Make the script executable:
|
|
Open the crontab
editor:
|
|
Add the following line to the end of the file to run the script every day at 1:00 AM:
|
|
Modify the /etc/smartdns/smartdns.conf
file to include the above configuration file:
|
|
Reference |
Related |