Skip to main content

file sudo nano /etc/resolv.conf

Comments

12 comments

  • pwhjenny
    Which operating system do you use? A network manager can automatically update the /etc/resolv.conf. You can also set up attributes to the file using chattr command so the file is not written by any program.
    0
  • programmertehamatech
    Which operating system do you use? A network manager can automatically update the /etc/resolv.conf. You can also set up attributes to the file using chattr command so the file is not written by any program.

    Can you explain more to me??
    0
  • hmaddy
    update /etc/resolv.conf and enter nameserver 8.8.8.8 nameserver 8.8.4.4 save the file then enter the following command chattr +i /etc/resolv.conf
    0
  • vacancy
    This may be due to the priority of DNS1 DNS2 records in the ifcfg-* file. If the DNS1 and DNS2 records in this file are empty, the variables here may be interfering with your resolv file when you restart the server. Locking the file with chattr is a good idea, but you may also want to look at your ifcfg-* file.
    0
  • cPRex Jurassic Moderator
    I'll also add that using public resolvers can have unintended consequences, such as RBL lookups not working properly:
    0
  • programmertehamatech
    update /etc/resolv.conf and enter nameserver 8.8.8.8 nameserver 8.8.4.4 save the file then enter the following command chattr +i /etc/resolv.conf

    chattr: Operation not supported while reading flags on /etc/resolv.conf
    0
  • quietFinn
    what is the output of: ls -la /etc/resolv.conf
    0
  • Benito

    Hello! I'm having a similar problem. If you don't mind, I'll post on this thread.

    My provider gives me two IPv4 nameservers and two IPv6 nameservers. When I manually put the IPv4 nameservers in /etc/resolv.conf everything works fine.

    The problem is that when I restart the server, only the two IPv6 nameservers appear in the /etc/resolv.conf file, not everything resolves correctly and I have many problems.

    I know that cPanel makes some settings related to Network Manager service and network.service when installed.

    Do I have a way to tell the operating system that after rebooting it only obtains the IPv4 nameservers from my provider? It happens to me on two new installations with the latest cPanel on Cloudlinux 8 and 9.

    0
  • cPRex Jurassic Moderator

    Benito - cPanel itself doesn't control the /etc/resolv.conf file on the system.  With CloudLinux 8 we automatically disable Networkmanager, but you do not need to do this for CloudLinux 9.  Details on that can be found in the blue "note" box near the top of the page here:

    https://docs.cpanel.net/knowledge-base/general-systems-administration/how-to-disable-network-manager/

    You'll likely want to reach out to your host to see if they can confirm what is causing this behavior.

    0
  • Benito

    Hey, I did it already. Hoster says 

    Dear Client,

    thank you for reaching out to us. While we don't support CloudLinux, the configuration
    should essentially be the same as CentOS/Alma/Rocky.
    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/configuring-ip-networking-with-ifcfg-files_configuring-and-managing-networking

    Digging into ifcfg-eth0 file I found this on the first line: 

    # Created by cloud-init on instance boot automatically, do not edit.
    #

    The question now is who controls cloud-init? Asked to cloudlinux, awaiting reply.

    0
  • cPRex Jurassic Moderator

    That's definitely going to be a CloudLinux issue - let me know what they have to say!

    0
  • Benito

    Cloudlinux replied. 

    The cloud-init is a utility that automates the initialization of cloud instances during system boot, and performs a variety of tasks, such as:
     
    Configuring a hostname
    Installing packages on an instance
    Running scripts
    Suppressing default virtual machine (VM) behavior
     
    This tool is not part of CloudLinux OS. You may refer to their website:
    https://cloud-init.io/

    Tomorrow we will see what my host tells me.

    1

Please sign in to leave a comment.