16

I know how to change the DNS of my network from GUI Network Manager:

  1. Right click on the network manager icon in the panel and choose "Edit connections..."
  2. Select your connection from the wired or wireless tab, choose "Edit"
  3. Choose IPv4 settings tab
  4. Switch method to "Automatic (DHCP) addresses only"
  5. Enter the DNS you want in the box "Additional DNS servers" and press "Apply"

How do I do exactly the same thing from Terminal?

Pablo Bianchi
  • 15,657
user246185
  • 1,047
  • 4
  • 10
  • 14

1 Answers1

22

nmcli connection show --active to obtain active connection name
nmcli connection edit double tab to list available connections and chose appropriate

   nmcli> remove ipv4.dns  
   nmcli> set ipv4.ignore-auto-dns yes
   nmcli> set ipv4.dns 8.8.8.8 8.8.4.4 (or other dns servers)      
   nmcli> save
   nmcli> quit 

nmcli connection down your_connection_name
nmcli connection up your_connection_name

EdiD
  • 4,457
  • 3
  • 26
  • 41