Skip to content

Instantly share code, notes, and snippets.

@frafra
Created February 18, 2015 10:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frafra/ec9e7954c458e5c600b1 to your computer and use it in GitHub Desktop.
Save frafra/ec9e7954c458e5c600b1 to your computer and use it in GitHub Desktop.
Remove manual DNS entries from active connections using nmcli
#!/bin/bash
for id in $(nmcli -t -f UUID c s -a)
do
dnss=$(nmcli -t -f ipv4.dns c s $id | cut -d: -f2- | tr -d ,)
for dns in $dnss
do
nmcli c m $id -ipv4.dns 0
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment