What is network security groups?

A network security group allows us to manage the network traffic to NIC or subnets etc. The network load will be distributed as needed if it is connected wisely.

Network Security Groups (NSGs) in Microsoft Azure are a crucial component of the network security model. NSGs act as a basic, distributed firewall for controlling inbound and outbound traffic to network interfaces (NIC), VMs (Virtual Machines), and subnets within Azure. They allow you to filter network traffic to and from resources in an Azure Virtual Network.

Key aspects of Network Security Groups include:

  1. Filtering Rules: NSGs contain a set of rules that allow or deny inbound or outbound network traffic based on source or destination IP addresses, port ranges, and protocols.
  2. Priority: Rules are evaluated based on priority, where the rule with the lowest number takes precedence. If a rule allows traffic, the evaluation stops, and the traffic is permitted. If no rules allow the traffic, it is denied.
  3. Association: NSGs can be associated with subnets, network interfaces, or both. When associated with a subnet, the rules apply to all resources within that subnet. When associated with a network interface, the rules apply specifically to the associated VM.
  4. Stateful Filtering: NSGs are stateful, meaning that if you allow outbound traffic for a particular connection, the corresponding inbound traffic for the established connection is automatically allowed.
  5. Default Rules: Each NSG comes with default rules that allow outbound traffic and deny all inbound traffic. These default rules can be modified or supplemented with additional rules.

In summary, Network Security Groups are a fundamental tool in Azure for managing and controlling network traffic, helping to enhance the security posture of your Azure resources.