Unable to resolve custom DNS name for virtual machines via VPN

Najam ul Saqib 340 Reputation points
2024-11-02T02:16:03.2766667+00:00

Hi,

I am trying to resolve to custom DNS name for virtual machines and SQL on VMs in my tenant; the structure is as follows:

We have 2 subscriptions i.e. sub1 and sub2, the private DNS zone and VPN gateway are in sub1 whereas the VMs are in sub2. The VNet of sub1 is VNet 1 and of sub2 is VNet 2.

The VNet 2 is peered with VNet1 (and some other VNets as well), the VPN gateway is point-to-site and connected to AWS VPC using site-to-site as well.

Both VNet1 and VNet2 are added as virtual network links in the private DNS zone.

Now when I connect to the VPN gateway using point-to-site connection, I am able to RDP to the machine using its private IP but when I try using the DNS name (whose A record is configured in the recordsets of private dns zone), it fails.

I have tested from within VM in sub2 and I can perform nslookup on the DNS names and they resolve fine, but it no longer works when I am trying to resolve via VPN.

Can someone explain what's wrong here? I am happy to share more details.

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
691 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,008 questions
Azure VPN Gateway
Azure VPN Gateway
An Azure service that enables the connection of on-premises networks to Azure through site-to-site virtual private networks.
1,559 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,514 questions
0 comments No comments
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 47,046 Reputation points Microsoft Employee
    2024-11-05T06:52:41.3466667+00:00

    @Najam ul Saqib ,

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you are unable to resolve Private DNS Zone records from a remote device connected via P2S.

    This is an expected behavior.

    P2S and S2S Connected devices would not have the knowledge of Private DNS Zone records, and thus the resolution would fail.

    If you would like to provide DNS resolution for records contained in Private DNS Zone,

    • Consider using Azure DNS Private Resolver or a VM acting as DNS Server in the Hub VNET (for both S2S and P2S)
    • User's image
      • Refer to the highlighted section from the above diagram
    • You should take care of your OnPrem (in your case, AWS VPC) forwarding the DNS requests to the Inbound EndPoint of Private DNS Resolver in case of S2S
    • For P2S , you can consider adding DNS suffixes and custom DNS servers into the P2S Configuration file.
      • The DNS Suffix should be the private DNS Zone name
      • And custom DNS Server should be the InBound EndPoint.

    You can find a similar environment here : Azure Private Resolver with on-premises DNS forwarder

    • While this architecture highlights private endPoints and their Private DNS Zones
    • The same configuration can be applies for any Private DNS Zone that needs to be resolved from OnPrem via S2S or P2S.

    Please let us know if we can be of any further assistance here.

    Thanks,

    Kapil


    Please Accept an answer if correct.

    Original posters help the community find answers faster by identifying the correct answer.


1 additional answer

Sort by: Most helpful
  1. Sedat SALMAN 14,065 Reputation points MVP
    2024-11-03T05:10:53.35+00:00

    Hello

    Even though you have virtual network links, the DNS servers in VNet1 need to know how to forward queries for the custom domain to the DNS servers in VNet2. This is typically done with conditional forwarding rules.

    so you can check the following links that may help you solve your problem

    https://learn.microsoft.com/en-us/azure/dns/private-dns-virtual-network-links

    https://learn.microsoft.com/en-us/azure/dns/dns-private-resolver-overview

    0 comments No comments

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.