DNS Question - Ubuntu Server

DeaconFrost

[H]F Junkie
Joined
Sep 6, 2007
Messages
11,582
What's the difference between the resolv.conf file and the netplan yaml file, in terms of setting DNS servers? When I build Ubuntu 20.04 LTS servers and enter in our DNS servers, they are entered into the netplan.yaml file. However, it seems that some of our servers are ignoring these settings and using the resolv.conf file instead.

I'm noob-level Linux server admin, so what's the difference? Maybe, better yet, is there a way to force/ensure the servers are using what's specified in the yaml file?
 
Have you ran systemd-resolve --status and verified what DNS servers are being used?

Read the faq and troubleshooting info at netplan.io?
 
NetPlan is Ubuntu's way of providing a single configuration for network settings regardless of whether the system is using NetworkManager (e.g., Ubuntu Desktop), straight systemd-networkd (e.g., Ubuntu Server). AFAICT, only Ubuntu and derivatives use it.

The resolv.conf file should be auto-generated by NetworkManager or systemd-networkd. Those should be getting the info for DNS servers from NetPlan.

Some guesses as to the problem:
  • Check /lib/netplan/, /etc/netplan/, and /run/netplan for any erroneous yaml files that could be screwing with things (there may be some binaries/scripts that do belong).
  • Make sure you set the yaml config file to use the proper renderer (should probably be 'networkd' for Ubuntu Server).
  • /etc/resolv.conf should be a symlink to another location where the auto-generated file actually exists (e.g., /run/systemd/resolve/resolv.conf)
Ubuntu does have a site dedicated to NetPlan.
 
What's the difference between the resolv.conf file and the netplan yaml file, in terms of setting DNS servers? When I build Ubuntu 20.04 LTS servers and enter in our DNS servers, they are entered into the netplan.yaml file. However, it seems that some of our servers are ignoring these settings and using the resolv.conf file instead.

I'm noob-level Linux server admin, so what's the difference? Maybe, better yet, is there a way to force/ensure the servers are using what's specified in the yaml file?
These cloud servers?
 
Last I checked Ubuntu Server defaults to systemd-networkd so unless that was changed manually the netplan.yaml wouldn't work. All the Ubuntu Servers I run in my house have defaulted to systemd-networkd. I don't set anything in the resolv.conf though. My DHCP server hands the systems their DNS info.
 
Thanks for the suggestions I check netplan.io. Great information there, and it does seem like the config we set in Netplan should create the appropriate settings and config files down the line.
 
Back
Top