Home > Software engineering >  VMs in separate subnet can ping each other
VMs in separate subnet can ping each other

Time:11-07

In Azure, I have 2 VMs, each in their own subnet (see image below). To my surprise, both VMs can "see" each other (using ping).

The subnet address ranges are:

  • net1-subnet1: 10.0.1.0/24
  • net1-subnet2: 10.0.2.0/24

The VMs (NIC) IPs are:

  • vm1: 10.0.1.4
  • vm2: 10.0.2.4

This is the setup enter image description here

Why are both VMs able to ping each other? I thought since they are in different subnets, they would not be able to "see" each other. Is this an Azure specific feature?

Thanks

CodePudding user response:

Azure routes traffic between subnets in the same virtual network (or peered virtual networks) by default as described in the Azure virtual networks overview.

You can use network security groups to filter traffic flowing in- and outbound to/from these subnets. The default rules will allow traffic from a virtual network, so you will have to add some of your own rules with a higher priority to the Network Security Groups (NSG). See docs in NSG here

  • Related