Last active
April 7, 2025 15:31
-
-
Save NedaMani/0d0670998791063f0e819295d5468931 to your computer and use it in GitHub Desktop.
a fast way for dns change(based on systemd) - Especially for Iranians
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dns1=(78.157.42.100 78.157.42.101) | |
dns2=(178.22.122.100 185.51.200.2) | |
dns3=(172.29.2.100 172.29.0.100) | |
dns4=(185.55.226.26 185.55.225.25) | |
echo "0) Reset to default" | |
echo "1) Electro" | |
echo "2) Shecan" | |
echo "3) Hostiran" | |
echo "4) Begzar" | |
echo "5) Exit" | |
read -p "What is your choice? " choice | |
case $choice in | |
0) | |
resolvectl revert wlan0 # change wlan0 to your device | |
resolvectl flush-caches | |
echo "DNS settings reset to default." | |
exit 0 | |
;; | |
1) | |
selected_dns=("${dns1[@]}") | |
;; | |
2) | |
selected_dns=("${dns2[@]}") | |
;; | |
3) | |
selected_dns=("${dns3[@]}") | |
;; | |
4) | |
selected_dns=("${dns4[@]}") | |
;; | |
5) | |
echo "See you later :)" | |
exit 0 | |
;; | |
*) | |
echo "Not Found! :|" | |
exit 1 | |
;; | |
esac | |
resolvectl flush-caches | |
resolvectl dns wlan0 "${selected_dns[@]}" # change wlan0 to your device | |
resolvectl status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment