In this article, you will learn about basic concepts of Virtual Networking in Azure. We will have a good look into Standard Networking Principles and, later on, dive into the Azure Concepts.
Standard Networking Principles
A network is an interconnection of computers used to transmit/exchange information. If you want to transfer data between two different computers or from the computer to the Internet, you need to have an IP address. So let’s see about IP addressing.
An IP addressing identifies a device, network, virtual machine, etc.
2 Types of IP addressing are available right now.
- ►IP V4
- ►IP V6
We will cover the IPv4 addressing as it is the most used while deploying networks.
- ►IPv4 address is a 32-bit number that identifies a network device.
- ►The 32 bits are divided into four octets.
- ►There are five classes in IPV4.
- Class A — 0 to 126
- Class B — 128 to 191
- Class C — 192 to 223
- Class D — 224 to 239
- Class E — 240 to 255
We will take a more in-depth look into the different classes in the upcoming articles.
Now, all IPV4 addresses can be divided into two major groups.
Public IP Address:
A public IP address is assigned to every device that connects to the Internet, and each Public IP is unique.
Example: 172.217. 22.14
Private IP Address:
Private IP addresses are not routed on the Internet, and traffic cannot be sent to them from the Internet, they are supposed to work in local networks like virtual machines.
Three ranges are allowed for private network use by the IANA.
- 192.168.0.0/24 →172.16.0.0/16 →10.0.0.0/8
So we can only choose any of the above IP Addresses to range for our private use.
Now let’s dive into the exciting part, which will cover
- ►Subnet mask representation
- ►Usable and Overall IP address range of a CIDR Block.
Let’s take an example as below.
192.168.0.0/24 → CIDR Block.
There are three challenges we have to face for the above CIDR Block.
How do we find the overall IP address range of a CIDR block?
- ►The formula to find the overall ip address range of the CIDR block is 2^n.
- ►Since we are dealing with IPV4 addresses, so you have to minus the subnet mask from 32. [Subnet mask = 24 in the above question]
- ►So n = 32–24 = 8 , applying the formula 2^n = 2⁸ = 256.
Therefore, the overall ip address range of the above CIDR block is 256 IP addresses from 192.168.0.0–192.168.0.255
How do we find the usable ip address range of a CIDR Block?
- ►The formula to find the overall ip address range of the CIDR block is 2^n-2
- ►Applying the formula gives us = 256–2 = 254.
Why -2, that’s because the broadcast address and network address of any CIDR block cannot be used.
In the above CIDR block, the Network address is 192.168.0.0, and the Broadcast address is 192.168.0.255. So we have to minus both of them, which results in us in 254 ip addresses usable.
How can we find the subnet mask representation of a CIDR Block?
- ►First, make sure to know the subnet mask, which is 24 in our example.
- ►Convert it into 4 octets i.e 24 = 8+8+8+0
So the subnet mask of the CIDR block is 255.255.255.0.
Look through the Subnet mask tables of different classes from the Internet and change them to binary and play around with some real-life problems and you will be good to go when it comes to subnet masks.
How to write the IP address 22.214.171.124 mask 255.255.255.192 in CIDR notation?
Take the 192 part in the subnet mask and change it into binary and the subnet mask representation has 24 network bits, i.e., 8+8+8+?
192 = 11000000 binary, which means 2 bits of this octet are used for the subnet.
So adding the 2 bits, we have got, 24 + 2 = 26 bits.
So the CIDR notation will be 126.96.36.199/26
We have now completed the standard networking principles and will dive into Azure Virtual Networking concepts.
Azure Virtual Networking Concepts
We have seen an example before; now, we will take the same sample and see how it’s different when it comes to Azure networking.
192.168.0.0/24 → CIDR Block.
There are two challenges we have to face for the above CIDR Block.
- 1. What is the overall ip address range of the above CIDR block?
- 2. What is the usable ip address range of the above CIDR block?
The overall ip address range formula remains the same, i.e., 2^n, but when it comes to the usable ip address range, we have to subtract five addresses from the comprehensive ip address range.
Why -5? Because Azure automatically removes five addresses for the following purposes for every ip address range.
- ►Broadcast address
- ►Network address
- ►Router Address
- ►One address is reserved for future use.
So, the overall ip address range for above CIDR block is = 2^n = 2⁸ = 256
Usable ip address range = 2^n — 5 = 256–5 = 251
The IP addresses that can’t be used are as below:
Remember : Every subnet you create in Azure , Microsoft will deduct 5 ip addresses from the subnet ip range.
Real-Life Scenario for Virtual Networking in Azure.
You are given a task to create 50 servers today, and 50 servers may be needed for the company for future usage after five years. There are also two departments, which means each department must have a total of 200 servers deployed.
Total requirement = 50 + 50 = 100 servers = 100 * 2 = 200 servers.
Total Departments = 2 = 2 subnets.
So we need to have 200 ip addresses assigned to 200 servers.
We need to see which range is required for the above task, i.e., start checking with subnet mask 24.
Take any of the private ip address range with subnet mask 24 – 192.168.0.0/24
The above CIDR block will give us 256 overall ip addresses, but it’s 256/2 = 128 ip addresses overall when we want them for two departments. If we minus it again by 5, we get a total usable ip address for each department as 128–5 = 123 ip addresses. Our task is to create 200 servers for each department, so we need a minimum of 200 private ip addresses.
So /24 subnet mask cannot be used; let’s check with /23 – 192.168.0.0/23
Overall ip range = 2^n = 2⁹ = 512
Divide it by 2 as we have 2 departments = 512/2 = 256
Now find the usable ip range, i.e., 256–5 = 251 ip addresses.
So now we have 251 ip addresses available for each department, which is what is needed.
So The Virtual network we will create is
192.168.0.0/23 → VNET
The subnets we will create is
192.168.0.1/24 → Subnet 1.
192.168.0.2/24 → Subnet 2.
After you create the virtual network, ensure that the virtual network and virtual machines being deployed are in the same region.
I also run a small youtube channel on some exciting topics, do look into it. 🙂
We will see more about Virtual Networking in Azure in the next article. 🙂