Multi-Protocol DNS Configuration
CodexDNS supports multiple DNS protocols simultaneously, allowing clients to query your DNS server using different transport methods.
Supported Protocols
UDP (User Datagram Protocol)
- Port: 53 (default), configurable
- Description: Traditional DNS protocol, fast but connectionless
- Use Case: Standard DNS queries from most clients
- Configuration:
- Enable via web UI: Server Settings → DNS tab → UDP section
- Or via database:
dns_settingstable,udp_enabled: true
- Client Example:
dig @your-server.com example.com nslookup example.com your-server.com
TCP (Transmission Control Protocol)
- Port: 53 (default), configurable
- Description: Connection-based DNS protocol, reliable but higher overhead
- Use Case: Large DNS responses (> 512 bytes), zone transfers
- Configuration:
- Enable via web UI: Server Settings → DNS tab → TCP section
- Or via database:
dns_settingstable,tcp_enabled: true
- Client Example:
dig +tcp @your-server.com example.com
DoT (DNS over TLS)
- Port: 853 (standard), configurable
- Description: DNS queries encrypted with TLS
- Use Case: Privacy-focused clients, enterprise networks
- Requirements:
- Valid TLS certificate (self-signed, custom, or Let’s Encrypt)
- Configure certificate in Server Settings → TLS tab
- Configuration:
- Enable via web UI: Server Settings → DNS tab → DoT section
- Requires TLS settings configured first
- Client Example:
# Using kdig (Knot DNS utilities) kdig +tls @your-server.com example.com # Using stubby stubby -g -s your-server.com@853#example.com
DoH (DNS over HTTPS)
- Port: 443 (standard), configurable
- Path:
/dns-query(default), configurable - Description: DNS queries over HTTPS protocol
- Use Case: Web browsers (Firefox, Chrome), privacy-focused clients
- Requirements:
- Valid TLS certificate
- HTTPS web server enabled
- Configuration:
- Enable via web UI: Server Settings → DNS tab → DoH section
- Configure path (default:
/dns-query) - HTTP/3 support optional (requires additional setup)
- Client Example:
# Using curl curl -H 'accept: application/dns-json' \ 'https://your-server.com/dns-query?name=example.com&type=A' # Firefox configuration about:config → network.trr.uri = https://your-server.com/dns-query # Chrome configuration chrome://settings → Privacy and security → Use secure DNS → With: https://your-server.com/dns-query
DoQ (DNS over QUIC)
- Port: 853 (standard), configurable
- Description: DNS queries over QUIC protocol (UDP-based, HTTP/3)
- Use Case: Modern clients requiring low latency and multiplexing
- Requirements:
- Valid TLS certificate
- QUIC protocol support
- Configuration:
- Enable via web UI: Server Settings → DNS tab → DoQ section
- Requires TLS settings configured first
- Client Example:
# Using q (DoQ client) q example.com @quic://your-server.com
Multi-Protocol Setup
Recommended Configuration
For maximum compatibility and security, enable all protocols:
- UDP + TCP (ports 53): Legacy and standard clients
- DoT (port 853): Privacy-focused desktop clients
- DoH (port 443): Web browsers and mobile apps
- DoQ (port 853): Modern, low-latency clients
Firewall Rules
Ensure your firewall allows inbound traffic on:
- UDP/TCP port 53 (UDP and TCP protocols)
- TCP port 853 (DoT)
- TCP port 443 (DoH, HTTPS web UI)
- UDP port 853 (DoQ)
Example iptables rules:
# UDP DNS
iptables -A INPUT -p udp --dport 53 -j ACCEPT
# TCP DNS
iptables -A INPUT -p tcp --dport 53 -j ACCEPT
# DoT
iptables -A INPUT -p tcp --dport 853 -j ACCEPT
# DoH (HTTPS)
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# DoQ
iptables -A INPUT -p udp --dport 853 -j ACCEPT
Performance Considerations
- UDP: Fastest, lowest overhead, no connection state
- TCP: Slower than UDP, connection overhead, reliable delivery
- DoT: TLS handshake overhead, encrypted, slightly slower than TCP
- DoH: HTTPS overhead (headers), multiplexing benefits, encrypted
- DoQ: Low latency, connection migration, encrypted, best for modern clients
Client Compatibility
| Protocol | Windows | Linux | macOS | iOS | Android | Browsers |
|---|---|---|---|---|---|---|
| UDP | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| TCP | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| DoT | ✅* | ✅ | ✅ | ✅ | ✅ | ❌ |
| DoH | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| DoQ | ❌ | ✅* | ❌ | ❌ | ❌ | ❌ |
*Requires third-party client software
Runtime Configuration
All DNS protocol settings are configurable at runtime via:
- Web UI:
/admin/server-settings→ DNS tab - API:
POST /api/settings/server/dns
Changes take effect after DNS server restart (available in Web UI or API).
Monitoring
Protocol status is visible on the dashboard:
- Green badge: Protocol running
- Red badge: Protocol stopped (enabled but server not running)
- Gray badge: Protocol disabled
- Real-time SSE updates every 2 seconds
Troubleshooting
DoT/DoH/DoQ Not Starting
Problem: Encrypted protocols show “stopped” status despite being enabled.
Solution:
- Verify TLS certificate is configured: Server Settings → TLS tab
- Check certificate paths exist and are readable
- Ensure certificate is valid (not expired)
- Check logs:
/logs/dns.logfor specific errors
Certificate Errors
Problem: Clients report certificate validation errors.
Solution:
- Use Let’s Encrypt for publicly trusted certificates
- For self-signed certificates, clients must trust the CA
- Ensure certificate CN or SAN matches server hostname
- Check certificate expiry: Dashboard → Web Server & TLS card
Port Conflicts
Problem: Protocol fails to start due to port already in use.
Solution:
- Change the port in Server Settings → DNS tab
- Verify no other service is using the port:
lsof -i :PORT(Linux) - For ports < 1024, ensure CodexDNS runs as root or has CAP_NET_BIND_SERVICE
Performance Issues
Problem: DoH queries are slow.
Solution:
- Enable HTTP/3: Server Settings → DNS tab → DoH → Enable HTTP/3
- Increase connection limits in web server settings
- Consider using DoT or DoQ for lower overhead
- Check upstream server performance: Dashboard → Upstream Servers
Security Best Practices
- Use encrypted protocols (DoT/DoH/DoQ) for public-facing servers
- Enable HTTPS redirect to prevent downgrade attacks
- Use Let’s Encrypt for automatic certificate renewal
- Monitor certificate expiry (dashboard shows warnings at < 30 days)
- Restrict UDP/TCP to internal networks if possible
- Enable HSTS for web interface security
- Use strong TLS cipher suites (configured automatically)