Azure Virtual Network Custom DNS Server - azure

I created a virtual network and put 2 VMs in one subnet. But they were not able to ping each other using their hostnames. I need a DNS Server implemented so that hostnames in the subnet can be resolved to IP addresses. How do I do that? Any help will be appreciated. :)

the simplest scenario is to add your hostnames and ips to your localhost file if you are on Windows or you /etc/resolv.conf if you are on Linux. Deploy your VMs with fixed private IPs to avoid changes if they are rebooted or shutdown.
However, if the scenario is more complex with more than two machines, the best way is to deploy a DNS Server inside your VNET. The steps are the following ones:
First you need to add to your virtual network a DNS. You can do it through the management portal in the section NETWORKS > {Your Network Name} > CONFIGURE > dns servers. Fill it with a name and an IP.
Deploy a new VM inside the Virtual Network and set it's IP to the same IP you have defined inside the portal. You can do it through PowerShell (https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-reserved-private-ip/#how-to-add-a-static-internal-ip-to-an-existing-vm)
Configure your DNS server with the records for the VMs and set the forwarders if you want to be able to resolve names outside the virtual network.
You can reboot your virtual machines to get the new configuration through DHCP.
An example: http://www.ytechie.com/2013/06/setting-up-a-dns-server-in-azure-iaasvms/

Related

Cannot access Private AKS cluster from Local Machine (on home network) connected to Azure VPN

I have a Private AKS cluster deployed in a VNET on Azure. Once I deployed it, a private endpoint and a private DNS zone were created by default therefore making the cluster accessible from VM's which are part of the same VNET. (I have a VM deployed in the same VNET as the AKS cluster and "kubectl" commands work in it.)
My requirement is that I want to perform the "kubectl" commands from my local machine (connected to my home network) and also connected to the VPN which connects to the VNET.
My machine can talk to resources within the VNET but cannot seem to resolve the FQDN of the private cluster.
I read somewhere that having a DNS forwarder setup in the same VNET can help resolve the DNS queries made from the local machine which can then be resolved by Azure DNS. Is this the way to go about this? Or is there a better way to solve this problem?
It would really help if someone could give me an action plan to follow to solve this problem.
The better way to perform the "kubectl" commands from your local machine to your private AKS cluster is to use AKS Run Command (Preview). This feature allows you to remotely invoke commands in an AKS cluster through the AKS API. This feature provides an API that allows you to, for example, execute just-in-time commands from a remote laptop for a private cluster. Before using it, you need to enable the RunCommandPreview feature flag on your subscription and install aks-preview extension locally. However, there is a limitation that AKS-RunCommand does not work on clusters with AKS managed AAD and Private link enabled.
In this case, If you want to resolve the FQDN of the private cluster from your on-premise network, you could select to use either the hosts file locally(used for testing) or use your DNS forwarder to override the DNS resolution for a private link resource like this.
The DNS forwarder will be responsible for all the DNS queries via a server-level forwarder to the Azure-provided DNS 168.63.129.16.You can provision IaaS Windows VM with DNS role or Linux VM with bind configured as a DNS forwarder. This template shows how to create a DNS server that forwards queries to Azure's internal DNS servers for Linux VM. Refer to this for DNS forwarder on Windows VM.
If there is an internal DNS server in your on-premise network. The on-premises DNS solution needs to forward DNS traffic to Azure DNS via a conditional forwarder for your public DNS zones(e.g. {region}.azmk8s.io). The conditional forwarder references the DNS forwarder deployed in Azure. You could read this blog about DNS configuration sections for more details.

Azure DNS zone record not resolving to specified IP from App service to Virtual Machine

I followed the documentation guide here to configure an Azure DNS zone for a virtual network.
I then created a virtual machine on that virtual network and provisioned a virtual network gateway to allow my Azure web apps to communicate with the virtual machine using VNet integration. My web apps are then able to resolve against the virtual machines private IP as expected.
I then created an 'A' type record set within the DNS zone resolving a service name against the private IP of the virtual machine just like here.
However, when I then attempt to access the DNS configured service name that should resolve against the private IP address of the virtual machine, I get the following error:
curl: (6) Could not resolve host: xxxx.local
Am I missing something obvious here?
I can not reproduce this error following your steps:
Create an Azure VNet with a DNS private zone like private.test.com.
Create a VM and a VPN gateway on that VNet.
Enable VNet integration with my Azure web app service.
My web apps are able to resolve against the virtual machines private IP as expected. This could verify the Azure private DNS zone should work. Then I also create an A record for a custom name against the VM private IP address. Both scenarios work.
You could check if an A record is something like below picture in the private DNS zone.
Then you could verify if curl with http:// or without that, or without the specific port 9200, the error is still the same.
I suggest using SET WEBSITE_DNS_ command. This command will output the current DNS server that is being used by the web app. If the error Environment variable WEBSITE_DNS_ not defined is received, no custom DNS servers are configured for the web app. See more details about networking Related Commands for Azure App Services.

Azure DNS (reddog.microsoft.com) 10.0.1.4 Virtual Machine Template

I'm using a template to deploy an elastic cluster and am having issues with the nodes setting up/deploying correctly when I choose my own subnet. It seems this is due to how the Virtual machines by default seem to have a DNS record for their private IP address. But In my case this isn't happening.
Azure DNS (reddog.microsoft.com) 10.0.1.4
What is this DNS server?
Where is it hosted?
Is it automatically deployed to every VPN?
Why do some machines automatically get a record entry and others not?
How can I ensure that machines get an entry?
I am currently trying to use a template to deploy Elasticsearch. If I deploy elasticsearch by creating a subnet during deployment then I get host entries on each ubuntu VM in /etc/hosts and also an A-Record for each VM in this DNS server. The deployment is successful.
If however I choose for the template to deploy in my own subnet I find that the machines don't have each other in /etc/hosts and the DNS server doesn't contain an A-Record and therefore can't resolve each other via name. Deployment therefore fails.
The template I am deploying via the Azure portal UI:
Elastic Stack - (Elasticsearch, Kibana, X-Pack)
Any help appreciated,
Thank you
based on the IP and the dns search suffix, that a custom DNS server. The would be configured as part of the virtual network properties or as part of the dns settings on the individual NIC.

Windows Azure VM cannot access microsoft.com

I have 2 VM's on Windows Azure, connected with a virtual network, including the "DNS" component linked to the virtual network.
The first machine is an AD controller (with DNS), and the DNS from the virtual network (in Azure) is pointed to this machine (10.0.0.4).
The 2 vm's can talk to each other, and the second VM is also domain joined with the AD controller on the first machine.
The problem is, on both VM's, I cannot access/browse to anything related to microsoft.com (like visualstudio.com, etc). All other sites (even bing.com) work without any problem.
What could be the reason. Do I need to change some DNS settings on my first VM so that microsoft.com is "excluded" or something. As I suppose that this is "internal" microsoft traffic?
Thanks!
Solved! You need to add the Google DNS to the list of DNS servers in the management portal, and link it to your Virtual Network.
To do so, add one or both of Google's DNS IP addresses (8.8.8.8 or 8.8.4.4) to the list of DNS servers associated with an Azure virtual network. In the Azure management portal, go to 'Virtual Networks > [Your virtual network] > DNS Servers', then add the addresses to the list and click Save.

Networking between Virtual Machines in a Virtual Network

I have set up file sharing and SQL Server instance connectivity between two VMs (testPC01, testPC02) in a Virtual Network on Azure.
The problem is that I cannot connect between these VMs by name (testPC01, testPC02), but only by their IP addresses (10.0.0.4, 10.0.0.5). I cant even ping the names.
I haven't fiddled with any network settings. These are fresh VMs.
How can I resolve by name and not by IP?
see similar thread: Azure VMs Virtual Network inter-communication
you will have to configure your own DNS for name resolution.

Resources