A simple bash script to change dns easily
This is a very simple bash script that help easily changing between multiple dns.
This is kind of a hack to change dns and there are correct and better ways to change dns, but this would do the job easily.
You can add the dns you want to change between in the config file
google 8.8.8.8 8.8.1.1
cloudflare 1.1.1.1
# There should be a line break at the end of file
# and do not add any comments or other things in
# this file!
To use this script the easiest way is to put the folder in home/user/bin
then make the script executable with sudo chmod +x ~/bin/easy-dns/edns
then symblink it to /usr/bin folder like this sudo ln -s ~/bin/easy-dns/edns /usr/bin/edns
There are three easy commands to use:
- edns ls:
- that shows all provided names in config file, and you can select one with the provided number
- edns change [dnsname]:
- change directly to provided dns name
- edns show:
- which show the system's alread set dns nameservers