Last active
January 4, 2018 05:45
-
-
Save kometchtech/b54c7158688a39806f6c3a39d56b2b47 to your computer and use it in GitHub Desktop.
Public DNS Server List (to resolv.conf type)
This file contains 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
#!/usr/bin/env bash | |
# Public DNS Server List | |
# https://public-dns.info/ | |
URL="https://public-dns.info/" | |
ALL="nameservers.txt" | |
COUNTRY="jp" | |
DEST="/etc/coredns" | |
# ALL | |
/usr/bin/curl -Ss -L ${URL}${ALL} -o ${DEST}/${ALL} | |
/bin/cp ${DEST}/${ALL} ${DEST}/nameservers.conf | |
/bin/sed -e "s/^/nameserver /g" -i ${DEST}/nameservers.conf | |
# selective | |
for i in ${COUNTRY}; do | |
/usr/bin/curl -Ss -L ${URL}nameserver/${i}.txt -o ${DEST}/"nameservers_${i}.txt" | |
/bin/cp ${DEST}/nameservers_${i}.txt ${DEST}/nameservers_${i}.conf | |
/bin/sed -e "s/^/nameserver /g" -i ${DEST}/nameservers_${i}.conf | |
done | |
# coreDNS process reload | |
/usr/bin/pkill -10 coredns |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment