User Tools

Site Tools


linux:network:networkmanager-dns-config

NetworkManager DNS Configuration

Configure NetworkManager DNS settings to use reliable DNS servers (Google DNS + local router) while preventing automatic DHCP overwrites.
This ensures stable DNS resolution for both general networking and Docker operations.

Main Commands

sudo nmcli con mod p8p1 ipv4.dns "8.8.8.8 8.8.4.4 192.168.1.1"
sudo nmcli con mod p8p1 ipv4.ignore-auto-dns yes
sudo nmcli con up p8p1

Explanations

First command sets DNS servers in preferred order:

  • 8.8.8.8 - Google primary DNS (fast and stable)
  • 8.8.4.4 - Google secondary DNS (backup)
  • 192.168.1.1 - Local router DNS (fallback)

Second command prevents DHCP DNS overwriting:

  • ipv4.ignore-auto-dns yes - ignores automatically received DNS
  • Maintains complete control over DNS configuration
  • Prevents unwanted interference

Third command activates new settings:

  • Applies changes to network interface
  • Reloads NetworkManager configuration
  • Updates /etc/resolv.conf

Verification

To verify configuration:

nmcli con show p8p1 | grep dns
cat /etc/resolv.conf
  • Replace p8p1 with your network interface name
  • You can see available interfaces with nmcli con show
  • Configuration persists after reboot
  • Helps resolve Docker image pull issues and DNS resolution problems.
linux/network/networkmanager-dns-config.txt · Last modified: 2025/01/03 21:21 by odefta