A prefix length answers four questions at once: the network, the mask, the broadcast address and the host count. These questions check that you can work out each of them, and that you know what changes when the prefix gets very long.
Each one is marked as you go, and the explanation arrives straight after, which is
the part worth reading.
4 questions, marked as you go.
Tasks
These need your own device. Run the command in Termux, then paste what it printed.
The marking looks at what the output means, so spacing, version numbers and
ordering do not matter. If you have not installed anything yet, the
lesson covers the setup.
Work out a /31 the way the RFC says
The subnetcalc.sh you finished is saved next to you. This asks it about a /31, which is the case most calculators get wrong: there is no room to reserve a network or broadcast address, so both addresses are usable. Paste the output.
Run this in Termux
On your own device. Nothing on this page executes it. The command runs in
your terminal, and this box only reads what you paste back.
bash subnetcalc.sh 10.0.0.5/31
Look at the usable line, and at which addresses it calls the first and last host.
the network address is right
both /31 addresses are counted as usable
the first host is the network address
the script ran
What a good answer looks like
The network is 10.0.0.4 and the broadcast is 10.0.0.5, but usable reads 2, not 0. The first host is the network address itself and the last is the broadcast address, because RFC 3021 says a /31 has no reserved addresses and both are usable. That is what makes a /31 the right choice on a point-to-point link between two routers, where there is no need for a network or broadcast address. If your usable figure is 0, the script subtracted two addresses that were never reserved.
Marking your own work
Both halves of this are checked in your browser, with no server involved, so nothing
stops you from pasting output you did not run. The tasks are written so that the
easiest way to pass one is to actually do it and read the result, which is the whole
intention.