Subnet Masks are how you get networks. It’s simple binary ANDing math.
For example, if you have a 192.168.1.1 IP address and a subnet mask of 255.255.255.0, that means the first 3 octets (each block of numbers between the dots representing an 8 bit value) of 255 are the network part of the IP (192.168.1.0/24) and the fourth octet is the host addresses space of the address. It’s saying 192.168.1 is the network and the last number is the host on that network.
If you take 1 from 192.168.1.X and convert it to binary, you get 00000001. If you convert 255 to binary, you get 11111111.
If you line them up and “AND” them together sort of like you’re adding them together in a “both must be true” comparison, you get
00000001
11111111
00000001
A 1 and a 1 makes 1. Anything else makes a 0. Basically the 192 gets ANDed to 255 and comes out as itself. Same for 168 and 1.
For a 255.0.0.0 (or /8) 255.255.0.0 (or /16), and 255.255.255.0 (or /24) it’s easy, because it’s all 1s or 0s for each block of 8 bits of the 32 bits that make up an IPv4 address. Each block just plops out as itself or zero because it’s all 1s or all 0s for each of the 4 blocks.
Now try that with 23 bits instead of 24.
00000001 for the third octet “1” part of 192.168.1.1
11111110 for “254” part of 255.255.254.0 (aka a /23)
00000000 or 0 for the third octet.
This means that the network ID is 192.168.0.0/23 and the usable IP addresses are 192.168.0.1 through 192.168.1.254.
With a /23 network, you get 512 addresses instead of 256 with a /24 (192.168.0.0-192.168.1.256 versus 1.0 through 1.256). The first IP is the network ID and the last is the broadcast address, both of which are unusable, so you have 510 IP addresses in a /23 to use for devices instead of 254 with a /24.
This is how basic IPv4 subnetting works and it’s how you size various networks for things like Enterprise that needs more than a small home network of less than 254 devices.
Congrats. If you understood that, you now have enough knowledge to probably pass some network exams.
Thank you for this explanation! Now i finally understand what the “mask” part means! Any 0s will mask the IP address in the AND operation and tell the computer that address is not part of the network.
Glad I could help with learning a new thing! If you are curious on anything else networking, I’m a Network Engineer by trade and happy to share knowledge.
That’s another private range that was added for Carrier-Grade NAT that is part of RFC6598. It’s a non-Internet routable 100.64.0.0/10 subnet for things like WISPs, Satellite providers like Starlink, Tailscale, and cellular providers that are strapped for IPv4 addresses.
Subnet Masks are how you get networks. It’s simple binary ANDing math.
For example, if you have a 192.168.1.1 IP address and a subnet mask of 255.255.255.0, that means the first 3 octets (each block of numbers between the dots representing an 8 bit value) of 255 are the network part of the IP (192.168.1.0/24) and the fourth octet is the host addresses space of the address. It’s saying 192.168.1 is the network and the last number is the host on that network.
If you take 1 from 192.168.1.X and convert it to binary, you get 00000001. If you convert 255 to binary, you get 11111111.
If you line them up and “AND” them together sort of like you’re adding them together in a “both must be true” comparison, you get
00000001
11111111
00000001
A 1 and a 1 makes 1. Anything else makes a 0. Basically the 192 gets ANDed to 255 and comes out as itself. Same for 168 and 1.
For a 255.0.0.0 (or /8) 255.255.0.0 (or /16), and 255.255.255.0 (or /24) it’s easy, because it’s all 1s or 0s for each block of 8 bits of the 32 bits that make up an IPv4 address. Each block just plops out as itself or zero because it’s all 1s or all 0s for each of the 4 blocks.
Now try that with 23 bits instead of 24.
00000001 for the third octet “1” part of 192.168.1.1
11111110 for “254” part of 255.255.254.0 (aka a /23)
00000000 or 0 for the third octet.
This means that the network ID is 192.168.0.0/23 and the usable IP addresses are 192.168.0.1 through 192.168.1.254.
With a /23 network, you get 512 addresses instead of 256 with a /24 (192.168.0.0-192.168.1.256 versus 1.0 through 1.256). The first IP is the network ID and the last is the broadcast address, both of which are unusable, so you have 510 IP addresses in a /23 to use for devices instead of 254 with a /24.
This is how basic IPv4 subnetting works and it’s how you size various networks for things like Enterprise that needs more than a small home network of less than 254 devices.
Congrats. If you understood that, you now have enough knowledge to probably pass some network exams.
Thank you for this explanation! Now i finally understand what the “mask” part means! Any 0s will mask the IP address in the AND operation and tell the computer that address is not part of the network.
Glad I could help with learning a new thing! If you are curious on anything else networking, I’m a Network Engineer by trade and happy to share knowledge.
Ok one last question: did tailscale have to buy the 100.100.100.x range, or is that available to anyone and they are just the only user i know?
That’s another private range that was added for Carrier-Grade NAT that is part of RFC6598. It’s a non-Internet routable 100.64.0.0/10 subnet for things like WISPs, Satellite providers like Starlink, Tailscale, and cellular providers that are strapped for IPv4 addresses.