Getting Familiar with IP Addressing
Before understanding IP Address, we need to learn the binary numbers. If you are not familiar with binary and decimal conversion, look at the brief explanation below.
In the decimal number system, the combinations are made using only the numbers from 0 to 9. In other words, it is the number system with a base of 10 (0 to 9). Similarly, in the Binary Number System base of 2 (0 and 1) is used. Each value in a binary number is made with 2N (‘N’ is the place value that increases from right to left). The below table shows the basic conversion between binary and decimal.
Binary | Conversion | Decimal |
---|
000 | 0x22+0x21+0x20 | 0 |
001 | 0x22+0x21+1×20 | 1 |
010 | 0x22+1×21+0x20 | 2 |
011 | 0x22+1×21+1×20 | 3 |
100 | 1×22+0x21+0x20 | 4 |
101 | 1×22+0x21+1×20 | 5 |
What is IP Address?
IANA is the Internet Assigned Numbers Authority that manages and assigns the IP address in the world. IP Address identifies each device on a network uniquely. There are currently two IP Adress that is IPv4 and IPv6. An IPv4 address contains a total of 32 binary bits divided into 4 equal octets (8-bit block), whereas IPv6 is written in hexadecimal notation, separated into 8 groups of 16 bits by the colons, thus (8 x 16 = 128) bits in total. We will focus on IPv4 as it is the most used. Each octet of an IP Address is separated by a decimal and ranges from 0 to 255. You will clearly understand the binary number, octets, and IP address formation in the below table.
IP Address | Octet 1 | Octet 2 | Octet 3 | Octet 4 |
---|
10.2.7.4 | 00001010 | 00000010 | 00000111 | 00000100 |
192.124.249.161 | 11000000 | 01111100 | 11111001 | 10100001 |
255.255.140.40 | 11111111 | 11111111 | 10001100 | 00101000 |
There are two different IP address one is private, and the other is public.
- Private IP is accessed only within a network like a simple school network with a LAN connection.
- Public IP is accessed globally via the Internet.
The table below shows the Private IP address range assigned by IANA, and the rest are all Public IP address.
Private IP Range |
---|
10.0.0.1 – 10.255.255.255 |
172.16.0.0 – 172.31.255.255 |
192.168.0.0 – 192.168.255.255 |
What is IP Subnetting?
Subnetting is the process of dividing a network into many smaller networks. There are 5 classes of IP address and each with a unique purpose. Only the first octet is used for dividing an IP Address into different classes. The table below shows the range of IP address of the 5 classes.
Class | Octet 1 Range (in Binary) | Octet 1 Range (in Decimal) |
---|
Class A | 00000000-01111111 | 0-126 |
Class B | 10000000-10111111 | 128-191 |
Class C | 11000000-11011111 | 192-223 |
Class D | 11100000-11101111 | 224-239 |
Class E | 11110000-11110111 | 240-255 |
Class D is reserved for multitasking and broadcasting purpose, whereas Class E is reserved for research and development. So both these classes are reserved and can not be used. The below table shows the range of the first octet in an IP address with each class.
An IP address can further be divided into small networks depending on the use and purpose. The above classes are not sufficient for real-life use. Only 5 classes can not hold all the hosts on the same network, and the loss of IP address will be huge. So, the CIDR method was introduced.
CIDR (Classless Inter-Domain Routing)
CIDR is a method for allocating IP Address. Using this method, we can apply a subnet mask to an IP Address. This mask defines the number of bits used as a network, and the host will use the other bits that left. To understand CIDR better, we will decode a simple IP address with a subnet mask.
Suppose 192.168.1.30/28 is an IP address with 28 as the subnet mask. By comparing with IP address classes in the above table, this IP comes under Class C. Now, 24 bits are made of 3 octets, so the network will take four extra bits from the next octet to complete 28 bits. Using 2N(‘N’ is the number of borrowed bits from the host), a total of 16 subnets is formed. After taking the four bits, the last octet is left with only 4 bits that a host will use. Using 2H(‘H’ is the number of host bits left), each subnet will contain a block of 16 IP address. The first and last IP is reserved for network and broadcast in each subnet, so the total number of hosts will be 2H-2(‘H’ is the number of host bits) equals 14.
Although a total of 16 subnets or network are possible for this example, the table below listed the initial 4 subnets that can be formed using 28 as the subnet mask. Each subnet contains a total of 16 IP address, and the number of hosts will be 14 as the other two are reserved for network and broadcast.
After comparing the IP given in the example that is 192.168.1.30/28 with the table below, it is clearly visible that it belongs to the second subnet ranging from 192.168.1.16 to 192.168.1.31.
SubNet | Total IP | Network IP | Broadcast IP | Range of Hosts | Total Hosts |
---|
1 | 16 | 192.168.1.0 | 192.168.1.15 | 192.168.1.1-192.168.1.14 | 14 |
2 | 16 | 192.168.1.16 | 192.168.1.31 | 192.168.1.17-192.168.1.30 | 14 |
3 | 16 | 192.168.1.32 | 192.168.1.47 | 192.168.1.33-192.168.1.46 | 14 |
4 | 16 | 192.168.1.48 | 192.168.1.65 | 192.168.1.49-192.168.1.64
| 14 |
IP Address in Azure
The two different types of IP Address used and allocated in Azure are Public IP and Private IP.
- Private – The Private IP address allows communication of resources within the azure resource group. In other words, resources can not access a private IP outside the network. The resources that can be connected using a private address are VM Network Interface, ILB (Internal Load Balancer) and Application Gateway.
- Public – The Public IP address allows Azure Resources to communicate with public-facing Azure services via the Internet. In other words, resources can access public IP outside the network. Some resources that can be connected using public address are VM Network Interface, Public Facing ILB, Application Gateway, VPN Gateway and Azure Firewall.
IP Allocation
- Dynamic IP – The default allocation method by which Azure can automatically assign the available and unreserved IP address from the subnet’s address range. Also, the Dynamic IP is not fixed and changes with time.
- Static IP – This is the custom allocation method to assign the available and unreserved IP address from the subnet’s address range. The Static IP is fixed and does not vary with time.