A powerful DNS proxy server with SOCKS5 proxy support, intelligent routing, and a web-based management interface. Route specific domains to specific DNS servers and proxy traffic through SOCKS proxies based on domain rules.
- Service-Oriented Management: Organize your DNS servers as "services" with beautiful overview cards
- Visual Dashboard: See all your SmartDNS services at a glance with domain counts
- Intelligent DNS Routing: Route specific domains/subdomains to specific DNS servers
- Wildcard Support: Use
*.domain.comto match all subdomains - Domain Discovery Tool: Analyze any website to automatically discover all domains it uses and test them against SmartDNS
- Client Tracking: See which devices are making DNS requests with reverse DNS hostname resolution
- DNS Request Logs: View last 200 DNS requests in real-time with dropdown selection for quick domain assignment
- Dual-Stack DNS: Full IPv4 and IPv6 support for modern networks
- DNS-over-TLS: Encrypted DNS support for Android Private DNS and other devices
- Integrated SOCKS5 Server: Full SOCKS5 proxy on port 1080
- Automatic DNS Integration: All SOCKS connections use local DNS proxy rules automatically
- Domain-Based Routing: Route specific domains through different upstream SOCKS proxies
- Proxy Chaining: Connect to upstream SOCKS proxies based on domain rules
- Authentication Support: Username/password authentication for upstream proxies
- Web Management: Add, edit, enable/disable SOCKS proxies via web UI
- Direct Fallback: Domains without proxy rules use direct connections
- Intuitive Web Interface: Easy-to-use tabbed interface with Dashboard, Services, SOCKS Proxies, Domains, Tools, Logs, and Settings
- Quick-Add from Logs: See unproxied domains and assign them to any service with a dropdown selector
- Bulk Import: Import multiple domains at once (newline, comma, or space separated)
- Import/Export Configuration: Export your entire configuration as JSON and import on other instances
- One-Click Domain Assignment: Add domains to a specific service directly from the overview
- Multiple DNS Servers: Pre-configured with SmartDNSProxy and NordVPN SmartDNS
- Persistent Storage: All settings persist across Docker rebuilds using volume storage
- Network-Wide: Other machines on your network can use this as their DNS server and SOCKS proxy
Docker provides easy deployment with persistent storage and automatic restart capabilities.
Prerequisites: Docker installed on your system
Installation:
- Build the Docker image:
docker build -t smartdns-proxy .- Run with persistent storage:
docker run -d \
--name smartdns \
--network host \
--cap-add=NET_BIND_SERVICE \
--restart always \
-v smartdns-data:/data \
smartdns-proxyThe application will start:
- DNS Proxy:
0.0.0.0:53(UDP - both IPv4 and IPv6) - DNS-over-TLS:
0.0.0.0:853(TCP - if certificates exist) - SOCKS5 Proxy:
0.0.0.0:1080(TCP) - Web Interface:
http://localhost:8080
Managing the container:
# View logs
docker logs smartdns
# Restart the container
docker restart smartdns
# Stop the container
docker stop smartdns
# Remove the container (data persists in volume)
docker rm smartdnsPersistent Storage: All settings, DNS servers, and domain rules are stored in the smartdns-data Docker volume. Your configuration survives container rebuilds and restarts.
If you prefer to run without Docker:
Prerequisites:
- Go 1.21 or higher
- Root/sudo access (DNS runs on port 53)
Installation:
- Clone and setup:
cd /home/smartdns
go mod download- Build the application:
go build -o smartdns-proxy- Run the proxy (requires sudo for port 53):
sudo ./smartdns-proxyThe application will start:
- DNS Proxy:
0.0.0.0:53(UDP) - DNS-over-TLS:
0.0.0.0:853(TCP - if certificates exist) - SOCKS5 Proxy:
0.0.0.0:1080(TCP) - Web Interface:
http://localhost:8080
# Test standard DNS lookup
dig @localhost google.com
# Test with nslookup
nslookup google.com localhost# Test with curl
curl -x socks5://localhost:1080 http://google.com
# Test with authentication (if configured)
curl -x socks5://username:password@localhost:1080 http://google.com
# Configure your browser to use SOCKS proxy
# Firefox: Settings → Network Settings → Manual proxy configuration
# Chrome: Use system proxy or extensions like FoxyProxyThe SOCKS proxy automatically uses your DNS rules! Any domain you visit via SOCKS will be resolved using the same DNS server configured in your rules.
-
Open the web interface: Navigate to
http://localhost:8080 -
Overview Tab - Your Dashboard:
- See total services and domain rules
- View all your SmartDNS services as beautiful cards
- Each card shows: service name, DNS servers, and domain count
- Click "+ Add Domains" on any service card to quickly assign domains
- Click "View Domains" to see all domains using that service
- Export/Import your entire configuration as JSON
-
Services Tab - Manage Your SmartDNS Services:
- Add a new service (e.g., "My Netflix Proxy")
- Enter primary and secondary DNS servers
- Delete or manage existing services
- See domain count for each service
-
SOCKS Proxies Tab - Manage SOCKS Proxy Servers:
- Add upstream SOCKS proxies (name, host, port)
- Configure authentication (username/password) if required
- Enable/disable proxies without deleting them
- Assign proxies to domains for automatic routing
- All SOCKS traffic uses your DNS rules automatically
-
Domains Tab - Manage Domain Rules:
- Add single domain: Enter
netflix.com, select DNS service - Optional: Select a SOCKS proxy for traffic routing
- Bulk import: Paste multiple domains, select service, click "Bulk Import"
- View all active domain rules with DNS service and SOCKS proxy info
- Delete rules as needed
- Add single domain: Enter
-
Tools Tab - Domain Discovery:
- Enter any website URL (e.g.,
https://www.hulu.com) - Select which SmartDNS service to test against
- Click "Discover Domains" to analyze the website
- The tool fetches the page and extracts all domains it uses
- Each domain is tested with both SmartDNS and default DNS
- Domains that resolve differently are marked as "Recommended"
- Select domains you want to add and click "Add Selected Domains"
- Use "Select All Recommended" to quickly configure a streaming service
- Enter any website URL (e.g.,
-
Logs Tab - Monitor DNS Requests:
- See last 200 DNS queries in real-time
- View client IP addresses with reverse DNS hostnames
- See which domains are proxied vs. using default DNS
- For unproxied domains, use the dropdown to select a service and add the rule instantly
- Logs auto-refresh every 10 seconds
-
Configure your network:
- DNS: Point your device's DNS to this server's IP address
- Router: Configure your router to use this as the primary DNS for all devices
- SOCKS Proxy: Configure your browser/apps to use
server-ip:1080as SOCKS5 proxy- This routes all traffic through the proxy while using your DNS rules automatically
The system comes with these DNS servers pre-configured:
- SmartDNSProxy 1: 35.178.60.174 (primary), 54.229.171.243 (secondary)
- SmartDNSProxy 2: 54.229.171.243 (primary), 35.178.60.174 (secondary)
- NordVPN SmartDNS: 103.86.96.103 (primary), 103.86.99.103 (secondary)
- Default (Cloudflare): 1.1.1.1 (primary), 8.8.8.8 (secondary)
- Default (Google): 8.8.8.8 (primary), 1.1.1.1 (secondary)
- Router: 192.168.1.1 (primary), 1.1.1.1 (secondary)
You can add/remove DNS servers through the web interface.
- DNS Query Received: Your device sends a DNS query to the proxy
- Rule Matching: The proxy checks if the domain matches any rules
- Exact match:
netflix.commatchesnetflix.com - Parent domain:
video.netflix.commatches rule fornetflix.com - Wildcard:
anything.example.commatches*.example.com
- Exact match:
- Route Query: Forward to the appropriate DNS server
- Return Result: Send the DNS response back to your device
- Log Request: Every query is logged with timestamp, server used, and proxy status
The web interface includes a powerful log viewer that tracks the last 200 DNS requests:
- Real-time monitoring: See all DNS queries as they happen
- Client tracking: View which devices are making requests with their IP addresses and resolved hostnames
- Proxy status: Instantly see which domains are using custom DNS vs. default DNS
- Quick-add with dropdown: For unproxied domains, select a SmartDNS service from the dropdown to add it instantly
- Auto-refresh: Logs update automatically every 10 seconds
- Response time: See how long each query took
- Query type: View A, AAAA, CNAME, and other DNS query types
- Find missing domains: Browse through your logs to see what domains you're accessing
- Quick setup: Watch Netflix/Hulu/etc., then check the logs and add all their domains by selecting a service from the dropdown
- Troubleshooting: Verify that your rules are working by checking if domains show "Proxied: Yes"
- Performance: Monitor response times to ensure your DNS servers are fast
- Device monitoring: See which devices on your network are making DNS requests
When running with Docker, all data is stored in the smartdns-data volume at /data/smartdns.db inside the container. This ensures your settings survive container rebuilds.
Backup your data:
docker run --rm -v smartdns-data:/data -v $(pwd):/backup alpine tar czf /backup/smartdns-backup.tar.gz /dataRestore from backup:
docker run --rm -v smartdns-data:/data -v $(pwd):/backup alpine tar xzf /backup/smartdns-backup.tar.gz -C /Inspect the volume:
docker volume inspect smartdns-dataRemove the volume (WARNING: deletes all data):
docker volume rm smartdns-dataDB_PATH: Set the database file path (default:/data/smartdns.db)
Example:
docker run -d \
--name smartdns \
--network host \
-e DB_PATH=/custom/path/smartdns.db \
-v smartdns-data:/custom/path \
smartdns-proxyEdit internal/proxy/proxy.go:21-22 to change the fallback DNS servers:
defaultServers: []string{"1.1.1.1:53", "8.8.8.8:53"},- DNS Port: Edit
main.go:41- default is:53 - Web Port: Edit
main.go:50- default is:8080
# System Preferences > Network > Advanced > DNS
# Add: <your-server-ip># Edit /etc/resolv.conf
sudo nano /etc/resolv.conf
# Add: nameserver <your-server-ip>Control Panel > Network and Internet > Network Connections
Right-click adapter > Properties > Internet Protocol Version 4
Use the following DNS server addresses: <your-server-ip>
Configure your router's DNS settings to point to this server. This will automatically configure all devices on your network.
The Docker deployment includes automatic restart with --restart always. The container will:
- ✅ Automatically restart on failure (if the container crashes)
- ✅ Start on system boot (even after server reboots)
- ✅ Restart even if manually stopped (until explicitly removed)
Check container status:
docker ps -a | grep smartdnsView logs:
docker logs -f smartdnsUpdate to latest version:
# Rebuild image
docker build -t smartdns-proxy .
# Stop and remove old container
docker stop smartdns
docker rm smartdns
# Start new container (data persists in volume)
docker run -d \
--name smartdns \
--network host \
--cap-add=NET_BIND_SERVICE \
--restart unless-stopped \
-v smartdns-data:/data \
smartdns-proxyFor native Go installations, create /etc/systemd/system/smartdns-proxy.service:
[Unit]
Description=SmartDNS Proxy
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/home/smartdns
ExecStart=/home/smartdns/smartdns-proxy
Restart=on-failure
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable smartdns-proxy
sudo systemctl start smartdns-proxy
sudo systemctl status smartdns-proxyCheck the logs for errors:
docker logs smartdnsVerify port 53 is not in use:
sudo lsof -i :53
# or
sudo netstat -tulpn | grep :53Ensure you're using the volume mount -v smartdns-data:/data when running the container. If you forgot the volume:
- Stop the container:
docker stop smartdns - Remove it:
docker rm smartdns - Start with volume: Use the run command from Quick Start
If another DNS service is running:
# Check what's using port 53
sudo lsof -i :53
# On Ubuntu/Debian, disable systemd-resolved
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolvedPort 53 requires root privileges. With Docker, use --cap-add=NET_BIND_SERVICE. For native installation:
sudo ./smartdns-proxyCheck the API server is running:
# Docker
docker logs smartdns | grep "Starting API"
# Native
curl http://localhost:8080/api/serversIf the domain discovery tool shows no results:
- Verify the URL is accessible from your server
- Check if the website blocks automated requests
- Try accessing the URL directly:
curl -L https://example.com - Some websites may require JavaScript - the tool only analyzes HTML
- Use the Domain Discovery Tool to automatically find all required domains
- Check the Logs tab to see which domains the site is using
- Add missing domains using the dropdown in the logs
- Clear your browser cache and try again
- Some sites (like Netflix) may require specific regional DNS servers
Route streaming services through SmartDNS to access region-restricted content:
Quick Setup with Domain Discovery:
- Go to the Tools tab
- Enter
https://www.hulu.com(or Netflix, Disney+, etc.) - Select your SmartDNS service
- Click "Discover Domains"
- Click "Select All Recommended"
- Click "Add Selected Domains"
- Done! All necessary domains are configured automatically
Manual Setup:
netflix.com -> SmartDNSProxy
hulu.com -> SmartDNSProxy
*.disneyplus.com -> SmartDNSProxy
Route specific domains through NordVPN:
*.bank.com -> NordVPN SmartDNS
*.private-site.com -> NordVPN SmartDNS
Route streaming services through SOCKS proxies while using SmartDNS:
Setup:
-
Add a SOCKS proxy in the SOCKS Proxies tab:
- Name: "Streaming Proxy"
- Host:
proxy.example.com - Port:
1080 - Username/Password: (if required)
-
Assign domains to use both DNS and SOCKS proxy:
- Domain:
netflix.com - DNS Service:
SmartDNSProxy - SOCKS Proxy:
Streaming Proxy
- Domain:
-
Configure your browser to use SOCKS proxy:
server-ip:1080
Result:
netflix.com→ DNS resolved via SmartDNSProxy → Traffic routed through Streaming Proxygoogle.com→ DNS resolved normally → Direct connection (no proxy)- All connections automatically follow DNS rules!
Route local development domains to your router:
*.local -> Router (192.168.1.1)
*.dev -> Router (192.168.1.1)
Setting up a streaming service from scratch:
-
Create the service (Services tab):
- Name: "Hulu US"
- Primary DNS: 35.178.60.174
- Secondary DNS: 54.229.171.243
-
Discover domains (Tools tab):
- URL: https://www.hulu.com
- Service: Hulu US
- Let the tool analyze and find all domains
-
Monitor and refine (Logs tab):
- Watch the logs while using Hulu
- Add any missing domains using the dropdown
-
Export your config (Overview tab):
- Click "Export Config" to save your setup
- Import on other SmartDNS instances
smartdns-proxy/
├── main.go # Application entry point
├── internal/
│ ├── api/
│ │ └── api.go # REST API server (DNS + SOCKS endpoints)
│ ├── db/
│ │ └── db.go # Database operations (DNS + SOCKS)
│ ├── logs/
│ │ └── logs.go # DNS request logging
│ ├── proxy/
│ │ └── proxy.go # DNS proxy logic
│ └── socks/
│ └── socks.go # SOCKS5 proxy server
├── web/
│ └── index.html # Web management interface
├── Dockerfile # Container build
├── generate-certs.sh # TLS certificate generation
├── go.mod # Go dependencies
└── README.md # This file
MIT License - Feel free to use and modify as needed.
Contributions welcome! Feel free to submit issues and pull requests.