top of page
Writer's pictureJagjeet Singh

Addressing DNS-Related Internet Issues in Azure Ubuntu VMs: A How -To Guide

Updated: Aug 23, 2023

Are you experiencing internet connectivity issues on your Azure Virtual Machine (VM)? You may find that while you can ping certain IP addresses, you cannot reach domains like google.com, or even your own production servers. This issue can occur on both Windows and Linux VMs, particularly Ubuntu, and is usually related to a DNS server or firewall issue. In this article, we will guide you on how to troubleshoot and resolve this issue by setting the DNS server and domain using Ubuntu commands.


Problem:


A production web application running on an Azure VM (prod1), served by another VM (prod2) as a database server, is unable to reach the internet. Although pinging google.com from prod2 is successful, the same action from prod1 fails. The error returned is a "Temporary failure in name resolution," indicating a DNS issue.


Resolution Steps:

First, ensure that you have SSH access to the problematic Ubuntu VM. If you need guidance on setting up SSH, you can refer to this article.


After accessing the VM, perform these steps:

  1. Test Local Connectivity: Ping the local host (127.0.0.1) and hostname. If both are successful, proceed to step 2.

  2. Test Internet Connectivity: Ping an external IP address, e.g., Cloudflare's IP (1.1.1.1). If successful, this confirms that the internet is working on the VM.

  3. Test DNS Resolution: Try pinging a domain (e.g., google.com). If unsuccessful and returns a "Temporary failure in name resolution" error, it confirms a DNS issue.

  4. Check DNS Server Information: Run systemd-resolve --status. If no DNS servers are listed in the output, it confirms that the VM doesn't have a DNS server for name resolution.

  5. Assign DNS Server to VM: Assign a DNS server to the VM with the command: sudo systemd-resolve --set-dns=168.63.129.16 --interface=eth0

  6. Here, we use Azure-hosted DNS server's IP address (168.63.129.16), and the interface name (eth0) can be found using ip addr show or ip -br addr show

  7. Restart Network Connection: Restart the network connection using sudo systemctl restart systemd-resolved.

  8. Verify DNS Server Assignment: Run systemd-resolve --status again to verify that the DNS server has been assigned.

  9. Test DNS Resolution Again: Try pinging google.com again. If successful, proceed to the next step.

  10. Test Internal Connectivity: Try pinging your internal servers. If it returns a "Temporary failure in name resolution" error, you need to set a DNS domain (or DNS suffix).

  11. Find DNS Domain or DNS Suffix: You can find the DNS Domain from a working server using systemd-resolve --status or refer to this Microsoft article. Alternatively, you can use this PowerShell command: Get-AzNetworkInterface

  12. Set DNS Domain: Assign the DNS domain to your VM using: sudo systemd-resolve --set-dns=168.63.129.16 --interface=eth0 --set-domain=Your_Unique_DNS_Suffix_OR_DNS_Domains.bx.internal.cloudapp.net



  1. Replace Your_Unique_DNS_Suffix_OR_DNS_Domains.bx.internal.cloudapp.net with your actual DNS Domain.

  2. Restart Network Connection Again: Restart the network connection using

sudo systemctl restart systemd-resolved

After these steps, the VM should now successfully ping both external domains and internal servers. You have successfully resolved the DNS issue causing the internet connectivity problems on your Azure VM. If you continue to face issues, please check your Azure network configurations or contact Azure support for further assistance.


82 views0 comments

Comentarios


bottom of page