All exams← All CompTIA Network+ Practice notes

IP addressing & subnetting: CompTIA Network+ Practice revision notes

Revision notes

What IP addressing is for

Every device on a network needs a unique address so traffic knows where to go. Network+ tests both IPv4 and IPv6, plus the subnetting maths that splits one big network into smaller, manageable pieces.

IPv4 basics

An IPv4 address is 32 bits, written as four decimal octets (0-255) separated by dots, eg 192.168.1.10. The subnet mask marks which bits are network and which are host - eg 255.255.255.0 (/24) means the first 24 bits are network, leaving 8 bits (256 addresses, 254 usable) for hosts.

CIDR notation

CIDR (Classless Inter-Domain Routing) writes the mask as a slash and a bit count, like /24 or /26. Usable hosts = 2^(host bits) - 2, because the first address is the network ID and the last is the broadcast address. A /30 gives 4 addresses, 2 usable - perfect for a point-to-point link.

Private address ranges (RFC 1918)

  • Class A: 10.0.0.0 - 10.255.255.255 (/8)
  • Class B: 172.16.0.0 - 172.31.255.255 (/12)
  • Class C: 192.168.0.0 - 192.168.255.255 (/16)

These never route on the public internet - NAT translates them at the edge.

Special addresses to know

  • 127.0.0.1 is loopback (localhost).
  • 169.254.x.x is APIPA - a device gives itself this when DHCP fails.
  • 255.255.255.255 is the limited broadcast address.
  • 0.0.0.0/0 in routing means 'any network' (default route).

Subnetting method

Work out the block size by subtracting the interesting octet's mask value from 256. Eg mask 255.255.255.192 (/26): 256-192=64, so subnets run 0, 64, 128, 192. Each subnet's broadcast is the next subnet's start minus 1. Practise this both ways - given a mask, find the subnets; given a required host count, find the smallest mask that fits.

IPv6 essentials

128-bit address written in 8 groups of hex, eg 2001:0db8::1. Leading zeros in a group can be dropped, and one run of consecutive all-zero groups can be shortened to '::' (only once per address). fe80::/10 is link-local, and there's no broadcast in IPv6 - multicast replaces it.

Common exam traps

  • Forgetting to subtract 2 for network and broadcast addresses.
  • Confusing the network ID with a usable host address.
  • Mixing up /24 (256 addresses) with 255.255.255.0 - they're the same thing written differently, so be fluent converting between them.
  • Applying '::' shortcut twice in one IPv6 address (not allowed).

Key facts

Flashcards

How many bits make up an IPv4 address?
32 bits, shown as four decimal octets 0-255.
tap to reveal
How many bits make up an IPv6 address?
128 bits, shown as 8 groups of hex digits.
tap to reveal
Formula for usable hosts in a subnet?
2^(host bits) minus 2 (subtract network ID and broadcast).
tap to reveal
How many usable hosts on a /30 subnet?
2 usable hosts (4 total addresses) - used for point-to-point links.
tap to reveal
How many usable hosts on a /24 subnet?
254 usable hosts (256 total addresses).
tap to reveal
What are the three RFC 1918 private IPv4 ranges?
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
tap to reveal
What does an APIPA address look like and when does it appear?
169.254.x.x - assigned automatically when a device fails to get a DHCP address.
tap to reveal
What is 127.0.0.1 used for?
Loopback - refers to the device itself (localhost).
tap to reveal
What does 0.0.0.0/0 mean in a routing table?
The default route, matching any destination network.
tap to reveal
What prefix identifies an IPv6 link-local address?
fe80::/10.
tap to reveal
How many times can '::' be used in one IPv6 address?
Only once, to compress a single run of consecutive all-zero groups.
tap to reveal
Does IPv6 use broadcast addresses?
No - IPv6 removes broadcast and uses multicast/anycast instead.
tap to reveal
How do you find subnet block size from a mask like 255.255.255.192?
256 minus the interesting octet value: 256-192=64, so subnets start at 0, 64, 128, 192.
tap to reveal
What does CIDR notation like /26 mean?
The first 26 bits of the address are the network portion; the rest are host bits.
tap to reveal
Practice questions

IP addressing & subnetting: 5 practice questions

Q1. Which of the following is a valid Class C private IP address range as defined by RFC 1918?
  • A.  10.0.0.0 – 10.255.255.255
  • B.  192.168.0.0 – 192.168.255.255
  • C.  169.254.0.0 – 169.254.255.255
  • D.  172.16.0.0 – 172.31.255.255
Show answer & explanation
✓ Answer: B. 192.168.0.0 – 192.168.255.255
RFC 1918 reserves 192.168.0.0/16 for private Class C-style addressing. 172.16.0.0/12 is the Class B private range and 10.0.0.0/8 is the Class A private range, while 169.254.0.0/16 is the APIPA link-local range, not a private RFC 1918 block.
Q2. A host is assigned the IP address 169.254.55.12 with no default gateway configured. What does this most likely indicate?
  • A.  The host successfully received an address from DHCP
  • B.  The host is using a public IP address
  • C.  The host manually configured a static IP
  • D.  The host failed to contact a DHCP server and self-assigned an APIPA address
Show answer & explanation
✓ Answer: D. The host failed to contact a DHCP server and self-assigned an APIPA address
169.254.0.0/16 is the Automatic Private IP Addressing (APIPA) range. Windows and other operating systems assign an address from this block when a DHCP request fails, which is why no gateway is present.
Q3. What is the default subnet mask for a Class B network?
  • A.  255.255.255.252
  • B.  255.0.0.0
  • C.  255.255.255.0
  • D.  255.255.0.0
Show answer & explanation
✓ Answer: D. 255.255.0.0
Class B networks (128.0.0.0–191.255.255.255) use a default mask of 255.255.0.0, or /16, giving 16 bits for the network portion and 16 for hosts. 255.0.0.0 is Class A's default and 255.255.255.0 is Class C's default.
Q4. How many usable host addresses are available on a subnet with a /27 mask?
  • A.  62
  • B.  30
  • C.  14
  • D.  126
Show answer & explanation
✓ Answer: B. 30
A /27 mask leaves 5 host bits (32-27), giving 2^5 = 32 total addresses. Subtracting the network and broadcast addresses leaves 30 usable host addresses.
Q5. An administrator needs to subnet 192.168.10.0/24 into at least 6 subnets while maximizing hosts per subnet. Which subnet mask should be used?
  • A.  255.255.255.224
  • B.  255.255.255.192
  • C.  255.255.255.240
  • D.  255.255.255.128
Show answer & explanation
✓ Answer: A. 255.255.255.224
Borrowing 3 bits (/27, 255.255.255.224) creates 8 subnets, satisfying the requirement for at least 6 while leaving 5 host bits (30 hosts each). Borrowing only 2 bits (/26) yields just 4 subnets, which is insufficient.
Test yourself
See the CompTIA Network+ Practice page

More CompTIA Network+ Practice topics