how to config dns in NetworkManager

tags: learning networking linux

content

  • in /etc/resolv.conf it says # Generated by NetworkManager
  • that means, manually changing /etc/resolv.conf will be pointless, it will get overwritten by NetworkManager

per connection config

to see NetworkManager’s config on this:

  • nmcli device shows all devices
  • nmcli connection show shows all connections
  • nmcli connection show $CONNECTION_NAME to show details of a connection
  • | grep dns to see dns info, it matches what it shows resolv.conf

to modify:

nmcli connection modify <connection-name> ipv4.dns "8.8.8.8 1.1.1.1"
nmcli connection modify <connection-name> ipv4.ignore-auto-dns yes
nmcli connection up <connection-name>

global config

up

down

reference