ANDing It Out
Lesson 13 of 46 in Coddy's IP Addressing and Subnetting course.
Here is what a machine actually does with the mask: a bitwise AND between address and mask. Wherever the mask has a 1, the address bit survives; wherever it has a 0, the result is 0. What comes out is the network address.
Only the partial octet needs real work. For 192.168.10.130 with mask 255.255.255.128: the first three octets pass through untouched, and in the last octet 130 (10000010) AND 128 (10000000) keeps only the top bit: 128.
Result: 192.168.10.128. Every routing decision on Earth starts with this operation.
Challenge
BeginnerAND the address 192.168.10.130 with the mask 255.255.255.128 and print the resulting network address.
Expected output:
192.168.10.128Try it yourself
All lessons in IP Addressing and Subnetting
Practice on your own: Terminal playground