Skip to content

Instantly share code, notes, and snippets.

@hamidb80
Last active April 19, 2024 10:45
Show Gist options
  • Save hamidb80/c353243822de38680e40da40c9d43956 to your computer and use it in GitHub Desktop.
Save hamidb80/c353243822de38680e40da40c9d43956 to your computer and use it in GitHub Desktop.
change the DNS setting of your linux system
#!/bin/sh
LOC="/etc/resolvconf/resolv.conf.d/head"
if [[ $1 = "remove" ]]; then
echo "nameserver 1.1.1.1" | sudo tee $LOC
elif [[ $1 = "begzar" ]]; then # begzar.ir
echo "nameserver 185.55.226.26" | sudo tee $LOC
echo "nameserver 185.55.225.25" | sudo tee -a $LOC
elif [[ $1 = "shecan" ]]; then # shecan.ir
echo "nameserver 178.22.122.100" | sudo tee $LOC
echo "nameserver 185.51.200.2" | sudo tee -a $LOC
else
echo "options: remove, begzar, shecan"
exit
fi
sudo resolvconf -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment