Do the AND operation a router does
Task
Take five address-and-mask pairs, work out the network address by hand with a bitwise AND, then check every answer. This is the single calculation underneath subnetting, route selection and half the troubleshooting in domain 5 — and the exam gives you no calculator.
Steps
- Write out the five pairs and convert each address and mask to binary, one octet at a time:
- 192.168.10.37 with 255.255.255.0
- 10.14.200.19 with 255.255.0.0
- 172.16.45.200 with 255.255.255.192
- 192.168.1.130 with 255.255.255.128
- 10.0.5.77 with 255.255.255.240
- AND them bit by bit. A 1 in the mask keeps the address bit; a 0 zeroes it. Only the octet where the mask is neither 255 nor 0 needs real work.
- Convert the result back to dotted decimal. That is the network address.
- For each, also write the broadcast address by setting every host bit to 1, and give the number of usable hosts.
- Check yourself, then redo any you got wrong by hand rather than reading the answer. The point is the procedure, not the number.
Verify
python3 -c "
import ipaddress
pairs = [('192.168.10.37','255.255.255.0'), ('10.14.200.19','255.255.0.0'),
('172.16.45.200','255.255.255.192'), ('192.168.1.130','255.255.255.128'),
('10.0.5.77','255.255.255.240')]
for a, m in pairs:
n = ipaddress.ip_network(a + '/' + m, strict=False)
print(a, m, 'network', n.network_address, 'broadcast', n.broadcast_address,
'prefix', n.prefixlen, 'usable', n.num_addresses - 2)
"
Five lines, and every one must match what you wrote down. If the third and fifth are the ones you missed, that is normal — those are the masks with a partial octet, and they are what the exam actually tests.
Notes
The shortcut worth internalising: the mask octets 128, 192, 224, 240, 248, 252, 254 and 255 correspond to block sizes of 128, 64, 32, 16, 8, 4, 2 and 1. Find the block size and the network addresses are simply multiples of it. A mask of 255.255.255.192 gives blocks of 64, so the networks start at .0, .64, .128 and .192.
That single table replaces most binary conversion under exam time pressure, but you should be able to do it the long way first, which is what this lab is for.