Tuesday, January 15, 2019

How to choose IP address range for resources for AWS virtual private cloud

You will often need to allocate  an IP address range when you design the network of an AWS VPC.
Since VPC is a small network of resources(EC2, RDS etc.) you can use IPV4 private addresses.
There are 3 classes of private IP Addresses.
 ClassPrivate Networks Subnet Mask
 A10.0.0.0255.0.0.0
 B172.16.0.0 - 172.31.0.0255.240.0.0
 C192.168.0.0255.255.0.0

For this post I choose IP addresses starting from 10.0.0.0.


IPv4 Address has four fields separated from dot like below.

xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx

ex : binary form : 11111111.11111111.11111111.11111111
       decimal form : 255.255.255.255

Each field can be varied from 0000 to 1111. That is from decimal, 0 to 255 and we have 32 bits in IP address.

IP address can be divided into two parts.

1. Host portion
2. Network portion

The network portion of the address is the part of IP address which is reserved to identify the network. The host portion of the address is the part of IP address which is reserved for the individual resources on the network.

Let's say I want allocate IP address range for 256 machines.

Then it can be represented as 10.0.0.0/24. This is called CIDR notation. In CIDR notation we can say what IP address slot is reserved for the resources in network. In our example 24 means first 24 bits are reserved for the network part of the IP addresses and rest 8 bits are reserved for host part of the IP addresses.

That means 10.0.0.0 to 10.0.0.255 can be taken from any computer in the network.

ex: 10.0.0.1 , 10.0.0.2 etc.

bit division in cidr

So 10.0.0 will be unchanged and can be used to identify the network.

Hope this helps. Please post a comment if something unclear.

Thank you.

No comments:

Post a Comment

How to choose IP address range for resources for AWS virtual private cloud

You will often need to allocate  an IP address range when you design the network of an AWS VPC. Since VPC is a small network of resources(E...