Azure VM does not have internet access

Zayori 25 Reputation points
2023-03-27T09:17:18.3333333+00:00

I've had quite a few issues with one of my VMs today, but after a lot of troubleshooting I have now only 3 remaining issues, and one of them is that the VM is not able to access the internet. (Solving this might also fix the other things.)

I have not changed any settings on this machine for years, and all of a sudden everything seems to have exploded overnight.

The VM in question is running Ubuntu 18. It has a single public IPv4, with pretty much default settings. No loadbalancer. There is no firewall running on the machine itself ("> ufw status") or in Azure's virtual network.

I am able to use the serial console in the Azure Portal to log in to the machine, and I can see that it is doing fine. Memory, disk space, CPU and services are all fine. I can also see that it is listening on ports 22, 80 and 443 (SSH, HTTP, HTTPS). This is listed under tcp6, which I think is fine too - as far as I understand tcp6 can handle both IPv4 and v6 unless otherwise specified, but since the serial console is working, I guess port 22 is working. Not sure if it uses v4 or v6, but the machine does not have an IPv6, so it's probably fine.

I can't connect using SSH from my own PC and I can't see the website over port 80 or 443 (connection timeout). From the console I am also not able to ping google.com ("temporary failure in name resolution") or 8.8.8.8 ("network is unreachable").

In my mind this points to a problem in the NSG somewhere.

This is what the VM looks like:

vm

This is the NSG:

nsg

Initially, the NSG was not attached to the default subnet, but after comparing these settings to another VM, I saw that this seems to be done by default for new VMs now. It did not make any difference, however. Before I changed this, the NSG was only associated with the network interface (bottom table in the image above).

The public IPv4 is a Basic SKU, not Standard SKU. Shouldn't make any difference as far as I can tell, since this VM is not using a loadbalancer.

I have restarted, redeployed, reapplied numerous times and even rolled the entire thing back to the latest backup.

Any suggestions?

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,312 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Zayori 25 Reputation points
    2023-04-13T11:47:35.55+00:00

    Finally got to the bottom of this. The Microsoft Support team went through the logs and found that the DHCP Client wasn't running. This means the machine was not getting an IP, which explains why everything was offline. They recommended that I execute the command "dhclient -v" (v is the verbose logging option), and everything came back online instantly. They also recommended that I put in a cronjob to start the DHCP Client after every reboot. I did a "sudo crontab -e" and put in "@reboot /sbin/dhclient".

    1 person found this answer helpful.
    0 comments No comments