Skip to content

Instantly share code, notes, and snippets.

@kometchtech
Last active January 4, 2018 05:45
Show Gist options
  • Save kometchtech/b54c7158688a39806f6c3a39d56b2b47 to your computer and use it in GitHub Desktop.
Save kometchtech/b54c7158688a39806f6c3a39d56b2b47 to your computer and use it in GitHub Desktop.
Public DNS Server List (to resolv.conf type)
#!/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