Solution Steps in Detail
There could be multiple reasons why the DNS resolution is failing.
DNS server is not reachable from the server.
Port 53 is not open on the firewall.
No Client DNS IP is configured in /etc/resolv.conf.
resolvconf package is not installed on the server.
systemd-resolved.service can be down.
DNS bind serrvice can be down.
We should do the following checks:
- Check If any DNS IP is configured on the server.
# systemd-resolve –status
or
# cat /etc/resolv.conf - If DNS IP is present, then try to telnet the IP and check the reachability.
vunet@shipper1:~$ telnet 172.24.2.9 53
Trying 172.24.2.9...
Connected to 172.24.2.9.
Escape character is '^]'.
^]
telnet> q
Connection closed.
Check if systemd-resolve service is running. If not running restart the service
# sudo systemctl status systemd-resolved.service
To Restart
# sudo systemctl restart systemd-resolved.service
- If DNS IP is not present, we need to configure the DNS IP
- Check if the resolvconf package is presnt. If not install the package.
- # apt list --installed | grep "resolvconf"
- Steps to Install the resolvconf package on the server using command or package
- Using the command
- # sudo apt -y install resolvconf
- Using the Debian package.
- download the package using the URL http://ports.ubuntu.com/pool/universe/r/resolvconf/resolvconf_1.79ubuntu10.18.04.3_all.deb and put the package in the server (check for the package as per the OS version
- Run the below command to install the package
- # sudo dpkg -i /absolute/path/to/deb/file
- # sudo apt-get install -f
- Edit the file /etc/resolvconf/resolv.conf.d/head and add the below the entry and save the file.
- nameserver <ip_of_nameserver>
- Run the below command for reloading the configuration.
- #sudo resolvconf -u
- Check if the DNS is working properly or not
# systemd-resolve <URL>