CAS-004 Security Engineering Practice Question
A security engineer is configuring a Linux server that hosts a web application. The server must accept connections only from the internal network 10.0.0.0/24 and must reject all other incoming traffic. The engineer decides to use iptables. Which command sequence correctly implements this requirement?
⚠ Common exam trap
The trap here is assuming that iptables rules are order-independent or that a default DROP policy exists without being explicitly configured.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
iptables -A INPUT -s 10.0.0.0/24 -j ACCEPT; iptables -A INPUT -j DROP
The requirement is to allow traffic only from 10.0.0.0/24 and drop everything else. In iptables, rules are evaluated in order, so the ACCEPT rule for the internal subnet must come before the DROP rule. Appending ACCEPT then DROP achieves this. Other orderings either block legitimate traffic or permit unauthorized traffic, violating the stated policy.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
iptables -A INPUT -j DROP; iptables -A INPUT -s 10.0.0.0/24 -j ACCEPT
Why it's wrong here
The DROP rule is appended before the ACCEPT rule for the internal subnet. Since iptables evaluates rules sequentially, all incoming packets are dropped before they can reach the ACCEPT rule. This would block all traffic, including that from 10.0.0.0/24, failing the requirement.
- ✗
iptables -A INPUT -s 10.0.0.0/24 -j DROP; iptables -A INPUT -j ACCEPT
Why it's wrong here
This sequence drops traffic from the internal subnet first, which is the opposite of the requirement. The subsequent ACCEPT rule would allow all other traffic. The engineer needs to permit the internal subnet and deny everything else, so this order is incorrect and would block legitimate internal users.
- ✗
iptables -A INPUT -s 10.0.0.0/24 -j REJECT; iptables -A INPUT -j ACCEPT
Why it's wrong here
This sequence rejects traffic from the internal subnet and accepts all other traffic, which is the inverse of the desired policy. REJECT also sends an error response, which is not desired for silent dropping. The requirement is to allow only the internal subnet, so this configuration is incorrect.
- ✓
iptables -A INPUT -s 10.0.0.0/24 -j ACCEPT; iptables -A INPUT -j DROP
Why this is correct
This sequence appends an ACCEPT rule for the internal subnet, then appends a DROP rule for all other traffic. Because iptables processes rules in order, packets from 10.0.0.0/24 match the first rule and are accepted; all other packets fall through to the DROP rule. This correctly implements the requirement.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every CAS-005 question from scratch — 973 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CompTIA exam blueprint
This CAS-005 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CAS-005 exam.