Search code examples
network-programmingipv4

How cloud public ipv4 works


How public ipv4 addresses works in any cloud service.

Let consider GCP,

If all the Virtual Machines has public IPv4 addresses then IPv4 will runs out, because it has some limit but we can create a lot of machines on the cloud.

Same goes with either AWS or Azure.

So how they manage the IPv4 addresses?


Solution

  • A simple answer to your question is that cloud service providers like Azure, AWS, etc. have a pool of public IP addresses. These IP addresses are assigned to VMs when required and are released when your job is done.

    You need to understand few things about IPv4 addresses.

    1. There are two types of IPv4 addresses: Public IP address and private IP address
    2. You can use only public IP addresses on the Internet. (Private IP addresses can be used only inside your network or company)
    3. Every machine on the internet must have a unique IP address.

    If you assign public addresses to every device (VMs) then they will get extinct. To overcome this problem we can use private IP addresses. Same Private IP addresses can be used by different organization at the same time. But what about the uniqueness? There comes the concept of NAT.

    NAT allows you to use private IP addresses within an organization or your network and also allows you to communicate over Internet.

    You can read more about NAT over here

    In depth knowledge about NAT over here