Ubuntu machine not able to connect to internet

Srinivasa Rao Keerty 1 Reputation point
2023-05-23T07:46:59.38+00:00

I have created a Ubuntu machine in our subscription and it has been configured with NSG and associated with NIC as well, however, we are not able to connect to the internet with this server.

ping www.google.com

PING www.google.com (142.250.179.196) 56(84) bytes of data.

^C

--- www.google.com ping statistics ---

22 packets transmitted, 0 received, 100% packet loss, time 21508ms

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,158 questions
{count} votes

1 answer

Sort by: Most helpful
  1. vipullag-MSFT 24,206 Reputation points Microsoft Employee
    2023-05-23T11:32:24.79+00:00

    Hello Srinivasa Rao Keerty

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    If your Azure Ubuntu machine is not able to connect to the internet despite having the appropriate network security group (NSG) and network interface card (NIC) configurations, there are a few troubleshooting steps you can try:

    • Ensure that there are no deny rules that might be blocking the connection on the NSG.
    • Verify that the NIC associated with your Ubuntu machine has the correct IP configuration, including the proper subnet and gateway settings.
    • Check if the VM has the correct DNS server settings. You can do this by inspecting the /etc/resolv.conf file and confirming that it contains a valid DNS server IP address.
    • Check the default gateway by running the ip route command in the terminal. The output should show a default route with the gateway IP.
    • Run the ping command with an IP address instead of a domain name to eliminate any potential DNS resolution issues. For example, try pinging the IP address of a public DNS server like Google DNS (8.8.8.8) or Cloudflare DNS (1.1.1.1). If the ping is successful, it indicates that the VM has network connectivity, and the issue may be with DNS resolution.
    • If pinging IP addresses works but pinging domain names does not, it suggests a DNS issue. Ensure that your Ubuntu machine has the correct DNS server settings. You can check and modify the DNS configuration in the /etc/resolv.conf file.
    • Check if there are any firewall rules blocking the outbound traffic. You can check the firewall rules by running the following command sudo iptables -L

    Hope this helps.

    0 comments No comments