4.1.1.4. Configure VM Networking
š” First Principle: Configuring a VM's network interface is the fundamental act of establishing its identity and communication pathways within a virtual network, enabling secure and controlled traffic flow.
Scenario: You are deploying a web server VM in Azure. It needs to communicate with a database VM in a different subnet, receive inbound HTTP/HTTPS traffic from the internet, and only allow SSH access from a specific IP range for administration.
What It Is: VM networking involves configuring the network interfaces, IP addresses, and security rules that allow your Virtual Machine to communicate.
Key Components:
- Network Interface (NIC): Connects the VM to a Virtual Network (VNet).
- Virtual Network (VNet) & Subnet: The logical network and its subdivisions where the VM resides.
- Public IP Address: Optionally assigned to a NIC for direct internet access.
- Network Security Group (NSG): Acts as a virtual firewall, filtering inbound and outbound traffic at the NIC or subnet level.
Configuration Overview:
- Attach a NIC: When deploying a VM, select or create a NIC and associate it with the appropriate VNet and subnet.
- Associate a Public IP: Link a public IP to the NIC if the VM needs internet access.
- Apply NSGs: Assign NSGs to NICs or subnets.
Visual: Azure VM Network Configuration
Loading diagram...
ā ļø Common Pitfall: Attaching a Network Security Group only at the subnet level and not at the NIC level. While subnet-level NSGs are good for broad policies, NIC-level NSGs provide a crucial second layer of defense for individual VMs.
Key Trade-Offs:
- Accessibility (Public IP) vs. Security (No Public IP): Assigning a public IP makes a VM easily accessible but also exposes it to potential threats from the internet. Using services like Azure Bastion for access is more secure.
Reflection Question: How does configuring Azure VM networking with NICs, VNets/Subnets, and NSGs fundamentally establish secure, controlled, and efficient communication pathways for your VMs while adhering to the principle of least privilege?