Skip to content

Instantly share code, notes, and snippets.

@mykola2312
Created June 9, 2024 07:56
Show Gist options
  • Save mykola2312/07169ad9c85598800b1d316fcfb4b16b to your computer and use it in GitHub Desktop.
Save mykola2312/07169ad9c85598800b1d316fcfb4b16b to your computer and use it in GitHub Desktop.
Make NetworkManager use proper DNS
#!/bin/sh
dns="1.1.1.1 8.8.8.8 8.8.4.4"
active_network=$(nmcli con show --active | awk 'NR==2 {print $2}')
nmcli connection modify uuid $active_network ipv4.ignore-auto-dns yes
nmcli connection modify uuid $active_network ipv4.dns "$dns"
echo "DNS fixed for ${active_network}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment