How can I edit the search domain of a linux vm on azure

Sahar Yacout 20 Reputation points
2024-10-16T21:18:06.9333333+00:00

I have a RHEL 9 VM running on azure and I would like to change the Search domain in the resolv.coonf file, if I do that it gets reset with the reboot.

I could change from networking settings the DNS servers, but for the search domain I can't find an option to make them custom

Azure VMware Solution
Azure VMware Solution
An Azure service that runs native VMware workloads on Azure.
361 questions
{count} votes

1 answer

Sort by: Most helpful
  1. anashetty 825 Reputation points Microsoft Vendor
    2024-10-17T10:30:24.66+00:00

    Hi Sahar Yacout,

    I have shared troubleshooting steps which I have tried from my end, it worked for me.

    First log into VM, then check your DNS domain. Below is my default DNS domain.
    User's image Edit the file /etc/dhcp/dhclient.conf and add the search domain and save the file.

    append domain-search "test.example.com";
    

    then Restart Networkmanager sudo systemctl restart NetworkManager
    User's image Now check the /etc/resolv.conf file, search domain is successfully added to the network interface:User's image I have rebooted, you can see that search domain is not resettingUser's image For more information, please visit https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/linux/custom-dns-configuration-for-azure-linux-vms?tabs=RHEL#configure-search-domains

    If you have any further queries, please do let us know.

    If the answer is helpful, please click "Accept Answer" and "Upvote it."
    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.