Key ideas
Network and file-size problems count bits and bytes. Subnet masks decide how many hosts fit, transfer time is size over speed, and the size of an image or sound follows from how many bits each sample takes.
- An IPv4 prefix /p leaves 32 − p host bits. The usable hosts are 2^(32 − p) − 2, since the network and broadcast addresses are not usable.
- Splitting a network by borrowing b bits gives 2ᵇ subnets.
- File sizes are in bytes and line speeds in bits per second. Transfer time is size × 8 ÷ speed.
- An uncompressed image takes width × height × bits per pixel ÷ 8 bytes. Audio takes rate × bits × channels × seconds ÷ 8 bytes.
Key equations
hosts = 2^(32 − p) − 2subnets = 2^(borrowed bits)time = size × 8 ÷ speedimage bytes = width × height × bits per pixel ÷ 8audio bytes = rate × bits × channels × seconds ÷ 8
Worked example
A /26 network has 2⁶ − 2 = 62 usable hosts. Splitting a /24 into /27 networks borrows 3 bits, giving 2³ = 8 subnets. A 250 MB file at 100 Mbps takes 250 × 8 ÷ 100 = 20 s. A 1920 × 1080 image at 24 bits per pixel is 1920 × 1080 × 24 ÷ 8 = 6 220 800 bytes, about 6.22 MB. One minute of 44 100 Hz, 16-bit stereo audio is 44 100 × 16 × 2 × 60 ÷ 8 = 10 584 000 bytes, about 10.58 MB.
Common mistakes
- Forgetting to subtract the network and broadcast addresses from the host count.
- Dividing megabytes by megabits per second without multiplying by 8.
- Leaving out the channel count for stereo audio, which halves the size.
Practice
Test yourself with practice questions on this topic: Data size and networks