1

New to Azure and trying to understand DNS resolution for Linux guests.

My VNET is set to two Windows DNS servers in Azure, when I add a Linux VM they are present and I can ping IP addresses and FQDN's in Azure and on-premise across the VPN.

So at the moment:

ping 1.1.1.1 - works
ping hosta.mydomain.com - works
ping hosta - does not work

Traditionally I get the last to work either via adding dns-search to interfaces or resolv.conf, but these are overwritten by Azure each reboot.

I have found that if I add the line

dns-search mydomain.com

to /etc/network/interfaces.d/50-cloud-init.cfg it works.

I am unsure if this is best practice as I have also seen this article "Azure Linux VM name resolution" suggest it should be done via /etc/dhcp/dhclient.conf.

Is someone able to advise what the best way to do this is, one that survives reboots and preferably survives changes at the Azure portal NIC blade?

Cheers

1

When you reboot your VM, Azure VM waagent will rest /etc/resolve.conf file, so you will find the file is overwritten.

As S.Walker's link, you could use custom DNS server. You could do it on Azure Portal.

enter image description here

  • If it works, please don't forget to accept it as an answer. It will help more people in the community. – Shui shengbao Nov 9 '17 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.