1

Here is my setup :

 network:
 version: 2
 renderer: NetworkManager
 #renderer: networkd
 ethernets:
  enp2s0:
   dhcp4: yes
   addresses: []
   nameservers:
           addresses: [1.1.1.1, 1.0.0.1]
  enx28ee52061e61:
   dhcp4: yes
   addresses: []

systemd-resolve --status | grep 'DNS Servers' -A2

DNS Servers: 192.168.1.1
                  1.1.1.1
                  1.0.0.1

So every domain is resolved from 192.168.1.1 (router-gateway IP).

How can i remove it and all domains resolved from "1.1.1.1"?

cat /etc/resolv.conf

nameserver 192.168.1.1
nameserver 1.1.1.1
nameserver 1.0.0.1
# Too many DNS servers configured, the following entries may be ignored.
nameserver fe80::1%2
search home

cat /etc/systemd/resolved.conf

[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=no-negative
#DNSStubListener=yes
#ReadEtcHosts=yes
7
  • Looks like your DHCP server is specifying that DNS, so it is getting used as well as the netplan ones. Does this help? askubuntu.com/questions/1001241/…
    – jtessier72
    Commented Sep 1, 2021 at 20:19
  • I try adding : dhcp4-overrides: use-dns: false , nothing change
    – Armado
    Commented Sep 1, 2021 at 21:35
  • Worth asking, but did you do sudo netplan apply and then re-check?
    – jtessier72
    Commented Sep 2, 2021 at 13:02
  • Of course I'm using "sudo" :)
    – Armado
    Commented Sep 3, 2021 at 19:41
  • I ran a test on ubuntu server 20.04. My dns was from DHCP at first. Adding nameservers option made it 2 dns servers from netplan and 1 from DHCP. Adding the override made it netplan only. What is your /etc/resolv.conf and /etc/systemd/resolved.conf ?
    – jtessier72
    Commented Sep 3, 2021 at 20:45

1 Answer 1

1

This has been answered here https://askubuntu.com/a/1084736/993552

Basically in your /etc/netplan/filename.yaml add

dhcp4-overrides:
  use-dns: no

sudo netplan apply #do this after changing config

This will ensure whatever DNS nameservers come from DHCP will not be used by your link (ethernet or whatever network connection you change settings in)

Example

network:
  ethernets:
    ens5:
        dhcp4: true
        dhcp4-overrides:
            use-dns: no
        dhcp6: false
        set-name: ens5
        nameservers:
            addresses: [8.8.8.8, 4.4.4.4]
version: 2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .