A terminal-based tool to easily switch your system DNS servers on Linux.
- Interactive terminal UI for selecting DNS providers
- Built-in list of popular DNS providers (Cloudflare, Google, Quad9, OpenDNS, CleanBrowsing, Shecan, Electro, Begzar)
- Option to reset to automatic/ISP DNS
- Add your own custom DNS providers via a config file
- Displays current DNS settings
- Automatically requests root privileges if needed
You need Rust installed.
Install from crates.io:
cargo install switchdnsOr build manually from source:
cargo build --releaseThe binary will be at target/release/switchdns.
Run the tool:
switchdns- If not run as root, the tool will automatically prompt for root privileges.
- Use the arrow keys to navigate the DNS provider list
- Press
Enterto select and apply a DNS provider - Press
rto reset to automatic/ISP DNS - Press
qto quit
You can add your own DNS providers by creating a file named .switchdns in your home directory. Each line should be in the format:
Provider Name | 1.2.3.4 | 5.6.7.8
Example:
MyDNS | 123.45.67.89 | 98.76.54.32
- Modifies
/etc/resolv.confto set the selected DNS servers - Reads current DNS from
/etc/resolv.conf - Uses ratatui and crossterm for the terminal UI
MIT
© 2025 Mahyar Riazati