IPv4 addressing, subnet masks & CIDR

Computer Science · Networking

Question 1 of 10

0

    How many addresses in total (including the network and broadcast addresses) are there in a /25 IPv4 subnet?

    Decimals (0.75 or 0,75), fractions (3/4) and mixed numbers (1 1/2) are accepted. Do not use thousands separators.

    How to type your answer
    • Fractions: 3/4. Mixed numbers: 1 1/2.
    • Decimals with a point or a comma: 0.75 or 0,75.
    • Negative numbers start with a minus: -3/4.
    • Percentages need the % sign: 75%.

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    IPv4 addressing, subnet masks & CIDR explained

    An IP address identifies a device on a network. An IPv4 address is 32 bits long, written as four decimal numbers called octets, separated by full stops, such as 192.168.1.10. Each octet is a number from 0 to 255, which is the value of eight bits. An IPv4 address has two parts: a network part, which identifies the network, and a host part, which identifies the device on that network. Every device on the same network shares the same network part.

    The subnet mask shows where the split falls. It is also 32 bits long, with a run of 1s for the network part followed by 0s for the host part, such as 255.255.255.0. A device finds its network address by performing a bitwise AND between its IP address and the subnet mask. Classless inter-domain routing (CIDR) writes the mask as a slash followed by the number of network bits, so 255.255.255.0 is written /24.

    The number of addresses in a network equals 2 raised to the number of host bits. Two of these are reserved: the network address, where all host bits are 0, and the broadcast address, where all host bits are 1. The rest are usable by devices.

    Worked example

    Find the network address, broadcast address and number of usable hosts for 192.168.10.37/26.

    1. The mask /26 has 26 network bits, so the host part has 6 bits. The mask is 255.255.255.192.
    2. Network address: 37 AND 192 is 00100101 AND 11000000 = 00000000, so it is 192.168.10.0.
    3. Broadcast address: 192.168.10.63. Usable hosts: 26−2=622^6 - 2 = 62.

    What you will practise

    New numbers every time you practise. Levels: Easy, Medium, Hard. Each answer is followed by a worked explanation.

    Example questions

    • Easy

      How many addresses in total (including the network and broadcast addresses) are there in a /31 IPv4 subnet?

    • Medium

      The host 192.168.28.1/25 is on a subnet. What is the last octet of the subnet's broadcast address?

    • Hard

      A network must support 1069 hosts. What is the longest prefix length (largest /n) of a subnet that still provides at least 1069 usable host addresses?