Lessons · Cybersecurity · an address and its network mask
Is that address one of ours?
An address is split by its mask into a network part and a host part; two addresses are on the same network when their network parts match, and the prefix length says how many bits that is.
Hone is a place to practise a career, one idea a day. This is one of its lessons, written out in full and free to read without an account.
What it is for
The alert says a connection came from 10.4.21.66. Before anything else, you need to know whether that is a machine in your own office or a stranger, and the mask is what answers it. Guessing from the first number is how outside traffic gets treated as friendly.
How to think about it
Write the network and the prefix, then compare only the network bits. A /24 fixes the first three numbers, a /16 the first two. Host count on a network is 2 to the power of the host bits, minus two for the network address and the broadcast address.
Worked example
Our network: 10.4.20.0/24The first 24 bits are the network, so the first three numbers are fixed.
10.4.20.66: 10.4.20 matches, so it is insideSame network part. One of ours.
10.4.21.66: the third number is 21, not 20, so it is outsideOne number away and on a different network.
Usable hosts on a /24: 2 ** 8 - 2 = 25432 - 24 = 8 host bits, less the network address and the broadcast address.
Your turn
A /26 network. Write the line that gives the number of host bits.
host bits = 32 -
Solve one, graded on the server
The trap
Assuming anything starting with 10. is yours. Private ranges are used by every organisation on earth, including the one on the other end of the site-to-site link.