The ipaddress module does subnet arithmetic correctly, including the small blocks most calculators get wrong. This set covers building a network from a host address, why a /24 holds 256 addresses but only 254 usable hosts, why a /31 reserves nothing, and how to pull one block out of a split network. The task reads a network, splits it, and asks you to paste the four lines.
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.
Read a network and split it
This builds the network that a host address sits in, reads its mask, its broadcast address and its address count, counts the usable hosts, splits the block into four smaller ones, and lists the addresses of a two address point-to-point link. Paste all four lines.
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.
The last line is a Python list holding the two IPv4Address values of the point-to-point link.
the host address was rounded down to its network
the netmask is the one for a /24
the broadcast address is the last in the block
the usable host count is 254, not the address count
the /24 splits into four /26 blocks
the /31 lists both of its addresses as usable
the command actually ran
What a good answer looks like
Four lines. The first is the network 192.168.1.0/24, its mask 255.255.255.0, its broadcast address 192.168.1.255 and its address count 256. The second is 254, the usable hosts, because the network and broadcast addresses are reserved. The third is 4, the number of /26 blocks that fit inside the /24. The fourth is a list holding 10.0.0.4 and 10.0.0.5, because a /31 reserves nothing and both addresses are usable. If the second line is 256 you counted all the addresses rather than the usable hosts.
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.