this post was submitted on 25 Mar 2024
85 points (96.7% liked)

[Outdated, please look at pinned post] Casual Conversation

6593 readers
1 users here now

Share a story, ask a question, or start a conversation about (almost) anything you desire. Maybe you'll make some friends in the process.


RULES

Related discussion-focused communities

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 7 months ago (2 children)

The class notation is still meaningful. If we were talking about your particular network mask I might ask you what class it is. Telling me would give an understanding of size or hops or whatever. Granted, it is class C 99% of the time. Probably smaller. But then I’m certainly no networkologist.

[–] [email protected] 2 points 7 months ago (2 children)

I still don’t understand what a network mask is

[–] [email protected] 1 points 7 months ago* (last edited 7 months ago)

Lemme try: an IP is the address of your computer and only a single number. If you want to group clients you have to define a way to separate these 32bit number into a part that defines the group and a part that defines the number of the client in that group. That's what the netmask is for. Example:

IP: 10.0.0.1

Netmask: 255.255.0.0

In binary this gets more clear:

IP: 0000 1001.0000 0000.0000 0000.0000 0001

Netmask: 1111 1111.1111 1111.0000 0000.0000 0000

The netmask is always a bunch of 1 first, then 0 until you got 32 of it. 1 define the parts of the IP that define the group, 0 the client.

10.0 is the group, 0.1 is the number of the client in our example. All clients which IP begin with 10.0 are in the same group and can talk to each other without needing a router.

[–] [email protected] 2 points 7 months ago

This is simplified, like it assumes routers handle everything when that's not really the case but hopefully it still illustrates the idea.

Your network might have 5 devices connected to it. To uniquely represent those 5 devices, they need 5 addresses. If all that exists is your own network, then any 5 addresses would work, as long as they are unique. 0.0.0.0 through 0.0.0.4 would work.

But your network is connected to a larger network, probably your ISP's network. Let's say your ISP also has 5 clients. If they gave their clients the 0.0.0.0 through 0.0.0.4 addresses, they would clash with your own network addresses. So maybe they'd use 0.0.0.0 through 0.0.4.0 instead.

Your ISP is also connected to another network, which is connected to another one, and so on.

Each destination on the large network made up of all these smaller networks needs to have a unique address for other devices to find them. Part of the address will be assigned by higher level routers and part of it will be assigned by the router directly connected to the device.

The subnet mask (or network mask) basically lets the router know which parts of the address have been assigned to it by higher powers and which ones it can use to assign unique addresses to its own clients. It's a bit mask where each 1 means the higher network "owns" that bit in the address (and the router can't change it for any of its clients) and a 0 means the router can use that bit to uniquify its own clients.

So a subnet mask of 255.255.255.0 means that the first three numbers of that IP address have been assigned to the router and the last one is free for it to assign to up to 256 clients.

If ( ( myaddress xor targetaddress ) bitwise-and mask ) gives a non-zero result, then the address isn't on the router's client network and the packet needs to be sent upstream. If it gives a zero, then ( not ( mask ) bitwise-and targetaddress ) will give a number that can be used to look up the physical port (or wifi info) that the router needs to use to make contact with the destination.

[–] [email protected] 10 points 7 months ago

A subnet is defined by its netmask. Classes are useless nowadays IMHO.

At least for me they created more confusion than anything else. Why are there classes if the netmask defines the subnet size? Because there was a time before netmasks, just ignore them