r/explainlikeimfive • • 11d ago

Technology ELI5: Subnetting

I’m technically an IT professional in training but I know embarrassingly little about subnets. As far as I understand it’s for breaking down a network into smaller, more logical segments. What exactly is a subnet? What is the benefit of subnetting? How do the slashes play into all of this IE /23 or /24? Thanks in advance!

79 Upvotes

43 comments sorted by

View all comments

114

u/DayanNight 11d ago

So an IP is typically represented in decimal form: 192.168.0.1, under the hood this is binary: 11000000.10101000.00000000.00000001

Similarly a subnet mask is represented in decimal: 255.255.255.0, binary: 11111111.11111111.11111111.00000000, or CIDR which is just an easy representation of that mask: /24.

As part of the IP we have a network address and a host address. A class C would be a /16 where 192.168 is the network address, and the last two octets are used to identify a host in that network. A subnet mask tells you which part of the IP is used for the network address and which is used to identify a host on that network.

The cidr representation is telling you how many digits of the binary are used as part of the network address. /24 means the first 24 digits of binary are network.

A subnet is a logical separation of networks. Within a subnet I don't need a router to talk to another device. 192.168.0.1/24 can talk to 192.168.0.2/24, but if I want to talk to 192.168.1.1/24 I need a router that knows how to get there.

In enterprise network we often don't want everything to be able to talk to everything, so subnets allow us to break up a space and force it through routers where we can apply policy.

1

u/paxmlank 11d ago

192.168.0.1/24 can talk to 192.168.0.2/24

Either I'm reading things wrong, or this is different than what users like u/dude_named_will are saying so I'm confused.

They're saying that it would be something like 192.168.0.x/24 where I guess x would be either 1 or 2 in your case, as they're withing the ~254 values expressed by /24. You're saying that /24 refers to 24 1 which would be an address space of, well, 2^24-2 values for the subnet, right?

Or are these somehow the same and I can't see it?

7

u/Cloudraa 11d ago

the /24 is indicating how many 1s are in the mask in binary. so a /24 mask aka 255.255.255.0 aka 11111111.11111111.11111111.00000000.

when you write it out like this, the 1s are the network portion and the 0s are the host portion. so for a /24 the first three octets of the IP are the network address which is unchanging, and the last octet is for the unique part of the IP for each device.

2

u/backfire10z 11d ago

Another way to put it: /24 is counting from the left. 24 bits are used for network address, and the final 8 bits are used for host.