Vnet to Vnet machines not pinging - azure

I have the following scenario.
2 vnets (same location/location, but different resource groups)
vnetA: Address space 10.1.0.0/16
Gateway subnet 10.1.1.0/24
VM 10.1.0.5
vnetB: Address space 10.0.0.0/16
Gateway subnet 10.0.2.0/24
VM 10.0.1.7
They are both peered through vnet to vnet gateways, but machines cannot ping each other.
Could anyone please guide to documentation or give advice to this please?

You should check the Network Security Groups rules associated to the VNet's Subnets or to the VM's NICs. Unfortunately there is no a specific rule for ICMP protocol, but TCP and UDP only. You have to come up with a rule that suites your needs with the 'any' protocol (i.e. '*').
Instead of using ICMP, when you want to test network connectivity I would suggest to use some TCP protocol based tool like Test-NetConnection and create proper rules in the NSG to let the network traffic pass.

Related

One Azure vNET peering with multiple vnets that are using the same address space

I am a beginner with azure vnet peering, so please indulge me if this is such an obvious question.
I would like to vnet peer one vnet to multiple vnets. All those vnets however uses the same address space. Let me explain more with examples.
Let's say vnet_source is the one that will peer with some existing vnets.
vnet_source > 192.168.0.0/16 for example
vnet1> 10.0.0.0/16
vnet2> 10.0.0.0/16
vnet3> 10.0.0.0/16
Would this be possible? For one vnet (vnet_source) to peer with other vnets that are using the same address space, in this case (vnet 1,2, and 3)?
and if so is there a routing trick that can identify, that in this case 10.0.1.81 for example ip address belongs to vnet1 and not.
Any help would be highly appreciated!
Thank you so much.
I am still in the planning phase, so have not tested yet.
Unfortunately it is not possible to implement vnet peering between vnets with same address space.
There are likely to be address conflicts (same IP address used in both locations) and
Azure Route tables won't be able to decide where to send the traffic.(VM with IP 10.0.0.10 from vnet1, vnet2 or vnet3?)
https://community.cisco.com/t5/other-collaboration-subjects/the-best-way-to-connect-2-lan-s-with-the-same-ip-addresses/td-p/2724403
It is important to use unique IP address spaces for each virtual network used in Azure so that routing can occur between virtual networks.
If virtual networks have the same IP address space it would not be possible to route traffic between resources from different vnets.
https://superuser.com/questions/1661852/can-two-networks-connected-to-a-router-both-have-a-host-with-the-same-ip-address
L2 forwarding can solve this problem but Azure does not support it for peering.
https://blog.ipspace.net/2019/11/stretched-layer-2-subnets-in-azure.html

VMs in separate subnet can ping each other

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

Virtual network peering connection azure

I have the following three virtual networks: - VNETa - VNETb - VNETc All the network traffic between the three virtual networks will be routed through VNET1a.
need to create the virtual networks, and then to ensure that all the Azure virtual machines can connect to other virtual machines by using their private IP address.
The solutions must NOT require any virtual gateways and must minimize the number of peerings. What should you do from the Azure portal before you configuring IP routing?
You could make peering between VNETa and VNETb, peering between VNETa and VNETc. Without a virtual network gateway and without a separate peering connection between those spokes VNETb and VNETc, to make the spoke connectivity, you need to deploy a virtual appliance as the hub in the network VNETa, then make two UDRs in each spoke VNets VNETb and VNETc to route traffic from one spoke network to another spoke network via NVA. In this scenario, you must configure the peering connections to allow forwarded traffic. see the explanation link.
For more details of UDR configuration, you could refer to this blog about Azure Networking - Hub-Spoke with NVA and Azure Firewall
The key to answering this question is to understand that the question is indicating that an IP routing solution will be configured after you have provisioned the necessary resources and configured appropriately: "...before you configure IP routing".
You do not need a gateway subnet or virtual gateways to implement a hub and spoke topology assuming that you are going to provision, for example, a VM with IP Forwarding enabled on the vNIC to act as a router.
Create your 3 subnets, in your example VNETa, VNETb and VNETc
From VNETa, create a peering with VNETb using the Resource Manager Deployment Model
Ensure "Allow forwarded traffic from VNETa to VNETb" is enabled
Repeat steps 2 & 3, substituting VNETb for VNETc
And that's it. Now when you configure IP routing you will provision a router VM or some other Network Virtual Appliance (NVA) in the hub network and create a Route Table for later application to VNETb and VNETc specifying the router VM's internal IP as the next hop.
Jamie.

Forced tunneling for VNet peered network

I have a VNet with on-premise S2S VPN and forced tunneling configured. This is the hub for my hub-spoke network where the spoke networks are Vnet peered to the Hub. I would like to know how I can enforce 'forced tunneling' for the peered spoke Vnets. Do I need to create a route in each subnet for 0.0.0.0/0 traffic with next hop 'Virtual network gateway'?
Do I need to create a route in each subnet for 0.0.0.0/0 traffic with
next hop 'Virtual network gateway'?
Yes, you should add the route rule AddressPrefix "0.0.0.0/0" and NextHopType VirtualNetworkGateway for each of subnets. Then any outbound connections from these subnets to the Internet will be forced or redirected back to an on-premises site via the S2S VPN tunnels.
Ref: Configure forced tunneling using the Azure Resource Manager deployment model

Azure Load Balancer + NSG Rules - Remove Access Directly

I've got a networking question for one of my customers servers in the cloud.
We are using just a standard 2012R2 VM with a few endpoints set up through the NSG Firewall, and we have a LoadBalancer infront of the network with a few ports forwarded to the same VPC.
The reason we are using a load balancer with port forwarding is because I'm finding countless records of bots trying to hit 3389 and 21 with attempts to break in.
So I have tried to change the source setting in the NSG rule to AzureLoadBalancer with the hope that it will only allow access to traffic that has come via the LoadBalancer on the external ports.
But for some reason this is not the case?
Is there a proper procedure for restricting traffic to a VM via the NSG from a LoadBalancer?
Any help with this is greatly appreciated.
Thanks
The NSG can’t be associated with Load balancer, NSGs can be associated with either subnets or individual VM instances within that subnet, so we can’t use NSG to block inbound IP address from the internet.
To protect the VM (with a public IP), we can deploy Linux VM, use IP tables work as a firewall. Also you can search some third party firewall product in Azure Marketplace.
Update:
To protect your VM, you can use NSG to allow the source IP address range to access your VM. NSG->Add inbound security rule->advanced->source IP address range.
Looking a the LB troubleshooting doc:
https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-troubleshoot
You have:
-Also, check if a Deny All network security groups rule on the NIC of the VM or the subnet that has a higher priority than the default rule that allows LB probes & traffic (network security groups must allow Load Balancer IP of 168.63.129.16).
If you create your NSG rule and only allow from 168.63.129.16 you should be set. The Azure load balancer will always come from that address no matter what your frontend IP is.

Resources