21 IP Addressing, Subnetting & Routing Practice Questions & Answers
Every IP Addressing, Subnetting & Routing practice question from the CompTIA Network+ Practice Test, with the correct answer and a short explanation.
Start practice test →1. A host is configured with the IPv4 address 192.168.20.77 and a /26 prefix. What is the network address of the subnet this host belongs to?
- A.192.168.20.0
- B.192.168.20.128
- C.192.168.20.65
- D.192.168.20.64✓ Answer
A /26 prefix is the mask 255.255.255.192, so the block size in the last octet is 256 − 192 = 64 and subnet boundaries fall on 0, 64, 128 and 192. The value 77 lies inside the 64–127 block, which makes 192.168.20.64 the network address, 192.168.20.127 the broadcast address and 192.168.20.65 through 192.168.20.126 the usable host range.
Source: RFC 4632 (CIDR) subnet arithmetic; CompTIA Network+ — Networking Concepts domainReport a problem with this question
2. A host has the IPv4 address 10.14.6.203 with the subnet mask 255.255.255.240. What is the broadcast address of its subnet?
- A.10.14.6.206
- B.10.14.6.255
- C.10.14.6.223
- D.10.14.6.207✓ Answer
The mask 255.255.255.240 is a /28, so the block size is 256 − 240 = 16 and subnets start at 0, 16, 32 … 192, 208. The address 203 falls in the 192–207 block, so the network address is 10.14.6.192, the broadcast address is 10.14.6.207, and the 14 usable hosts run from 10.14.6.193 to 10.14.6.206.
Source: RFC 4632 (CIDR) subnet arithmetic; CompTIA Network+ — Networking Concepts domainReport a problem with this question
3. Two servers are configured as 172.16.9.100 and 172.16.9.130, both with the subnet mask 255.255.255.128. Are the two servers in the same subnet?
- A.No — 172.16.9.130 is the broadcast address of its subnet and cannot be assigned to a host.
- B.No — 172.16.9.100 is in 172.16.9.0/25 and 172.16.9.130 is in 172.16.9.128/25, so traffic between them must pass through a router.✓ Answer
- C.Yes — the first three octets are identical, so the two addresses are always local to each other.
- D.Yes — a 25-bit mask still leaves the whole 172.16.9.0 range as one broadcast domain.
The mask 255.255.255.128 is a /25, so the block size is 256 − 128 = 128 and the fourth octet splits into two subnets: 0–127 and 128–255. Host .100 lands in 172.16.9.0/25 and host .130 lands in 172.16.9.128/25, so they are in different broadcast domains and need a Layer 3 hop; matching leading octets alone never prove two hosts are local to each other.
Source: RFC 4632 (CIDR) subnet arithmetic; CompTIA Network+ — Networking Concepts domainReport a problem with this question
4. A network designer must place 100 devices on a single subnet and wants to waste as few addresses as possible. Which subnet mask is the smallest one that still fits the requirement?
- A.255.255.255.0
- B.255.255.255.192
- C.255.255.255.128✓ Answer
- D.255.255.255.224
Usable hosts equal 2^h − 2, because the all-zeros network address and the all-ones broadcast address cannot be assigned. A /25 (255.255.255.128) leaves 7 host bits and yields 126 usable addresses, which covers 100; a /26 yields only 62 (not 64) and a /27 only 30, while a /24 works but wastes 154 addresses. Sizing each segment to its real host count this way is the essence of VLSM.
Source: RFC 4632 (CIDR) and VLSM subnet sizing; CompTIA Network+ — Networking Concepts domainReport a problem with this question
5. Given the subnet 10.5.4.0/22, what is the last usable host address in that subnet?
- A.10.5.5.254
- B.10.5.4.254
- C.10.5.7.254✓ Answer
- D.10.5.7.255
A /22 is the mask 255.255.252.0, so the interesting octet is the third and the block size is 256 − 252 = 4. The subnet therefore spans 10.5.4.0 through 10.5.7.255: the network address is 10.5.4.0, the broadcast address is 10.5.7.255, the last usable host is 10.5.7.254, and the subnet holds 1022 usable addresses.
Source: RFC 4632 (CIDR) subnet arithmetic; CompTIA Network+ — Networking Concepts domainReport a problem with this question
6. Which of the following IPv4 addresses is a public address that can be routed across the internet without translation?
- A.192.168.250.7
- B.172.32.14.9✓ Answer
- C.172.20.5.4
- D.127.14.9.3
RFC 1918 reserves exactly three private blocks: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255 and 192.168.0.0–192.168.255.255. Because the second block stops at 172.31, an address beginning 172.32 is outside it and is ordinary public space; 172.20.5.4 and 192.168.250.7 are private and require NAT to reach the internet, and 127.x.x.x is the loopback range, which never leaves the host.
Source: RFC 1918 private address allocation; RFC 1122 loopback range 127.0.0.0/8Report a problem with this question
7. A workstation that normally uses DHCP shows the address 169.254.18.44 with the mask 255.255.0.0. It can reach a couple of other machines on the same switch, but not the default gateway or the internet. What is the most likely cause?
- A.A duplicate IP address conflict pushed the workstation onto a backup address.
- B.The DNS server entry is wrong, so the client fell back to a reserved range.
- C.The client received no reply from a DHCP server and self-assigned an IPv4 link-local (APIPA) address.✓ Answer
- D.The default gateway is filtering the workstation's MAC address.
169.254.0.0/16 is the IPv4 link-local range a host assigns itself when no DHCP server answers, which is why the symptom is diagnostic rather than accidental. Link-local addresses are valid only on the attached link, so the host can talk to other self-assigned neighbours but nothing routed. Typical root causes are a stopped DHCP service, an exhausted address pool, or a routed/VLAN segment with no DHCP relay (IP helper), since the DHCP DISCOVER is a broadcast that routers do not forward.
Source: RFC 3927 IPv4 link-local addressing (169.254.0.0/16); CompTIA Network+ — Network Troubleshooting domainReport a problem with this question
8. A content provider assigns the same IP address to servers in several cities, and the routing system delivers each client's packets to whichever of those servers is nearest along the best path. Which addressing and delivery type does this describe?
- A.Broadcast — one-to-all delivery to every host on the local segment
- B.Anycast — one-to-nearest delivery among several hosts that share one address✓ Answer
- C.Unicast — one-to-one delivery to a single unique interface
- D.Multicast — one-to-many delivery to the hosts that joined a group
Anycast is defined by several interfaces sharing one address while the routing system picks the topologically nearest instance, so the same destination address is answered by different servers depending on where the client is. Unicast targets one interface, multicast reaches only hosts that joined a group, and broadcast floods a single local segment and does not cross a router.
Source: RFC 4786 operation of anycast services; CompTIA Network+ — Networking Concepts domain (traffic types)Report a problem with this question
9. A router advertises the four contiguous networks 192.168.8.0/24, 192.168.9.0/24, 192.168.10.0/24 and 192.168.11.0/24. Which single summary route covers exactly those four networks and nothing else?
- A.192.168.0.0/16
- B.192.168.8.0/21
- C.192.168.8.0/23
- D.192.168.8.0/22✓ Answer
Summarization (supernetting) shortens the prefix until one block covers all the component networks. Four contiguous /24s hold 4 × 256 = 1024 addresses, which means shortening the prefix by 2 bits to /22, and 192.168.8.0/22 spans 192.168.8.0 to 192.168.11.255 exactly. A /23 would only cover the first two networks, while a /21 would also advertise 192.168.12.0 through 192.168.15.255, which the router does not own.
Source: RFC 4632 (CIDR) route aggregation; CompTIA Network+ — Network Implementation domainReport a problem with this question
10. A router's IPv4 routing table contains these entries: 0.0.0.0/0 via 203.0.113.1; 10.0.0.0/8 via 10.1.1.1; 10.20.0.0/16 via 10.1.2.1; 10.20.30.0/24 via 10.1.3.1. A packet arrives destined for 10.20.30.45. Which next hop does the router use?
- A.10.1.3.1✓ Answer
- B.10.1.1.1
- C.203.0.113.1
- D.10.1.2.1
A routing-table lookup applies longest prefix match first: all four entries match 10.20.30.45, but the /24 is the most specific, so 10.1.3.1 is chosen regardless of how each route was learned. Administrative distance only breaks a tie when the same prefix is learned from different sources, and a metric only compares paths to that prefix inside one routing protocol; the 0.0.0.0/0 default route is used only when nothing more specific matches.
Source: RFC 1812 requirements for IPv4 routers — longest-prefix-match forwarding; CompTIA Network+ — Network Implementation domainReport a problem with this question
11. Which statement correctly distinguishes administrative distance from a routing metric?
- A.Administrative distance chooses between routes with different prefix lengths, while the metric chooses between routes with the same prefix length.
- B.Administrative distance is carried in the packet header and decremented at every hop.
- C.Administrative distance ranks how trustworthy each routing source is when the same prefix is learned from more than one source, while a metric compares competing paths to that prefix inside a single routing protocol.✓ Answer
- D.The metric is evaluated first, and administrative distance is used only to break ties between equal metrics.
The two values answer different questions: administrative distance is a locally significant preference between route sources for the identical prefix (the lower value is trusted and installed), while a metric such as hop count, cost or a composite value ranks paths that one protocol already knows to the same destination. Prefix length is decided before either of them, and the field that decrements at each hop is the IP header's TTL, not administrative distance.
Source: CompTIA Network+ — Network Implementation domain (route selection: administrative distance, prefix length, metric)Report a problem with this question
12. Which routing protocol is a path-vector protocol used as an exterior gateway protocol to exchange reachability information between autonomous systems?
- A.OSPF
- B.BGP✓ Answer
- C.EIGRP
- D.RIP
BGP advertises the full list of autonomous systems a prefix has traversed, which is what makes it a path-vector protocol and lets operators apply routing policy between organizations; it is the exterior gateway protocol that ties autonomous systems together. OSPF is a link-state interior protocol, RIP is a classic distance-vector interior protocol using hop count, and EIGRP is an advanced distance-vector interior protocol.
Source: RFC 4271 Border Gateway Protocol; CompTIA Network+ — Network Implementation domainReport a problem with this question
13. Which of the following is NOT a valid way to write the IPv6 address 2001:0db8:0000:0000:00a3:0000:0000:1f4e?
- A.2001:db8::a3:0:0:1f4e
- B.2001:db8::a3::1f4e✓ Answer
- C.2001:0db8:0000:0000:00a3:0000:0000:1f4e
- D.2001:db8:0:0:a3:0:0:1f4e
The IPv6 text rules allow leading zeros in a group to be dropped (as long as one numeral remains) and allow the double colon to replace one or more consecutive all-zero groups, but the double colon may appear only once in an address. With two of them the reader cannot tell how many zero groups belong on each side, so the address is ambiguous and invalid; the other three forms all expand back to the same 128-bit value.
Source: RFC 4291 IPv6 addressing architecture — text representation rulesReport a problem with this question
14. An interface reports two IPv6 addresses: fe80::1c2b:5aff:fe33:9d11 and 2001:db8:4:1::20. Which statement about the fe80 address is correct?
- A.It is the global unicast address the provider assigned for internet access.
- B.It is a unique local address, the IPv6 counterpart of RFC 1918 space, and can be routed throughout the enterprise.
- C.It is a link-local unicast address from fe80::/10 that is valid only on the attached link; routers never forward it, and it is used for neighbor discovery and as a next-hop address.✓ Answer
- D.It is a multicast group address used to reach every router on the link.
Every IPv6 interface forms a link-local address in fe80::/10 automatically, and its scope is the single link, so routers must not forward packets with a link-local source or destination off that link. Unique local addresses come from fc00::/7 and multicast addresses from ff00::/8, so neither prefix matches fe80, and the 2001: address is the routable global unicast one.
Source: RFC 4291 IPv6 addressing architecture — link-local unicast fe80::/10Report a problem with this question
15. A router advertises the prefix 2001:db8:1:1::/64 on a segment, and a host whose MAC address is 00:1A:2B:3C:4D:5E builds its address with SLAAC using a modified EUI-64 interface identifier. Which address does the host form?
- A.2001:db8:1:1:21a:2bff:fe3c:4d5e✓ Answer
- B.2001:db8:1:1:21a:2bfe:ff3c:4d5e
- C.2001:db8:1:1:1a:2b3c:4d5e:ffff
- D.2001:db8:1:1:1a:2bff:fe3c:4d5e
Modified EUI-64 splits the 48-bit MAC in half, inserts FFFE between the two halves (001A:2BFF:FE3C:4D5E), and then inverts the universal/local bit — the seventh bit of the first octet — which turns 00 into 02, giving 021A:2BFF:FE3C:4D5E, written as 21a:2bff:fe3c:4d5e once the leading zero is suppressed. In SLAAC the host learns the /64 prefix from a Router Advertisement and generates the 64-bit interface identifier itself; forgetting the bit flip is the classic error, and inserting FEFF instead of FFFE is another.
Source: RFC 4291 modified EUI-64 interface identifiers; RFC 4862 IPv6 stateless address autoconfigurationReport a problem with this question
16. An organization runs an IPv6-only client network. Its users must still reach a partner application that is published only on IPv4. Which approach solves this?
- A.Deploy NAT64 together with DNS64, translating the IPv6 client traffic into IPv4 toward the destination.✓ Answer
- B.Build a 6in4 tunnel between the two sites.
- C.Give the clients unique local addresses from fc00::/7.
- D.Enable SLAAC on the client subnet.
Only a translation mechanism bridges two different address families: NAT64 rewrites IPv6 packets into IPv4 at the boundary while DNS64 synthesizes an IPv6 record for an IPv4-only name so the client has something to send to. Tunneling such as 6in4 merely carries IPv6 inside IPv4 between IPv6 speakers, dual stack would require the destination itself to run IPv6, SLAAC only assigns addresses, and unique local addressing does not reach anything outside.
Source: RFC 6146 stateful NAT64; RFC 6147 DNS64Report a problem with this question
17. On an IEEE 802.1Q trunk link, how is traffic belonging to the native VLAN handled?
- A.It is tagged with VLAN 4095, the VLAN reserved for trunk links.
- B.It is tagged twice, once by each switch on the link.
- C.It crosses the trunk untagged, which is why a native VLAN mismatch between the two switches leaks traffic into the wrong VLAN.✓ Answer
- D.It is dropped unless both switches enable jumbo frames.
By definition the native VLAN is the one VLAN whose frames traverse an 802.1Q trunk without a tag, so each switch decides locally which VLAN untagged arrivals belong to. If the neighbours are configured with different native VLANs, untagged frames sent in one VLAN are absorbed into another, merging two broadcast domains; the same untagged behaviour is what double-tagging VLAN hopping abuses, which is why the native VLAN should not carry user data.
Source: IEEE 802.1Q — native (untagged) VLAN on a trunk portReport a problem with this question
18. Which statement accurately describes IEEE 802.1Q VLAN tagging on an Ethernet frame?
- A.The tag is appended after the frame check sequence as a trailer.
- B.The tag is 8 bytes long and carries a 16-bit VLAN ID, allowing 65,536 VLANs.
- C.The frame is encapsulated inside a new IP header that carries the VLAN ID.
- D.A 4-byte tag is inserted after the source MAC address, and its 12-bit VLAN ID field leaves IDs 1 through 4094 assignable to user VLANs.✓ Answer
The 802.1Q tag sits inside the Layer 2 header, right after the source MAC address, and consists of a 2-byte tag protocol identifier plus 2 bytes of control information holding a priority field, a drop-eligible bit and the 12-bit VLAN identifier. Twelve bits give 4096 values, but 0 marks a priority-only tag and 4095 is reserved, leaving 1–4094 usable; adding those 4 bytes also raises the maximum frame from 1518 to 1522 bytes.
Source: IEEE 802.1Q VLAN tag formatReport a problem with this question
19. Two PCs connected to the same access switch are in VLAN 10 and VLAN 20, each with a correct address in its own subnet, but they cannot communicate. What is required to let them exchange traffic?
- A.Provide a Layer 3 interface for each VLAN — either a router subinterface per VLAN reached over a trunk (router-on-a-stick) or a switch virtual interface on a Layer 3 switch.✓ Answer
- B.Enable jumbo frames so the larger tagged frames can pass.
- C.Configure both access ports as trunk ports.
- D.Move both PCs into the same VLAN by disabling tagging on the switch.
A VLAN is a separate broadcast domain mapped to its own IP subnet, and a Layer 2 switch will not move frames between VLANs no matter how the ports are configured. Reaching another VLAN therefore requires a routed hop that owns a gateway address in each subnet, supplied either by a router subinterface per VLAN over an 802.1Q trunk or by an SVI on a multilayer switch; turning access ports into trunks or changing the MTU does nothing to provide that gateway.
Source: CompTIA Network+ — Network Implementation domain (VLANs, SVI and router subinterfaces); IEEE 802.1QReport a problem with this question
20. About 200 internal hosts using RFC 1918 addresses share one public IPv4 address for outbound internet access, all at the same time. Which translation method makes that possible, and how does it work?
- A.Static NAT, which permanently maps each inside address to its own public address.
- B.Dynamic NAT, which leases a distinct public address from a pool to each inside host.
- C.PAT (NAT overload), which multiplexes many inside hosts behind one public address by rewriting the source port number and tracking each session in a translation table.✓ Answer
- D.Port forwarding, which maps one public port to one inside host.
PAT is the many-to-one form of NAT: because it rewrites the source port as well as the source address, the router can distinguish thousands of concurrent sessions that all leave with the same public IP and map each reply back to the right inside host. Static NAT is one-to-one and dynamic NAT is many-to-many from a pool, so both run out of addresses long before 200 simultaneous hosts, and port forwarding only publishes an inbound service rather than translating outbound sessions.
Source: RFC 3022 traditional IP network address translator (NAPT / port translation); CompTIA Network+ — Network Implementation domainReport a problem with this question
21. An internal web server at 10.10.5.20 must accept connections from the internet on TCP port 443 through the site's single public IPv4 address, while the other internal hosts stay unreachable from outside. What should be configured, and what does that mechanism not provide?
- A.An APIPA address on the server so that it becomes globally reachable.
- B.Port forwarding (a static destination NAT entry) mapping the public address and TCP port 443 to 10.10.5.20; NAT is an addressing function, so a firewall policy or ACL is still needed to inspect and filter that traffic.✓ Answer
- C.PAT alone, which automatically permits inbound sessions to any inside host that has an active translation.
- D.A second default route pointing at the provider, which publishes the server automatically.
Port forwarding is destination NAT: a fixed entry rewrites the public address and port of arriving packets to the inside server's address and port, which is exactly how a single service is published without exposing the rest of the private range. The obscurity that NAT gives inside hosts is a side effect of translation, not a security control, so filtering, inspection and access rules must still come from a firewall or ACL; PAT builds its table from outbound sessions and does not accept unsolicited inbound connections, and 169.254.x.x link-local addresses are never routable.
Source: RFC 3022 static/destination network address translation; CompTIA Network+ — Network Implementation domainReport a problem with this question
Practice questions based on the CompTIA Network+ exam domains and the published standards the exam is built on (IEEE 802.3 and 802.11, IEEE 802.1Q and 802.1X, the IANA port registry, IETF RFCs, and TIA-568 cabling). CompTIA and Network+ are marks of CompTIA; this site is not affiliated with or endorsed by CompTIA. Exam objectives are revised periodically — check the current official objectives for your exam version before testing. About the Network+ exam →