0

Im trying to understand what subnetting is and how it works, but im pretty confused.

So, from my understanding subnetting is when you take a public ip address assigned to a network, and you can then take this address and use the Network ID portion to create different sub networks, and then use the Host ID portion to identify different hosts on that subnetwork. My question is, how that hell dose that work when your network is assigned a single public IP?? If for example my router's assigned public IP address is 30.52.165.0, could i have a subnet with an IP of 30.52.166.0, and then have a device on that subnet with an IP of 30.52.165.0? And if thats true, wouldnt that pollute the public IP address space? And what would the purpose of private IP addresses be then?

Sorry, im not sure how to even ask this question. I just want to know what subnetting does, and if im looking at this completley wrong.

3
  • P.S, I also know NAT exists, and basically what it dose is it temporarily substitutes the source address of an IP packet from a host on the network, for its one public address so that IP address space is saved. Why the hell would we need subnetting then? Do they solve different issues?
    – Keylime Pi
    Jan 2, 2022 at 16:00
  • Every IPv4 network is a subnet of 0.0.0.0/0.
    – Ron Maupin
    Jan 2, 2022 at 16:22
  • the goal is to assign addresses hierarchically. We had a long discussion on how this is supposed to work in this question
    – Effie
    Jan 2, 2022 at 16:28

2 Answers 2

1

Basically, you take any single private or public network and you create multiple networks from it (to provide addresses for different locations, security zones, better scaling, ...).

how [..] does that work when your network is assigned a single public IP?

It doesn't. You need a network to start with.

If for example my router's assigned public IP address is 30.52.165.0, could i have a subnet with an IP of 30.52.166.0 ...

The IP address your router uses to talk to its uplink might not be related to what's routed over it at all.

And what would the purpose of private IP addresses be then?

Private addresses are agreed upon to not be used on the Internet. You can use them freely as you wish without creating any ambiguity for your network. However, you must not use them on any outside interface - you need to translate or obscure them in any way you see fit (NAPT, proxy, ...).

Of course, you can use a private network like 10.0.0.0/8, subnet that across dozens or even hundreds of locations around the world, and hide all that behind a single public IP address.

13
  • 1
    "You need a network to start with", i think "address range" is a better term for this
    – Effie
    Jan 2, 2022 at 16:29
  • "Of course, you can use a private network like 10.0.0.0/8, subnet that across dozens or even hundreds of locations around the world, and hide all that behind a single public IP address." - In response to this statement, could you explain how that would work?
    – Keylime Pi
    Jan 2, 2022 at 17:10
  • would 10.0.0.0 be the public ip, and 10.0.1.0 or 10.0.25.43 or anything the like could be subnets of it?? And if so, would 10.0.0.1 to 10.255.255.255 all potencially be subnets or hosts of that network? And if so, wouldnt that be a huge waste of public IP values?
    – Keylime Pi
    Jan 2, 2022 at 17:13
  • @Effie Well, the address range needs to have a common prefix, so it's actually a network, seen from afar. Of course, it all depends on nomenclature.
    – Zac67
    Jan 2, 2022 at 20:12
  • 1
    @Effie 0 is a value, too. ;-)
    – Zac67
    Jan 2, 2022 at 22:01
-1

The goal of subnetting is to lower the distance data packets need to travel in the network. In doing so, devices can communicate more efficiently with smaller networks.

Subnetting reduces the heavy load on the same network and routes data more efficiently, not to mention it also boosts the network’s security and reduces IPv4 wastage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.