switchdns

Crates.ioswitchdns
lib.rsswitchdns
version0.1.3
created_at2025-07-20 09:50:02.969565+00
updated_at2025-07-22 14:14:36.605195+00
descriptionA CLI tool to switch DNS settings easily.
homepage
repositoryhttps://github.com/mhyrzt/switchdns
max_upload_size
id1760960
size39,604
Mahyar (mhyrzt)

documentation

README

switchdns

A terminal-based tool to easily switch your system DNS servers on Linux.

asciicast

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 Enter to select and apply a DNS provider
  • Press r to reset to automatic/ISP DNS
  • Press q to 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.conf to 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

Commit count: 0

cargo fmt