Score:0

DNS issues on Ubuntu 22.04.3 headless server

kr flag

Background

Trying to configure a headless plex server on a little Optiplex machine I bought. Everything has gone smoothly until I try to claim my plex server and it turns out there are DNS issues on the server. I'm running Ubuntu 22.04.3

I should preface this by mentioning I have a PiHole, but by router settings do not force all client traffic to the PiHole's DNS server ("DNS Director" is disabled in my ASUS router running merlin). I've successfully circumvented the PiHole on my partner's laptop by manually setting the DNS locally, and that's been working great for years. I assume DNS settings on the Ubuntu server would also circumvent the PiHole, and I'm able to temporarily disable the PiHole to check this.

At some point when trying to enable a static IP, I installed NetworkManager, which although I understand isn't standard practice on a headless machine, it might be more risky to try and disable it now.

Problem

DNS isn't working, as far as I can tell. I can ping an ip address

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=11.0 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=58 time=12.0 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=58 time=8.91 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=58 time=13.1 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=58 time=11.6 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=58 time=11.5 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5008ms
rtt min/avg/max/mdev = 8.911/11.358/13.082/1.262 ms

but I can't ping a URL

ping: https://www.plex.tv/: Name or service not known

or

ping: https://www.google.com: Name or service not known

What I've Tried

I deleted /etc/resolv.conf, also removing the symlink between /etc/resolv.conf and /run/resolvconf/resolv.conf. I edited NetworkManager.conf to force NetworkManager to re-create resolv.conf. Below is NetworkManager.conf:

[main]
plugins=ifupdown,keyfile
dns=default
rc-manager=symlink

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

and here is the brand new resolv.conf, which is sitting in /etc with no symlink anymore:

# Generated by NetworkManager
nameserver 192.168.1.199
nameserver 1.1.1.1
nameserver 8.8.8.8

Here is my netplan, I've rebuilt using netplan try and netplan apply (when root)

network:
  renderer: NetworkManager
  ethernets:
    enp0s31f6:
      dhcp4: true
  version: 2

Other (Useful?) Information

Here is the output of nmcli device status

DEVICE     TYPE      STATE      CONNECTION
enp0s31f6  ethernet  connected  static-ip
lo         loopback  unmanaged  --

and the output of sudo ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 18:66:da:43:cb:68 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.111/24 brd 192.168.1.255 scope global noprefixroute enp0s31f6
       valid_lft forever preferred_lft forever
    inet6 fe80::5159:dbb8:4452:adaa/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

Testing using DiG:

; <<>> DiG 9.18.12-0ubuntu0.22.04.2-Ubuntu <<>> @8.8.8.8 www.ubuntu.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48879
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.ubuntu.com.                        IN      A

;; ANSWER SECTION:
www.ubuntu.com.         14      IN      A       185.125.190.20
www.ubuntu.com.         14      IN      A       185.125.190.21
www.ubuntu.com.         14      IN      A       185.125.190.29

;; Query time: 8 msec
;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP)
;; WHEN: Wed Aug 23 14:30:08 UTC 2023
;; MSG SIZE  rcvd: 91

Next Steps?

The next thing I was thinking to investigate is whether I should add another configuration to the .yaml configuration for the ethernet interface, since it's just the static ip interface that's configured right now. Examining the configuration using nmtui shows the ethernet interface enp0s31f6 is just configured automatically:

nmtui screenshot of enp0s31f6 interface

If you made it through all this, thank you! I've searched many threads over the past few days, learning a lot about how Linux network configuration works, but after several hours I seem to be pretty stuck. Any help would be greatly appreciated before I accidentally break something :)

Marco avatar
br flag
Reminder: The netplan config is only a suggestion to the network renderer. Netplan config is ignored by the renderer if you manually configure the renderer (e.g. NetworkManager).
ru flag
Reminder: PING *cannot* ping URLs. If you're trying to test Google.com, you have to use Google.com as the below answer says.
Score:3
vn flag

Which command to you use to ping a DNS name?

You must do like this:

$ ping google.com
PING google.com (142.250.74.78) 56(84) bytes of data.
64 bytes from arn09s23-in-f14.1e100.net (142.250.74.78): icmp_seq=1 ttl=58 time=15.3 ms
64 bytes from arn09s23-in-f14.1e100.net (142.250.74.78): icmp_seq=2 ttl=58 time=14.3 ms
64 bytes from arn09s23-in-f14.1e100.net (142.250.74.78): icmp_seq=3 ttl=58 time=16.5 ms
64 bytes from arn09s23-in-f14.1e100.net (142.250.74.78): icmp_seq=4 ttl=58 time=14.3 ms

Whereas this will give an error:

$ ping https://www.google.com
ping: https://www.google.com: Name or service not known

You cannot ping a http/https URL, since ping knows nothing about http/https protocols.

So based on what you have included in your question, I don't think you have a DNS problem at all.

ad01 avatar
kr flag
Little bit of a facepalm moment here. I'm an engineer but still learning - this was a silly mistake. Thank you! I logged into the Plex client again and see my server claim apparently went through in the last few hours so all's well.
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.