DNS Resolution takes more than 5 seconds or longer

Hello,

Something seems to be wrong with my DNS resolution and I am not sure where to start. I have confirmed with my provider that the DNS IPs are correct on the server but whenever I ping or traceroute a url, it takes more than 5 seconds or more to even start the process.

If I use the IP it starts immediately.

The replies don’t show long response times. only the start of the process takes long.

I found this article RHEL: DNS resolution can take 5 seconds or longer - Red Hat Customer Portal but I am not a subscriber so any assistance would be appreciated.

Thanks :slight_smile:

Ok, I solved my own problem. It turned out to be the config in the /etc/resolv.conf that was pointing to the wrong IP.

I corrected the IP and it is working again. Not even sure how it changed!!

One way to give your server even more DNS speed is to set up caching with DNSMasq. Then you have DNSmasq have your upstream providers while using 127.0.0.1 as your dns provider in resolv.conf.

1 Like

One way to do that is that you configure NetworkManager.service to use dnsmasq as its resolver. See parameter dns in man NetworkManager.conf

In practice, add a file (name must have extension .conf) into /etc/NetworkManager/conf.d/

[main]
dns=dnsmasq

and restart NetworkManager.service. (You have to have the dnsmasq package installed.)

On start the NetworkManager.service starts instance of dnsmasq and passes all the name servers to it via DBus. The /etc/resolv.conf will have only the 127.0.0.1.

2 Likes

I would definitely recommend jlehtone’s method.

DNSMasq is so fast and lightweight, honors TTLs, and gives you a local way to poison DNS hosts, zones, and records, and provide DNS overrides for a great split horizon approach.

1 Like

I definitely would love to implement this but doesn’t cPanel have it’s own built in DNS or is that a stoopid comment?

I just don’t want to mess with cPanel?

I don’t know what cPanel has and does. CentOS has the stance that if system has cPanel (or similar), then the practices that work in RHEL and CentOS will not apply. Since those are the only practices that I know, I know that I don’t know what is good in AlmaLinux that has cPanel.