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
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