AWS

How to Tell if the Subnet is Public

A public subnet is one that can access an open internet connection because of the network configurations given in it while creating it. To identify whether the subnet is public or not, it is important to understand the difference between the public subnet and other types of subnets.

How to Tell if the Subnet is Public or Not

There are 3 types of subnets. To identify any type of subnet in the VPC network, the difference between all the types must be understood first:

  • A Public Subnet has a connection or route toward the internet on the gateway associated with it.
  • A Private Subnet cannot connect to the public internet, and there is no public route or address on the gateway associated with it.
  • VPC-Only Subnet has a site-to-site VPN connection but no public internet gateway.

Now, it is clear that the public subnets are the ones that have a public route, and the public route is present on the gateway associated with that subnet. So, in order to check whether the subnet is public or not, we need to look at the gateway associated with it.

The IPv4 and IPv6 addresses of the subnets say all about the subnet, whether it is public or private.

Here, the public subnets have the addresses 10.0.0.5, 10.0.0.6, and 10.0.0.7. The zeros at the third place of the IPv4 addresses declare it as a public subnet.

On the other hand, the private networks have addresses 10.0.1.5, 10.0.1.6, and 10.0.1.7. Here we can point out the difference as the private subnet has 1 as the third number in the IPv4 addresses.

Structure of a Public Subnet

Let’s create a public subnet for a better understanding of the structure and components of a public subnet.

Go to the VPC in AWS Services and then create a new VPC. Set the IPv4 address as public. Here we set it as 10.200.0.0/16 to make it public.

The VPC has been created. Users can see it in the list of VPCs.

Now, create a gateway associated with it, by creating the gateway and connecting it to the subnet.

Users manually attach the gateway to the subnet to create a link or connection between them.

Now, Create the subnet of the declared VPC.

In the route table settings, declare the gateway connection with the recently created VPC.

The gateway of the subnet makes it clear that the created subnet is Public.

In the list of all the subnets, when we click on a particular subnet and then click on the gateway. It displays the gateway associated with that subnet and displays the destination containing an IPv4 address. That IPv4 address with 0 as the third number can make the users know whether the particular subnet is public or not.

Conclusion

To identify whether the subnet is public or not, we need to understand the architecture of the gateway associated with it. The public subnet has a route to the public internet unlike other types of subnets. The destination or the IPv4 address will have zero as its third number or the number right after the second point of the IPv4 address.

About the author

Abdul Mannan

I am curious about technology and writing and exploring it is my passion. I am interested in learning new skills and improving my knowledge and I hold a bachelor's degree in computer science.