A powerful bash utility for managing DNS settings on Linux systems. Features a two-step interactive menu (choose DNS β choose method), a dedicated System Management submenu with 11 granular operations, and real-time multi-source DNS status display.
- π Multiple DNS Providers: Iranian (Shekan, Arvan) & International (Google, Cloudflare, Quad9, OpenDNS, AdGuard)
- π§ Custom DNS: Enter your own DNS IPs with IPv4 validation
- π Two-Step Flow: Choose DNS provider β Choose apply method (NetPlan or resolv.conf)
- βοΈ System Management Submenu: 11 operations β view, edit, disable, delete, rollback for both NetPlan and resolv.conf, plus full reset
- π Multi-Source Status: Shows NetPlan config, resolv.conf, and resolvectl status simultaneously with provider identification
- π§ͺ Connectivity Test: Verifies DNS is working after applying (
nslookup/dig) - πΎ Automatic Backup: Saves original settings before changes
- β©οΈ Rollback & Disable: Non-destructive disable (keeps file) or full rollback from backup
- π¨ Modern UI: Clean, color-coded terminal interface with status indicators
- Linux: Ubuntu 17.10+ or any system with NetPlan (optional) or systemd-resolved
- Privileges: Root/sudo access required
- Shell: Bash
- Utilities:
ip,grep,awk,sed(pre-installed on most systems)
git clone https://github.com/USFAkbari/Set_Shekan_DNS.git
cd Set_Shekan_DNS
sudo cp dnsManager /usr/local/bin/dnsManager
sudo chmod +x /usr/local/bin/dnsManagerRun from anywhere:
sudo dnsManagersudo curl -sSL https://raw.githubusercontent.com/USFAkbari/Set_Shekan_DNS/main/dnsManager -o /usr/local/bin/dnsManager && sudo chmod +x /usr/local/bin/dnsManagergit clone https://github.com/USFAkbari/Set_Shekan_DNS.git
cd Set_Shekan_DNS
sudo ./dnsManagerStep 1: Select DNS Provider (1-8) or Custom DNS (C)
β
Step 2: Choose Apply Method
βββ 1) NetPlan β /etc/netplan/99-dns-manager.yaml
βββ 2) resolv.conf β /etc/systemd/resolved.conf
β
Step 3: Apply β Test Connectivity β Show Result β Exit
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π DNS Manager v2.0.0 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββ Current DNS Status βββββββββββββββββββββββββββββββββββββββββ
β Interface: eth0 β
β β
β NetPlan (/etc/netplan/99-dns-manager.yaml): β
β DNS: 1.1.1.1, 1.0.0.1 (Cloudflare) β
β β
β resolv.conf (/etc/resolv.conf): β
β nameserver 127.0.0.53 (systemd-stub) β
β β
β Resolvectl Status: β
β 1.1.1.1 (Cloudflare) β
β β
β systemd-resolved: β Active β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ Iranian DNS ββββββββββββ ββ International DNS βββββββββββ
1) Shekan Pro 5) Cloudflare
2) Shekan Free 6) Quad9 (Malware Block)
3) Arvan Cloud 7) OpenDNS
4) Google DNS 8) AdGuard (Ad Block)
C) Custom DNS (enter your own)
ββ System Management ββββββββββββββββββββββββββββββββββββββββββ
S) System Management (view, edit, disable, delete, rollback)
0) Exit
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β System Management β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ NetPlan (/etc/netplan/99-dns-manager.yaml) [β active]
1) View β Show current NetPlan DNS config
2) Edit β Modify DNS addresses in NetPlan
3) Disable β Suspend config without deleting
4) Delete β Remove NetPlan config permanently
5) Rollback β Re-enable disabled config
ββ resolv.conf / systemd-resolved [β custom DNS set]
6) View β Show resolved.conf & resolv.conf
7) Edit β Modify DNS in resolved.conf
8) Disable β Remove custom DNS, use DHCP defaults
9) Delete β Remove custom DNS entries & backup
10) Rollback β Restore resolved.conf from backup
ββ Full System ββββββββββββββββββββββββββββββββββββββββββββββββ
11) Reset All β Remove ALL DNS Manager configurations
0) β Back to main menu
| Provider | Primary | Secondary | Notes |
|---|---|---|---|
| Shekan Pro | 178.22.122.101 |
185.51.200.1 |
Premium anti-censorship |
| Shekan Free | 178.22.122.100 |
185.51.200.2 |
Free tier |
| Arvan Cloud | 217.218.127.127 |
217.218.155.155 |
Iranian CDN provider |
| Provider | Primary | Secondary | Features |
|---|---|---|---|
8.8.8.8 |
8.8.4.4 |
Fast, reliable | |
| Cloudflare | 1.1.1.1 |
1.0.0.1 |
Privacy-focused, fastest |
| Quad9 | 9.9.9.9 |
149.112.112.112 |
Malware blocking |
| OpenDNS | 208.67.222.222 |
208.67.220.220 |
Family filter options |
| AdGuard | 94.140.14.14 |
94.140.15.15 |
Ad & tracker blocking |
- Detects active network interface (e.g.,
eth0) - Creates config at
/etc/netplan/99-dns-manager.yaml - Validates with
netplan generate, applies withnetplan apply - Overrides DHCP DNS settings
Note: Wi-Fi interfaces automatically fall back to systemd-resolved due to NetPlan limitations.
- Backs up
/etc/systemd/resolved.conf - Modifies DNS and FallbackDNS settings
- Restarts systemd-resolved service
| # | Target | Operation | Description |
|---|---|---|---|
| 1 | NetPlan | View | Display YAML config file and parsed DNS addresses |
| 2 | NetPlan | Edit | Enter new DNS IPs β rewrite config β validate β apply |
| 3 | NetPlan | Disable | Rename to .disabled (preserves config, stops applying) |
| 4 | NetPlan | Delete | Permanently remove config file (requires confirmation) |
| 5 | NetPlan | Rollback | Re-enable a previously disabled config |
| 6 | Resolved | View | Show resolved.conf, resolv.conf, resolvectl, backup status |
| 7 | Resolved | Edit | Enter new DNS IPs β update resolved.conf β restart |
| 8 | Resolved | Disable | Remove custom DNS entries β revert to DHCP defaults |
| 9 | Resolved | Delete | Remove custom entries + delete backup (requires confirmation) |
| 10 | Resolved | Rollback | Restore resolved.conf from backup file |
| 11 | Both | Reset All | Remove all DNS Manager configs and restore system defaults |
sudo dnsManagerresolvectl status
cat /etc/netplan/99-dns-manager.yaml
cat /etc/resolv.confNetPlan:
sudo rm /etc/netplan/99-dns-manager.yaml
sudo netplan applysystemd-resolved:
sudo cp /etc/systemd/resolved.conf.backup /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolvedThis script is provided as-is for free use.
Contributions, issues, and feature requests are welcome!
Use this script at your own risk. Always ensure you have backups of important system configurations before making changes.