Score:0

Ubuntu server not getting DNS from DHCP Server?

ci flag

My Ubuntu server doesn't seem to be getting it's DNS settings from the DHCP service on my router.

root@dios:/etc/netplan# cat 01-netcfg.yaml
    network:
      version: 2
      renderer: networkd
      ethernets:
        enp3s0:
          dhcp4: true

It's getting it's IP address from the DHCP server, but the DNS settings seem to be being left out.

root@dios:/run/systemd/network# nslookup www.google.com

root@dios:/run/systemd/network# nslookup www.google.com 192.168.2.1
    Server:         192.168.2.1
    Address:        192.168.2.1#53

    Non-authoritative answer:
    Name:   www.google.com
    Address: 142.250.80.68
    Name:   www.google.com
    Address: 2607:f8b0:4006:80c::2004

My windows PC is working fine, which leads me to believe there's an issue with my Ubuntu server.

I've tried manually setting the DNS server settings in my netplan file:

   network:
     version: 2
     renderer: networkd
     ethernets:
       enp3s0:
         dhcp4: true
         dhcp4-overrides:
           use-dns: false
         nameservers:
           addresses: [192.168.2.1, 8.8.8.8]

But that doesn't help either.

Where am I going wrong?

ralz avatar
cn flag
what is in your `/etc/resolv.conf`, are you using systemd-resolved, is the service running `systemctl status systemd-resolved.service`
waltinator avatar
it flag
Are you sure the DHCP server is sending the DNS server's address? you can use `tcpdump` (`man tcpdump`) or `wireshark` https://www.wireshark.org/ to find out.
maxisam avatar
cn flag
have you tried to add ``` nameserver 192.168.2.1 nameserver 8.8.8.8 ``` to your `/etc/resolv.conf`
maxisam avatar
cn flag
you can also use `resolvectl status` to check the status of DNS
Score:0
ci flag

Turns out Systemd-Resolved service was disabled. I have no idea why or how, but it was. I've enabled it, and everything works smoothly.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.