This script allows you to easily switch between different DNS providers on your system. The script is interactive and allows you to choose from a list of DNS options using a simple menu interface.
- Switch DNS settings to popular providers including Shecan, Electro, Begzar, Google, 403, CloudFlare, and Radar.
- Restore the default DNS setting.
- Easy-to-use menu interface for selecting the desired DNS.
- Real-time update of
/etc/resolv.conf
to apply the chosen DNS settings. - Displays the current DNS configuration by name.
-
Clone the Repository:
git clone https://github.com/Mr-Meshky/dns-switcher.git cd dns-switcher
-
Install the Script:
chmod +x install.sh ./install.sh
-
Run the Script:
change-dns
Note: Running the script with
sudo
is necessary to modify/etc/resolv.conf
.
The script provides the following DNS options:
- Shecan
- Electro
- Begzar
- 403
- CloudFlare
- Radar
- Default
Navigate through the menu using the arrow keys and press Enter to select the desired DNS.
Upon running the script, you will see a menu like this:
Current DNS Configuration: Google
Which DNS do you want to use?
Shecan
Electro
Begzar
Google
-> 403
CloudFlare
Radar
Default
Use the arrow keys to navigate through the options. The selected option will be highlighted in blue. Press Enter
to set the DNS.
- DNS Addresses: Defined at the beginning of the script.
- Options Array: Contains the names of the DNS providers.
- DNS Lists: Two lists (
dns1_list
anddns2_list
) hold the primary and secondary DNS addresses.
- print_menu: Displays the interactive menu and highlights the selected option.
- Main Loop: Handles user input for navigating the menu and selecting an option.
- Set DNS: Updates
/etc/resolv.conf
with the chosen DNS settings.
To update the repository, use the provided update.sh
script. The script checks if the current directory is a Git repository, and if so, it pulls the latest changes. If not, it checks for the existence of the dns-switcher
directory, navigates into it if it exists, and pulls the latest changes. If the directory does not exist, it clones the repository.
-
Make the Script Executable:
chmod +x update.sh
-
Run the Script:
./update.sh
Feel free to submit issues and pull requests for new features or improvements. Your contributions are welcome!
Developed by MrMeshky with love.