Skip to content

Instantly share code, notes, and snippets.

@fnordfish
Created January 15, 2016 12:59
Show Gist options
  • Select an option

  • Save fnordfish/52b79f8c3729bec13b70 to your computer and use it in GitHub Desktop.

Select an option

Save fnordfish/52b79f8c3729bec13b70 to your computer and use it in GitHub Desktop.
#!/bin/bash
add_dns_config() {
local interface=$1; shift
sudo networksetup -setdnsservers "${interface}" $@
}
main() {
local servers=
servers=()
local line=
while read line; do
local s=
s=$(echo $line | cut -d" " -f 1)
servers+=($s)
done
for i in 'Wi-Fi' 'Thunderbolt Ethernet'; do
add_dns_config $i ${servers[@]}
done
}
main <<EOF
2a01:4f8:161:4109::6 ns25.de.dns.opennic.glue
2a02:e00:fffd:139::9 ns3.nw.de.dns.opennic.glue
2620:0:ccc::2 OpenDNS
2620:0:ccd::2 OpenDNS
5.9.49.12 ns24.de.dns.opennic.glue
130.255.73.90 ns3.nw.de.dns.opennic.glue
85.214.20.141 digitalcourage.de
194.150.168.168 CCC
213.73.91.35 CCC
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment