This shell script enables setting DNS servers for WiFi (WLAN interface) on MacOS devices. It provides options for both Iranian and global DNS servers.
- Shecan
- Electro
- Radar Game
- DNS Pro
- Begzar
- 403.online
- Server.ir
- Host Iran
- Shatel
- Asia Tech
- Pars Online
- Pishgaman
- Resaneh Pardaz
- Cloudflare
- Open DNS
- Pihole
- UncensoredDNS
- CZ_NIC
- Level 3
- Comodo Secure
- Control D
- Alternate
- Verisign
- Open Nic
- Yandex
- DNS Watch
- Oracle Dyn
- Freenom World
- Flash Start
- Quad9
- Some DNS
- Neustar DNS
- Sprintlink
- NTT
- CleanBrowsing
- AdGuard
- Norton ConnectSafe
- SafeDNS
- SmartViper
- UncensoredDNS
- puntCAT
- CNNIC SDNS
- AliDNS
- DNSPod
- OneDNS
- GreenTeamDNS
- OpenNIC
- FreeDNS
- Hurricane Electric
- Baidu
- 114DNS
You can easily download and execute the dns.sh
script from the GitHub repository using either curl
or wget
.
curl -O https://raw.githubusercontent.com/Amirali-Bagheri/mac-dns-changer/main/dns.sh && chmod +x dns.sh && ./dns.sh
curl -O https://raw.githubusercontent.com/Amirali-Bagheri/mac-dns-changer/main/dns.sh
: Downloads thedns.sh
script from the specified URL and saves it with the same name in the current directory.chmod +x dns.sh
: Changes the permissions of the downloaded script to make it executable../dns.sh
: Executes the downloaded script.
wget https://raw.githubusercontent.com/Amirali-Bagheri/mac-dns-changer/main/dns.sh && chmod +x dns.sh && ./dns.sh
wget https://raw.githubusercontent.com/Amirali-Bagheri/mac-dns-changer/main/dns.sh
: Downloads thedns.sh
script from the specified URL.chmod +x dns.sh
: Changes the permissions of the downloaded script to make it executable../dns.sh
: Executes the downloaded script.
Note: Make sure to review the script content and its purpose before executing it on your system.
You can directly run the script with an option. For example, to automatically find the best DNS server for 403 Unlock, use:
sudo sh ./dns.sh 1
To automate the DNS changes and find the best server every hour, you can set up a cron job. Here's how you can do it:
- Open your crontab file for editing:
sudo crontab -e
- Add the following line to schedule the dns.sh script to run every hour:
0 * * * * /path/to/dns.sh 1
Replace /path/to/dns.sh with the actual path to your dns.sh script.
This cron job will run the script at the beginning of every hour, automatically finding and setting the best DNS server.
Tested on Mac OS 13+ running on Macbook Pro and iMac.