A DNS server implementation written in Rust with caching.
Constellation DNS is a DNS server built in Rust that provides basic DNS resolution with caching capabilities. It supports both UDP and TCP protocols and includes configuration management for zone files and server settings.
- Basic Protocol Support: Full DNS over UDP and TCP support
- TLS/DNS-over-TLS Support - RFC 7858
- DNSSEC Support - RFC 4035
- Monitoring: Comprehensive metrics and logging
- Configuration: Flexible TOML-based configuration system
- Zone Management: Dynamic zone loading and management through BIND9 zone files and SQLite
- Query Forwarding: Support for forwarding queries to other DNS servers RFC 1035 Section 7
- Linux system with systemd
- Rust 1.70+ (for building from source)
- Build from source:
git clone https://github.com/your-org/constellation-dns.git
cd constellation-dns
cargo build --release- Install system-wide:
sudo cp target/release/constellation-dns /usr/local/bin/
sudo chmod +x /usr/local/bin/constellation-dns- Set up configuration:
sudo mkdir -p /etc/constellation-dns/zones
sudo mkdir -p /var/lib/constellation-dns
sudo cp config.toml.example /etc/constellation-dns/config.toml- Install as systemd service:
sudo cp constellation-dns.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable constellation-dns
sudo systemctl start constellation-dnsStart the server with default configuration:
constellation-dns startStart with custom configuration file:
constellation-dns start --config /path/to/config.tomlConstellation DNS uses TOML for configuration. Copy config.toml.example to get started:
[server]
listen = "0.0.0.0"
port = 53
tcp_enabled = true
udp_enabled = true
[cache]
max_entries = 10000
default_ttl = 300
[dnssec]
enabled = true
validate_responses = true
[zone]
zone_directory = "/etc/constellation-dns/zones"
reload_interval = 300
[metrics]
enabled = true
bind_address = "127.0.0.1:9153"Zone files should be placed in the configured zone directory (default: /etc/constellation-dns/zones/). The server supports standard DNS zone file format.
Example zone file (example.com.zone):
$ORIGIN example.com.
$TTL 3600
@ IN SOA ns1.example.com. admin.example.com. (
2023010101 ; Serial
3600 ; Refresh
1800 ; Retry
1209600 ; Expire
86400 ; Minimum TTL
)
@ IN NS ns1.example.com.
@ IN NS ns2.example.com.
@ IN A 192.0.2.1
www IN A 192.0.2.2
# Debug build
cargo build
# Release build
cargo build --release
# Run tests
cargo test
# Check code formatting
cargo fmt --check
# Run linter
cargo clippysrc/
├── main.rs # Application entry point
├── config/ # Configuration management
├── packet/ # DNS packet parsing and construction
├── proto/ # DNS protocol implementation
├── cache/ # Caching subsystem
├── zone/ # Zone file management
├── db/ # Database operations
└── types.rs # Common type definitions
This project is licensed under the MIT License - see the LICENSE file for details.