Logo

Armand.nz

Home / About / Linkedin / Github

Configure resolvconf to set Permanent DNS Nameserv

#linux #dns |

Installing resolvconf in Ubuntu and Debian to set Permanent DNS Nameservers in Ubuntu and Debian

Unfortunately, because the /etc/resolv.conf is indirectly managed by the systemd-resolved service, and in some cases by the network service (by using initscripts or NetworkManager), any changes made manually by a user can not be saved permanently or only last for a while.

  1. Update the system software packages and then install resolvconf from the official repositories by running the following commands.

     sudo apt update<br/>sudo apt install resolvconf
    
  2. Start and enable resolvconf.service

     sudo systemctl start resolvconf.service
     sudo systemctl enable resolvconf.service<br/>sudo systemctl status resolvconf.service
    
  3. Set Permanent DNS Nameservers and search domain

     sudo cat <<EOT >> /etc/resolvconf/resolv.conf.d/head
     nameserver 172.16.29.3
     nameserver 1.1.1.1
     nameserver 8.8.8.8
     search nginxf5.com
     EOT
    
  4. Check the file

     cat /etc/resolvconf/resolv.conf.d/head
    
  5. Save the changes and restart the resolvconf.service or reboot the system.

     sudo systemctl start resolvconf.service
    
comments powered byDisqus

Copyright © Armand