-
-
Save awsvpc/91f3478c56df4d3c9a22d88d2487e347 to your computer and use it in GitHub Desktop.
set all wifi connections to use cloudflare dns
This file contains hidden or 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
( | |
IFS=$'\n' | |
for line in $(nmcli --fields UUID,TYPE,NAME connection show); do | |
conn_uuid=$(echo ${line} | cut -d ' ' -f 1) | |
conn_type=$(echo ${line} | cut -d ' ' -f 3) | |
conn_name=$(echo ${line} | cut -d ' ' -f 4- | xargs) | |
if [ "${conn_type}" = "wifi" ]; then | |
echo "name: $(tput bold)${conn_name}" | |
echo "$(tput dim)uuid: ${conn_uuid}, type: ${conn_type}" | |
nmcli connection modify ${conn_uuid} ipv4.dns "1.1.1.1,1.0.0.1" | |
nmcli connection modify ${conn_uuid} ipv4.ignore-auto-dns yes | |
nmcli connection modify ${conn_uuid} ipv6.dns "2606:4700:4700::1111,2606:4700:4700::1001" | |
nmcli connection modify ${conn_uuid} ipv6.ignore-auto-dns yes | |
nmcli connection show ${conn_uuid} | grep dns --color=never | |
echo "$(tput sgr0)" | |
fi | |
done | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment