3 releases
| 0.1.3 | Jul 22, 2025 |
|---|---|
| 0.1.1 | Jul 20, 2025 |
| 0.1.0 | Jul 20, 2025 |
#1416 in Network programming
85 downloads per month
15KB
301 lines
switchdns
A terminal-based tool to easily switch your system DNS servers on Linux.
Features
- 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
Installation
You need Rust installed.
Install from crates.io:
cargo install switchdns
Or build manually from source:
cargo build --release
The binary will be at target/release/switchdns.
Usage
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
Custom DNS Providers
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
How it works
- Modifies
/etc/resolv.confto set the selected DNS servers - Reads current DNS from
/etc/resolv.conf - Uses ratatui and crossterm for the terminal UI
License
MIT
© 2025 Mahyar Riazati
Dependencies
~7–20MB
~237K SLoC