Skip to main content

Virtual Network Configuration


Virtual Network Planning

One of the key benefits of adopting cloud solutions like Azure is that it enables IT departments to transition server resources to the cloud. Moving resources to the cloud can save costs and simplify administrative operations.

Relocating resources eliminates the need to maintain expensive data centers with uninterruptible power supplies, generators, multiple backup systems, or clustered database servers.

What to Know About Azure Virtual Networks

You can use Azure Virtual Network to create a virtual representation of your network in the cloud. Here are some characteristics of virtual networks in Azure:

  • Azure Virtual Network is a logical isolation of Azure cloud resources.
  • You can use virtual networks to provide and manage virtual private networks (VPNs) in Azure.
  • Each virtual network has its own Classless Inter-Domain Routing (CIDR) block and can be connected to other virtual networks and on-premises networks.
  • You can connect a virtual network to on-premises infrastructure to create hybrid or cross-site solutions, as long as the CIDR blocks of connected networks do not overlap.
  • You control DNS server settings for the virtual network and can segment the virtual network into subnets.

The illustration below shows a virtual network with subnets containing two virtual machines. The virtual network is connected to on-premises infrastructure and a separate virtual network.

Virtual Network

Things to Consider When Using a Virtual Network

Virtual networks can be used in various ways. When considering configuration plans for virtual networks and subnets, keep the following scenarios in mind:

ScenarioDescription
Create a private cloud-only virtual networkSometimes you don't need a cross-site configuration. When you create a virtual network, services and VMs within the network can communicate securely with each other in the cloud. You can still configure endpoints for internet-facing communication as needed.
Securely extend a data center with a virtual networkYou can build a traditional site-to-site VPN to securely extend data center capacity. A site-to-site VPN uses IPSEC to create a secure connection between the organization's VPN gateway and Azure.
Enable hybrid cloud scenariosVirtual networks provide flexibility to support hybrid cloud scenarios. You can securely connect cloud-based apps to any on-premises system, including mainframes and Unix systems.

Creating Subnets

There are specific rules regarding IP addresses within a virtual network when applying segmentation using subnets:

  • Each subnet contains a range of IP addresses that are part of the virtual network's IP allocation.
  • Subnet address ranges must be unique within the virtual network.
  • Subnet address ranges must not overlap with other subnets in the same virtual network.
  • Subnet IP allocations must be defined using CIDR notation.

You can divide a virtual network into one or more subnets using the Azure portal. Here are some key characteristics of subnet IP addressing:

Subnet

Reserved Addresses

For each subnet, Azure reserves five IP addresses—four at the beginning and one at the end.

Let’s review the reserved addresses in the 192.168.1.0/24 range:

Reserved AddressReason
192.168.1.0Identifies the virtual network itself.
192.168.1.1Configured by Azure as the default gateway.
192.168.1.2 and 192.168.1.3Reserved for Azure DNS services.
192.168.1.255Used as the broadcast address.

Things to Consider When Using Subnets

When planning subnet segments in a virtual network, consider the following:

Service Requirements

Some services may require or create their own subnet. Ensure there's enough allocation to meet the service's needs. For example, if you connect a virtual network to an on-premises network using Azure VPN Gateway, a dedicated subnet is required for the gateway.

Network Virtual Appliances

By default, Azure routes traffic between all subnets in a virtual network. You can override this default to prevent subnet-to-subnet routing or to route it through a network virtual appliance.

Network Security Groups (NSGs)

Each subnet can be associated with zero or one NSG. You can use the same or different NSGs for each subnet. An NSG contains rules that allow or deny traffic to/from specific sources and destinations.

Azure Private Link enables private connectivity from a virtual network to Azure PaaS services, customer-owned services, or Microsoft partner services. It simplifies the network architecture and secures connectivity by avoiding exposure to the public internet.


Creating a Virtual Network

info

You can create a new virtual network at any time, including when creating a virtual machine.

Key Requirements for Creating a Virtual Network

NoRequirement
1Define an IP address allocation for the virtual network.
2Use IP ranges not already in use in your organization.
3IP allocation can be for on-premises or cloud—but not both at once.
4Once defined, the IP allocation cannot be changed. Plan ahead if future on-premises connectivity is desired.
5Define at least one subnet when creating the network.
6Each subnet must have an IP range within the virtual network's allocation.
7Subnet address ranges must be unique within the virtual network.
8Subnet address ranges must not overlap with others in the same virtual network.
9Use the Azure portal to specify subscription, resource group, VNet name, and region.

Create vnet

Note:

Default limits on Azure networking resources may change. Refer to Azure networking documentation for the latest info.


IP Addressing Planning

You can assign IP addresses to Azure resources to communicate with other Azure resources, on-premises networks, and the internet.

  • Private IP addresses allow communication within Azure virtual networks and on-premises networks. Used when connecting via VPN Gateway or Azure ExpressRoute.
  • Public IP addresses allow resources to communicate with the internet. Use this for internet-accessible Azure services.

Below is an illustration of a VM with both private and public IP addresses.

design ip

What to Know About IP Addresses

  • IP addresses can be static or dynamic.
  • You may segment static and dynamic resources into different subnets.
  • Static IPs do not change and are ideal for:
Use CaseExplanation
DNS name resolutionIP changes require updating host records.
IP-based security modelsApps/services require consistent IP.
TLS/SSL certificates tied to IPCertificate becomes invalid if IP changes.
Firewall rulesRequire fixed IPs.
Role-based VMs (e.g., Domain Controller, DNS Server)Strongly recommended to use static IPs.
Tip:

Explore further with the "Design an IP addressing schema for your Azure deployment" module, which includes a sandbox for hands-on practice.


Creating Public IP Addresses

Considerations for Public IP Address Creation

Create ip pub

To create a public IP, configure the following settings:

SettingDescription
IP VersionChoose IPv4, IPv6, or Both.
SKUChoose Basic or Standard. Must match Load Balancer SKU if used.
NameUnique name within the resource group.
IP AssignmentChoose Dynamic or Static.

Explanation of IP Assignment Types

  • Dynamic IP

    • Assigned when associated with a resource and first powered on.
    • May change if the resource is deallocated and restarted.
    • Remains the same if restarted from inside the OS.
    • Released if disassociated from the resource.
  • Static IP

    • Assigned when the public IP resource is created.
    • Remains until the resource is deleted.
    • Can change assignment type only if unassociated.
    • May not be changeable if already in use.
Note:

If using IPv6, Dynamic assignment is required for Basic SKU.
For Standard SKU, both IPv4 and IPv6 are always Static.


Associating Public IP Addresses

Public IP resources can be associated with VM NICs, public-facing Load Balancers, VPN gateways, and Application Gateways. They can be either dynamic or static.

Public IP Association Summary

ResourceAssociation MethodDynamic IPStatic IP
Virtual MachineNICYesYes
Load BalancerFront-end configurationYesYes
VPN GatewayVPN Gateway IP configurationYesYes *
Application GatewayFront-end configurationYesYes *

*Static IPs only available with certain SKUs.

Public IP SKUs

You can choose Basic or Standard SKU when creating a public IP. The SKU affects assignment method, security, supported resources, and redundancy.

FeatureBasic SKUStandard SKU
IP AssignmentStatic or DynamicStatic only
SecurityOpen by defaultSecure by default (closed to inbound traffic)
ResourcesNIC, VPN Gateway, App Gateway, Public Load BalancerNIC or Standard Public Load Balancer
RedundancyNo zone redundancyZone-redundant by default

Allocating Private IP Addresses

Private IPs can be associated with VM NICs, internal load balancers, and application gateways. Azure can assign them dynamically or you can assign them statically.

Private IP Association Summary

ResourceAssociation MethodDynamic IPStatic IP
Virtual MachineNICYesYes
Internal Load BalancerFront-end configurationYesYes
Application GatewayFront-end configurationYesYes

Private IP Assignment

Private IPs are allocated from the subnet's address range where the resource is deployed. There are two options:

Dynamic

Azure automatically assigns the next available IP in the subnet. This is the default assignment method.

Example:
If 10.0.0.4 to 10.0.0.9 are already in use, Azure will assign 10.0.0.10.

Static

You choose and assign any unused or unreserved IP in the subnet.

Example:
In a 10.0.0.0/16 subnet, if 10.0.0.4 to 10.0.0.9 are used, you can assign from 10.0.0.10 to 10.0.255.254.

Tip:

For more in-depth learning, check the Introduction to Virtual Networks training module.