VMs getting connect to Internet without having Public IP or NAT gateway

Sunil Poojari 0 Reputation points
2023-07-27T09:37:20.7866667+00:00

I have created VM with out assigning Public IP or NAT Gateway.

just in NSG out bound it has 0.0.0.0/0 . which allowing the VM to communicate on internet without public IP, which big risk. Please suggest on it. And I don't want to block out bound 0.0.0.0/0 . As I need to perform some test with AZURE and AWS .

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

2 answers

Sort by: Most helpful
  1. msrini-MSFT 9,276 Reputation points Microsoft Employee
    2023-07-27T12:02:31.6333333+00:00

    Hi, This is the default behaviour in Azure as when you deploy a VM without public IP, you can still get access to internet via Azure platform. But that is only for outbound. From Internet, your VM will not be accessible. If you don't want outbound traffic to reach internet, you can use NSG to block it or deploy services like Azure Firewall to restrict outbound traffic.

    1 person found this answer helpful.

  2. Andreas Baumgarten 104K Reputation points MVP
    2023-07-27T12:05:25.8333333+00:00

    Hi @Sunil Poojari ,

    every Azure is able to connect with the internet (outbound communication) by default.

    The option you have is to use Network Security Groups (NSG) associated with the subnet (affects all VMs in the same subnet) or individual VMs (NSG will be associated with the NIC of the VM) .

    Another option might be to use a Firewall or NAT Gateway to manage internet access of Azure VMs.

    To allow connections with AWS and deny connections to the rest of the internet you can add different rules with different priorities to the NSGs:

    • Higher priority (lower number) to allow communication with AWS
    • Lower priority (higher number) to deny communication with 0.0.0.0

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    1 person found this answer helpful.
    0 comments No comments