NSG for subnet/NIC not working properly

Piotr Jaromin 20 Reputation points
2023-10-06T10:15:59.9533333+00:00

I got a VM sitting in a subnet associated with a NSG that allows traffic on port 22 to that machine from any source, but can't connect to it, something is stopping the traffic. Diagnostic tool says that it's the DenyAllInbound default rule, but this make no sense since my NSG has an explicit rule to allow 22. No firewall deployed in that vnet. Can you advise what can be wrong? Tried with both manually adding the rule as well as the automatically added one druing VM creation. Also tried associating the NSG directly with VM's NIC instead of subnet.
I can ssh to that machine using private IP from another one in the subnet so the ssh on vm works fine, also it's a generic ubuntu deployed from azure image, nothing changed in config, it has to be some azure networking shenanigans.

//edit added screenshot from troubleshooting tool

User's image

User's image

Screenshot 2023-10-06 at 12.12.05

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,713 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,715 questions
0 comments No comments
{count} votes

Accepted answer
  1. msrini-MSFT 9,291 Reputation points Microsoft Employee
    2023-10-06T13:19:54.27+00:00

    Hi, The destination IP needs to be the private IP of the VM not the public IP. When you apply NSG rule to the Inbound rules , the destination always needs to be the Private IP not the public IP.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.